fix eina_prefix_new to return correct paths. Checks if locale dir is given else ignore locale paths. If common prefix_path found, add the correct postfix instead of hard-coded ones. This solves the problem of emotion_generic being unable to find em_generic_vlc even in the case of common prefixes and in installed locations - the most common case, when paths such as multiarch installs install to.
Arvind R. --- The code is still wrong in extracting prefix from dynamically loaded library path and searching back to the first delimiter and using the left-side, which is libdir, as prefix. On top of that, the arbitrary bin | lib | data is appended for the other paths. IMHO, the whole prefix stuff is nonsense as one is expected to relocate the whole tree only; i.e. relocate to a new prefix. Adding the new libdir to ld.so.conf would then be sufficient as relative paths for modules remain unchanged. --- a/src/lib/eina/eina_prefix.c 2013-01-03 20:40:34.000000000 +0530 +++ b/src/lib/eina/eina_prefix.c 2013-01-13 08:53:56.000000000 +0530 @@ -89,6 +89,7 @@ struct _Eina_Prefix unsigned char fallback : 1; unsigned char no_common_prefix : 1; unsigned char env_used : 1; + unsigned char ignore_locale : 1; }; #define STRDUP_REP(x, y) do { if (x) free(x); x = strdup(y); } while (0) @@ -382,6 +383,8 @@ eina_prefix_new(const char *argv0, void pfx = calloc(1, sizeof(Eina_Prefix)); if (!pfx) return NULL; + if (!strlen(pkg_locale)) + pfx->ignore_locale = 1; /* if provided with a share dir use datadir/sharedir as the share dir */ if (sharedir) { @@ -469,9 +472,10 @@ eina_prefix_new(const char *argv0, void } } /* 2. if all the common string offsets match we compiled with a common prefix */ + /* packaging scripts may not set localedir if package uses no locale info (e.g. debian) */ if (((pkg_bin_p - pkg_bin) == (pkg_lib_p - pkg_lib)) && ((pkg_bin_p - pkg_bin) == (pkg_data_p - pkg_data)) - && ((pkg_bin_p - pkg_bin) == (pkg_locale_p - pkg_locale)) + && (pfx->ignore_locale || ((pkg_bin_p - pkg_bin) == (pkg_locale_p - pkg_locale))) ) { bindir = pkg_bin_p; @@ -482,6 +486,40 @@ eina_prefix_new(const char *argv0, void DBG("Prefix relative libdir = %s", libdir); DBG("Prefix relative datadir = %s", datadir); DBG("Prefix relative localedir = %s", localedir); + if (pfx->prefix_path) free (pfx->prefix_path); + pfx->prefix_path = malloc (pkg_bin_p - pkg_bin + 1); + if (!pfx->prefix_path) + { + WRN("No Prefix path (alloc fail)"); + _fallback(pfx, pkg_bin, pkg_lib, pkg_data, pkg_locale, envprefix); + return pfx; + } + for (p = pfx->prefix_path, p1 = pkg_bin; p1 < pkg_bin_p; p++, p1++) + *p = *p1; + + /* bin */ + snprintf(buf, sizeof(buf), "%s%s", pfx->prefix_path, bindir); + STRDUP_REP(pfx->prefix_path_bin, buf); + DBG("Have bin = %s", pfx->prefix_path_bin); + + /* data */ + snprintf(buf, sizeof(buf), "%s%s", pfx->prefix_path, datadir); + STRDUP_REP(pfx->prefix_path_data, buf); + DBG("Have data = %s", pfx->prefix_path_data); + + /* lib */ + snprintf(buf, sizeof(buf), "%s%s", pfx->prefix_path, libdir); + STRDUP_REP(pfx->prefix_path_lib, buf); + DBG("Have lib = %s", pfx->prefix_path_lib); + + /* locale */ + if (!pfx->ignore_locale) + { + snprintf(buf, sizeof(buf), "%s%s", pfx->prefix_path, localedir); + STRDUP_REP(pfx->prefix_path_locale, buf); + DBG("Have locale = %s", pfx->prefix_path_locale); + } + return pfx; } /* 3. some galoot thought it awesome not to give us a common prefix at compile time * so fall back to the compile time directories. we are no longer relocatable */ @@ -703,7 +741,7 @@ eina_prefix_data_get(Eina_Prefix *pfx) EAPI const char * eina_prefix_locale_get(Eina_Prefix *pfx) { - if (!pfx) return ""; + if (!pfx || pfx->ignore_locale) return ""; return pfx->prefix_path_locale; } ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnmore_123012 _______________________________________________ enlightenment-users mailing list enlightenment-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-users