summaryrefslogtreecommitdiff
path: root/src/lib/evas/file
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2013-01-04 17:19:43 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2013-01-04 17:19:43 +0000
commit733425c62c7b9a23ad465b5b9700612fae3ee356 (patch)
treefdc2f4e310d964cb96fa56a73d66fdba246d06b8 /src/lib/evas/file
parent365a4acf97c59470c317a3e80d7586efe9344bb5 (diff)
efl: make libraries aware of EFL_RUN_IN_TREE.
this variable tells that the build is being done in tree and we should not look at install locations. SVN revision: 82217
Diffstat (limited to 'src/lib/evas/file')
-rw-r--r--src/lib/evas/file/evas_module.c86
1 files changed, 58 insertions, 28 deletions
diff --git a/src/lib/evas/file/evas_module.c b/src/lib/evas/file/evas_module.c
index cae88d8818..0378423a6a 100644
--- a/src/lib/evas/file/evas_module.c
+++ b/src/lib/evas/file/evas_module.c
@@ -44,6 +44,17 @@ evas_module_paths_init(void)
44{ 44{
45 char *libdir, *path; 45 char *libdir, *path;
46 46
47 if (getenv("EFL_RUN_IN_TREE"))
48 {
49 struct stat st;
50 const char mp[] = PACKAGE_BUILD_DIR"/src/modules/evas";
51 if (stat(mp, &st) == 0)
52 {
53 evas_module_paths = _evas_module_append(evas_module_paths, strdup(mp));
54 return;
55 }
56 }
57
47 /* 1. ~/.evas/modules/ */ 58 /* 1. ~/.evas/modules/ */
48 path = eina_module_environment_path_get("HOME", "/.evas/modules"); 59 path = eina_module_environment_path_get("HOME", "/.evas/modules");
49 evas_module_paths = _evas_module_append(evas_module_paths, path); 60 evas_module_paths = _evas_module_append(evas_module_paths, path);
@@ -271,7 +282,10 @@ evas_module_engine_list(void)
271 Eina_Iterator *it, *it2; 282 Eina_Iterator *it, *it2;
272 unsigned int i; 283 unsigned int i;
273 const char *s, *s2; 284 const char *s, *s2;
274 char buf[4096]; 285 char buf[PATH_MAX];
286 Eina_Bool run_in_tree;
287
288 run_in_tree = !!getenv("EFL_RUN_IN_TREE");
275 289
276 EINA_LIST_FOREACH(evas_module_paths, l, s) 290 EINA_LIST_FOREACH(evas_module_paths, l, s)
277 { 291 {
@@ -284,8 +298,20 @@ evas_module_engine_list(void)
284 EINA_ITERATOR_FOREACH(it, fi) 298 EINA_ITERATOR_FOREACH(it, fi)
285 { 299 {
286 const char *fname = fi->path + fi->name_start; 300 const char *fname = fi->path + fi->name_start;
287 snprintf(buf, sizeof(buf), "%s/engines/%s/%s", 301
288 s, fname, MODULE_ARCH); 302 buf[0] = '\0';
303 if (run_in_tree)
304 {
305 snprintf(buf, sizeof(buf), "%s/engines/%s/.libs",
306 s, fname);
307 if (!evas_file_path_exists(buf))
308 buf[0] = '\0';
309 }
310
311 if (buf[0] == '\0')
312 snprintf(buf, sizeof(buf), "%s/engines/%s/%s",
313 s, fname, MODULE_ARCH);
314
289 it2 = eina_file_ls(buf); 315 it2 = eina_file_ls(buf);
290 if (it2) 316 if (it2)
291 { 317 {
@@ -335,50 +361,54 @@ evas_module_unregister(const Evas_Module_Api *module, Evas_Module_Type type)
335 return EINA_TRUE; 361 return EINA_TRUE;
336} 362}
337 363
338#if defined(__CEGCC__) || defined(__MINGW32CE__) 364#if defined(_WIN32) || defined(__CYGWIN__)
339# define EVAS_MODULE_NAME_IMAGE_SAVER "saver_%s.dll" 365# define EVAS_MODULE_NAME "module.dll"
340# define EVAS_MODULE_NAME_IMAGE_LOADER "loader_%s.dll"
341# define EVAS_MODULE_NAME_ENGINE "engine_%s.dll"
342# define EVAS_MODULE_NAME_OBJECT "object_%s.dll"
343#elif defined(_WIN32) || defined(__CYGWIN__)
344# define EVAS_MODULE_NAME_IMAGE_SAVER "module.dll"
345# define EVAS_MODULE_NAME_IMAGE_LOADER "module.dll"
346# define EVAS_MODULE_NAME_ENGINE "module.dll"
347# define EVAS_MODULE_NAME_OBJECT "module.dll"
348#else 366#else
349# define EVAS_MODULE_NAME_IMAGE_SAVER "module.so" 367# define EVAS_MODULE_NAME "module.so"
350# define EVAS_MODULE_NAME_IMAGE_LOADER "module.so"
351# define EVAS_MODULE_NAME_ENGINE "module.so"
352# define EVAS_MODULE_NAME_OBJECT "module.so"
353#endif 368#endif
354 369
355Evas_Module * 370Evas_Module *
356evas_module_find_type(Evas_Module_Type type, const char *name) 371evas_module_find_type(Evas_Module_Type type, const char *name)
357{ 372{
358 const char *path; 373 const char *path;
359 const char *format = NULL; 374 char buffer[PATH_MAX];
360 char buffer[4096];
361 Evas_Module *em; 375 Evas_Module *em;
362 Eina_Module *en; 376 Eina_Module *en;
363 Eina_List *l; 377 Eina_List *l;
378 Eina_Bool run_in_tree;
364 379
365 if ((unsigned int)type > 3) return NULL; 380 if ((unsigned int)type > 3) return NULL;
366 381
367 em = eina_hash_find(evas_modules[type], name); 382 em = eina_hash_find(evas_modules[type], name);
368 if (em) return em; 383 if (em) return em;
369 384
385 run_in_tree = !!getenv("EFL_RUN_IN_TREE");
386
370 EINA_LIST_FOREACH(evas_module_paths, l, path) 387 EINA_LIST_FOREACH(evas_module_paths, l, path)
371 { 388 {
372 switch (type) 389 const char *type_str = "unknown";
373 { 390 switch (type)
374 case EVAS_MODULE_TYPE_ENGINE: format = "%s/engines/%s/%s/" EVAS_MODULE_NAME_ENGINE; break; 391 {
375 case EVAS_MODULE_TYPE_IMAGE_LOADER: format = "%s/loaders/%s/%s/" EVAS_MODULE_NAME_IMAGE_LOADER; break; 392 case EVAS_MODULE_TYPE_ENGINE: type_str = "engines"; break;
376 case EVAS_MODULE_TYPE_IMAGE_SAVER: format = "%s/savers/%s/%s/" EVAS_MODULE_NAME_IMAGE_SAVER; break; 393 case EVAS_MODULE_TYPE_IMAGE_LOADER: type_str = "loaders"; break;
377 case EVAS_MODULE_TYPE_OBJECT: format = "%s/object/%s/%s/" EVAS_MODULE_NAME_OBJECT; break; 394 case EVAS_MODULE_TYPE_IMAGE_SAVER: type_str = "savers"; break;
378 } 395 case EVAS_MODULE_TYPE_OBJECT: type_str = "object"; break;
396 }
397
398 buffer[0] = '\0';
399 if (run_in_tree)
400 {
401 snprintf(buffer, sizeof(buffer), "%s/%s/%s/.libs/%s",
402 path, type_str, name, EVAS_MODULE_NAME);
403 if (!evas_file_path_exists(buffer))
404 buffer[0] = '\0';
405 }
406
407 if (buffer[0] == '\0')
408 snprintf(buffer, sizeof(buffer), "%s/%s/%s/%s/%s",
409 path, type_str, name, MODULE_ARCH, EVAS_MODULE_NAME);
379 410
380 snprintf(buffer, sizeof (buffer), format, path, name, MODULE_ARCH, name); 411 if (!evas_file_path_is_file(buffer)) continue;
381 if (!evas_file_path_is_file(buffer)) continue;
382 412
383 en = eina_module_new(buffer); 413 en = eina_module_new(buffer);
384 if (!en) continue; 414 if (!en) continue;