stefan pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=d5d0b689537a4eef2025e098b686c999970d488a

commit d5d0b689537a4eef2025e098b686c999970d488a
Author: Stefan Schmidt <s.schm...@samsung.com>
Date:   Thu Apr 23 11:27:06 2015 +0200

    elm_module: Load not installed modules from build dir with ELM_RUN_IN_TREE
    
    If we want to run from the local build dir without make install before
    elm_module would fail to load the modules as it is expecting them in the
    final install location.
    
    We can now change this by setting ELM_RUN_IN_TREE to force it load the not
    yet installed modules.
    
    ref T2028
---
 src/lib/Makefile.am   |  1 +
 src/lib/elm_module.c  | 11 +++++++++--
 src/tests/Makefile.am |  3 ++-
 src/tests/elm_suite.c |  2 ++
 4 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 999faef..41f5ec3 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -22,6 +22,7 @@ AM_CPPFLAGS = \
 -DLOCALE_DIR=\"$(localedir)\" \
 -DPACKAGE_LIB_DIR=\"$(libdir)\" \
 -DICON_DIR=\"$(datadir)/icons\" \
+-DELM_TOP_BUILD_DIR=\"$(top_builddir)\" \
 -DELEMENTARY_BUILD \
 @ELEMENTARY_CFLAGS@
 
diff --git a/src/lib/elm_module.c b/src/lib/elm_module.c
index 39c7c6a..febb15e 100644
--- a/src/lib/elm_module.c
+++ b/src/lib/elm_module.c
@@ -131,9 +131,16 @@ _elm_module_load(Elm_Module *m)
    if (m->module) return EINA_TRUE;
    if (strchr(m->name, '/')) return EINA_FALSE;
 
-   snprintf(buf, sizeof(buf),
-            "%s/elementary/modules/%s/%s/module"EFL_SHARED_EXTENSION,
+   if (getenv("ELM_RUN_IN_TREE"))
+     {
+        snprintf(buf, sizeof(buf),
+             ELM_TOP_BUILD_DIR 
"/src/modules/%s/.libs/module"EFL_SHARED_EXTENSION, m->name);
+     }
+   else
+     {
+        snprintf(buf, sizeof(buf), 
"%s/elementary/modules/%s/%s/module"EFL_SHARED_EXTENSION,
             _elm_lib_dir, m->name, MODULE_ARCH);
+     }
    m->module = eina_module_new(buf);
    if ((m->module) && (eina_module_load(m->module) == EINA_TRUE))
      {
diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am
index a33bfa5..664077f 100644
--- a/src/tests/Makefile.am
+++ b/src/tests/Makefile.am
@@ -1,5 +1,6 @@
 AM_TESTS_ENVIRONMENT = \
-       ELM_DATA_DIR=${top_builddir}/data
+       ELM_DATA_DIR=${top_builddir}/data \
+       ELM_RUN_IN_TREE=1
 
 AUTOMAKE_OPTIONS     = 1.4 foreign
 MAINTAINERCLEANFILES = Makefile.in
diff --git a/src/tests/elm_suite.c b/src/tests/elm_suite.c
index dde1962..bb9625f 100644
--- a/src/tests/elm_suite.c
+++ b/src/tests/elm_suite.c
@@ -108,6 +108,8 @@ main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
    Suite *s;
    SRunner *sr;
 
+   putenv("ELM_RUN_IN_TREE=1");
+
    s = elm_suite();
    sr = srunner_create(s);
 

-- 


Reply via email to