forked from enlightenment/efl
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)
This commit is contained in:
parent
652e2f688b
commit
8077e14fd6
|
@ -2,7 +2,7 @@ if HAVE_ELUA_BIN
|
|||
ELUA_GEN = @elua_bin@ :lualian
|
||||
_ELUA_GEN_DEP = @elua_bin@
|
||||
else
|
||||
ELUA_GEN = LD_LIBRARY_PATH=$(top_builddir)/src/lib/eolian/.libs \
|
||||
ELUA_GEN = ELUA_EOLIAN_LIBRARY_PATH=$(top_builddir)/src/lib/eolian/.libs \
|
||||
EFL_RUN_IN_TREE=1 $(top_builddir)/src/bin/elua/elua${EXEEXT} :lualian
|
||||
_ELUA_GEN_DEP = bin/elua/elua${EXEEXT}
|
||||
endif
|
||||
|
|
|
@ -71,7 +71,17 @@ local loaded_libc = {}
|
|||
M.lib_load = function(libname)
|
||||
local lib = loaded_libs[libname]
|
||||
if not lib then
|
||||
lib = ffi.load(libname)
|
||||
local ev = os.getenv("ELUA_" .. libname:upper() .. "_LIBRARY_PATH")
|
||||
if not ev or ev == "" then
|
||||
lib = ffi.load(libname)
|
||||
else
|
||||
if ffi.os == "Windows" then
|
||||
lib = ffi.load(ev .. "\\" .. libname .. ".dll")
|
||||
else
|
||||
lib = ffi.load(ev .. "/lib" .. libname .. ".so")
|
||||
end
|
||||
-- XXX: perhaps check here if it's loaded and fallback to default?
|
||||
end
|
||||
loaded_libs[libname] = lib
|
||||
loaded_libc[libname] = 0
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue