summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2014-11-03 13:20:27 +0000
committerDaniel Kolesa <d.kolesa@samsung.com>2014-11-03 13:20:54 +0000
commit8077e14fd6362dfb3ab29f54b77019f89c1d8687 (patch)
tree81ac90f3c6bf0846cba55851f657acd2e554c183
parent652e2f688bb7c7057e69a4740181c12f17aa4e1d (diff)
elua: support for environment variable library path lookups in util.lib_load
This allows us to get rid of the LD_LIBRARY_PATH hack and thus make it more cross-plaform as well as fix some bad behavior (with the hack it still looked up the systemwide library if present instead of preferring in-tree)
-rw-r--r--src/Makefile_Elua_Helper.am2
-rw-r--r--src/bin/elua/core/util.lua12
2 files changed, 12 insertions, 2 deletions
diff --git a/src/Makefile_Elua_Helper.am b/src/Makefile_Elua_Helper.am
index aa14f92..d6f383c 100644
--- a/src/Makefile_Elua_Helper.am
+++ b/src/Makefile_Elua_Helper.am
@@ -2,7 +2,7 @@ if HAVE_ELUA_BIN
2ELUA_GEN = @elua_bin@ :lualian 2ELUA_GEN = @elua_bin@ :lualian
3_ELUA_GEN_DEP = @elua_bin@ 3_ELUA_GEN_DEP = @elua_bin@
4else 4else
5ELUA_GEN = LD_LIBRARY_PATH=$(top_builddir)/src/lib/eolian/.libs \ 5ELUA_GEN = ELUA_EOLIAN_LIBRARY_PATH=$(top_builddir)/src/lib/eolian/.libs \
6 EFL_RUN_IN_TREE=1 $(top_builddir)/src/bin/elua/elua${EXEEXT} :lualian 6 EFL_RUN_IN_TREE=1 $(top_builddir)/src/bin/elua/elua${EXEEXT} :lualian
7_ELUA_GEN_DEP = bin/elua/elua${EXEEXT} 7_ELUA_GEN_DEP = bin/elua/elua${EXEEXT}
8endif 8endif
diff --git a/src/bin/elua/core/util.lua b/src/bin/elua/core/util.lua
index 02b89a3..78db3ab 100644
--- a/src/bin/elua/core/util.lua
+++ b/src/bin/elua/core/util.lua
@@ -71,7 +71,17 @@ local loaded_libc = {}
71M.lib_load = function(libname) 71M.lib_load = function(libname)
72 local lib = loaded_libs[libname] 72 local lib = loaded_libs[libname]
73 if not lib then 73 if not lib then
74 lib = ffi.load(libname) 74 local ev = os.getenv("ELUA_" .. libname:upper() .. "_LIBRARY_PATH")
75 if not ev or ev == "" then
76 lib = ffi.load(libname)
77 else
78 if ffi.os == "Windows" then
79 lib = ffi.load(ev .. "\\" .. libname .. ".dll")
80 else
81 lib = ffi.load(ev .. "/lib" .. libname .. ".so")
82 end
83 -- XXX: perhaps check here if it's loaded and fallback to default?
84 end
75 loaded_libs[libname] = lib 85 loaded_libs[libname] = lib
76 loaded_libc[libname] = 0 86 loaded_libc[libname] = 0
77 end 87 end