/* 4. PREFIX/evas/modules/ */ void evas_module_paths_init(void) { char *path; /* 1. ~/.evas/modules/ */ path = eina_module_environment_path_get("HOME", "/.evas/modules"); evas_module_paths = _evas_module_append(evas_module_paths, path); /* 2. $(EVAS_MODULE_DIR)/evas/modules/ */ path = eina_module_environment_path_get("EVAS_MODULES_DIR", "/evas/modules"); if (eina_list_search_unsorted(evas_module_paths, (Eina_Compare_Cb) strcmp, path)) free(path); else evas_module_paths = _evas_module_append(evas_module_paths, path); /* 3. libevas.so/../evas/modules/ */ path = eina_module_symbol_path_get(evas_module_paths_init, "/evas/modules"); if (eina_list_search_unsorted(evas_module_paths, (Eina_Compare_Cb) strcmp, path)) free(path); else evas_module_paths = _evas_module_append(evas_module_paths, path); /* 4. PREFIX/evas/modules/ */ #ifndef _MSC_VER path = PACKAGE_LIB_DIR "/evas/modules"; if (!eina_list_search_unsorted(evas_module_paths, (Eina_Compare_Cb) strcmp, path)) { path = strdup(path); if (path) evas_module_paths = _evas_module_append(evas_module_paths, path); } #endif }
/* 4. PREFIX/evas/modules/ */ void evas_module_paths_init(void) { char *libdir, *path; /* 1. ~/.evas/modules/ */ path = eina_module_environment_path_get("HOME", "/.evas/modules"); evas_module_paths = _evas_module_append(evas_module_paths, path); /* 2. $(EVAS_MODULE_DIR)/evas/modules/ */ path = eina_module_environment_path_get("EVAS_MODULES_DIR", "/evas/modules"); if (eina_list_search_unsorted(evas_module_paths, (Eina_Compare_Cb) strcmp, path)) free(path); else evas_module_paths = _evas_module_append(evas_module_paths, path); /* 3. libevas.so/../evas/modules/ */ libdir = (char *)_evas_module_libdir_get(); if (!libdir) path = eina_module_symbol_path_get(evas_module_paths_init, "/evas/modules"); else { path = malloc(strlen(libdir) + strlen("/evas/modules") + 1); if (path) { strcpy(path, libdir); strcat(path, "/evas/modules"); } } if (eina_list_search_unsorted(evas_module_paths, (Eina_Compare_Cb) strcmp, path)) free(path); else evas_module_paths = _evas_module_append(evas_module_paths, path); /* 4. PREFIX/lib/evas/modules/ */ #ifndef _MSC_VER path = PACKAGE_LIB_DIR "/evas/modules"; if (!eina_list_search_unsorted(evas_module_paths, (Eina_Compare_Cb) strcmp, path)) { path = strdup(path); if (path) evas_module_paths = _evas_module_append(evas_module_paths, path); } #endif }
static Eina_Bool _etui_modules_load(void) { char buf[PATH_MAX]; char *path; Eina_Prefix *prefix; if (_etui_modules_loaded) return EINA_TRUE; _etui_modules_loaded = EINA_TRUE; path = eina_module_environment_path_get("HOME", "/.etui/modules"); if (path) { _etui_modules = eina_module_arch_list_get(_etui_modules, path, MODULE_ARCH); free(path); } path = eina_module_environment_path_get("ETUI_MODULES_DIR", "/etui/modules"); if (path) { _etui_modules = eina_module_arch_list_get(_etui_modules, path, MODULE_ARCH); free(path); } prefix = eina_prefix_new(NULL, etui_init, "ETUI", "etui", "checkme", PACKAGE_BIN_DIR, PACKAGE_LIB_DIR, PACKAGE_DATA_DIR, PACKAGE_DATA_DIR); if (prefix) { snprintf(buf, sizeof(buf), "%s/etui/modules", eina_prefix_lib_get(prefix)); _etui_modules = eina_module_arch_list_get(_etui_modules, buf, MODULE_ARCH); eina_prefix_free(prefix); } else { INF("Could not create prefix, use library path directly."); _etui_modules = eina_module_arch_list_get(_etui_modules, PACKAGE_LIB_DIR"/etui/modules", MODULE_ARCH); } path = eina_module_symbol_path_get(etui_object_add, "/etui/modules"); if (path) { _etui_modules = eina_module_list_get(_etui_modules, path, 0, NULL, NULL); free(path); } if (!_etui_modules) { ERR("Could not find modules."); return EINA_FALSE; } eina_module_list_load(_etui_modules); /* TODO: registry */ return EINA_TRUE; }
Eina_Bool eina_mempool_init(void) { char *path; _eina_mempool_log_dom = eina_log_domain_register("eina_mempool", EINA_LOG_COLOR_DEFAULT); if (_eina_mempool_log_dom < 0) { EINA_LOG_ERR("Could not register log domain: eina_mempool"); return 0; } EINA_ERROR_NOT_MEMPOOL_MODULE = eina_error_msg_static_register( EINA_ERROR_NOT_MEMPOOL_MODULE_STR); _backends = eina_hash_string_superfast_new(NULL); /* dynamic backends */ _modules = eina_module_arch_list_get(NULL, PACKAGE_LIB_DIR "/eina/modules/mp", MODULE_ARCH); path = eina_module_environment_path_get("HOME", "/.eina/mp/modules/mp"); _modules = eina_module_arch_list_get(_modules, path, MODULE_ARCH); if (path) free(path); path = eina_module_environment_path_get("EINA_MODULES_MEMPOOL_DIR", "/eina/modules/mp"); _modules = eina_module_arch_list_get(_modules, path, MODULE_ARCH); if (path) free(path); path = eina_module_symbol_path_get((const void *)eina_init, "/eina/modules/mp"); _modules = eina_module_arch_list_get(_modules, path, MODULE_ARCH); if (path) free(path); if (!_modules) { ERR("no mempool modules able to be loaded."); eina_hash_free(_backends); goto mempool_init_error; } eina_module_list_load(_modules); /* builtin backends */ #ifdef EINA_STATIC_BUILD_BUDDY buddy_init(); #endif #ifdef EINA_STATIC_BUILD_CHAINED_POOL chained_init(); #endif #ifdef EINA_STATIC_BUILD_EMEMOA_FIXED ememoa_fixed_init(); #endif #ifdef EINA_STATIC_BUILD_EMEMOA_UNKNOWN ememoa_unknown_init(); #endif #ifdef EINA_STATIC_BUILD_FIXED_BITMAP fixed_bitmap_init(); #endif #ifdef EINA_STATIC_BUILD_ONE_BIG one_big_init(); #endif #ifdef EINA_STATIC_BUILD_PASS_THROUGH pass_through_init(); #endif return EINA_TRUE; mempool_init_error: eina_log_domain_unregister(_eina_mempool_log_dom); _eina_mempool_log_dom = -1; return EINA_FALSE; }