summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile_Elua.am3
-rw-r--r--src/bin/elua/main.c27
2 files changed, 21 insertions, 9 deletions
diff --git a/src/Makefile_Elua.am b/src/Makefile_Elua.am
index f818793ce3..7f1e7fa926 100644
--- a/src/Makefile_Elua.am
+++ b/src/Makefile_Elua.am
@@ -9,7 +9,8 @@ bin_elua_elua_SOURCES = \
9bin_elua_elua_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ 9bin_elua_elua_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
10 -DELUA_CORE_DIR="\"$(datadir)/elua/core\"" \ 10 -DELUA_CORE_DIR="\"$(datadir)/elua/core\"" \
11 -DELUA_MODULES_DIR="\"$(datadir)/elua/modules\"" @ELUA_CFLAGS@ \ 11 -DELUA_MODULES_DIR="\"$(datadir)/elua/modules\"" @ELUA_CFLAGS@ \
12 -DLOCALE_DIR=\"@LOCALE_DIR@\" 12 -DLOCALE_DIR=\"@LOCALE_DIR@\" \
13 -DPACKAGE_BUILD_DIR=\"`pwd`/$(top_builddir)\"
13bin_elua_elua_LDADD = @ELUA_LIBS@ 14bin_elua_elua_LDADD = @ELUA_LIBS@
14bin_elua_elua_DEPENDENCIES = @ELUA_INTERNAL_LIBS@ 15bin_elua_elua_DEPENDENCIES = @ELUA_INTERNAL_LIBS@
15 16
diff --git a/src/bin/elua/main.c b/src/bin/elua/main.c
index 4b5c1539a1..e2285f8dec 100644
--- a/src/bin/elua/main.c
+++ b/src/bin/elua/main.c
@@ -95,13 +95,18 @@ static int register_require(lua_State *L) {
95 int n = 2; 95 int n = 2;
96 lua_pushvalue(L, 1); 96 lua_pushvalue(L, 1);
97 require_ref = luaL_ref(L, LUA_REGISTRYINDEX); 97 require_ref = luaL_ref(L, LUA_REGISTRYINDEX);
98 if (!corepath) { 98 if (getenv("EFL_RUN_IN_TREE")) {
99 if (noenv || !(corepath = getenv("ELUA_CORE_DIR")) || !corepath[0]) 99 corepath = PACKAGE_BUILD_DIR "/src/bin/elua/core";
100 corepath = ELUA_CORE_DIR; 100 modpath = PACKAGE_BUILD_DIR "/src/bin/elua/modules";
101 } 101 } else {
102 if (!modpath) { 102 if (!corepath) {
103 if (noenv || !(modpath = getenv("ELUA_MODULES_DIR")) || !modpath[0]) 103 if (noenv || !(corepath = getenv("ELUA_CORE_DIR")) || !corepath[0])
104 modpath = ELUA_MODULES_DIR; 104 corepath = ELUA_CORE_DIR;
105 }
106 if (!modpath) {
107 if (noenv || !(modpath = getenv("ELUA_MODULES_DIR")) || !modpath[0])
108 modpath = ELUA_MODULES_DIR;
109 }
105 } 110 }
106 lua_pushfstring(L, "%s/?.lua;", corepath); 111 lua_pushfstring(L, "%s/?.lua;", corepath);
107 EINA_LIST_FOREACH(largs, l, data) { 112 EINA_LIST_FOREACH(largs, l, data) {
@@ -309,7 +314,13 @@ static int lua_main(lua_State *L) {
309 314
310 luaL_openlibs(L); 315 luaL_openlibs(L);
311 316
312 if (!(coref = coredir)) { 317 if (getenv("EFL_RUN_IN_TREE")) {
318 Arg_Data *v = malloc(sizeof(Arg_Data));
319 v->type = ARG_LIBDIR;
320 v->value = PACKAGE_BUILD_DIR "/src/bindings/luajit";
321 largs = eina_list_append(largs, v);
322 coref = PACKAGE_BUILD_DIR "/src/bin/elua/core";
323 } else if (!(coref = coredir)) {
313 if (noenv || !(coref = getenv("ELUA_CORE_DIR")) || !coref[0]) { 324 if (noenv || !(coref = getenv("ELUA_CORE_DIR")) || !coref[0]) {
314 coref = ELUA_CORE_DIR; 325 coref = ELUA_CORE_DIR;
315 } 326 }