File 0005-Check-system-wide-libdir-in-case-of-source-based-dep.patch of Package erlang-rebar

From 829518d309a1cad38cadbecf810c208879d7e085 Mon Sep 17 00:00:00 2001
From: "Jeroen van Meeuwen (Kolab Systems)" <vanmeeuwen@kolabsys.com>
Date: Mon, 18 May 2015 11:48:49 +0200
Subject: [PATCH 5/7] Check system wide libdir in case of source based dep

---
 src/rebar_deps.erl | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl
index a6e5b27..ba2b4e8 100644
--- a/src/rebar_deps.erl
+++ b/src/rebar_deps.erl
@@ -429,7 +429,12 @@ find_dep(Config, Dep, _Source) ->
     %% _Source is defined.  Regardless of what it is, we must find it
     %% locally satisfied or fetch it from the original source
     %% into the project's deps
-    find_dep_in_dir(Config, Dep, get_deps_dir(Config, Dep#dep.app)).
+    case find_dep_in_dir(Config, Dep, get_deps_dir(Config, Dep#dep.app)) of
+        {_Config1, {avail, _Dir}} = Avail ->
+            Avail;
+        {Config1, {missing, _}} ->
+            find_dep_in_dir(Config1, Dep, get_lib_dir(Dep#dep.app))
+    end.
 
 find_dep_in_dir(Config, _Dep, {false, Dir}) ->
     {Config, {missing, Dir}};
-- 
2.5.0