mirror of https://github.com/GNOME/gimp.git
libgimpbase: support multiarch folders for binary relocability on Linux.
This is not seen on all distributions (mostly on Debian-based ones in my experience), but some distributions install libraries in a second-level directory under prefix (e.g. lib/x86_64-linux-gnu/ instead of lib/ or lib64/) whereas our prefix-guessing code for relocatable builds harcoded moving up from 1 level. This new heuristic will assume that if the leaf directory is neither bin/ nor starting with `lib`, then it's likely a multiarch folder and we must move up once more to find the prefix folder. This should also fix the problem encountered by Bruno for the current work on a potential official AppImage.
This commit is contained in:
parent
1387d4d081
commit
1c2472a092
|
@ -452,6 +452,7 @@ gchar *
|
|||
_gimp_reloc_find_prefix (const gchar *default_prefix)
|
||||
{
|
||||
gchar *dir1, *dir2;
|
||||
gchar *exe_dir;
|
||||
|
||||
if (exe == NULL)
|
||||
{
|
||||
|
@ -464,6 +465,24 @@ _gimp_reloc_find_prefix (const gchar *default_prefix)
|
|||
|
||||
dir1 = g_path_get_dirname (exe);
|
||||
dir2 = g_path_get_dirname (dir1);
|
||||
|
||||
exe_dir = g_path_get_basename (dir1);
|
||||
if (g_strcmp0 (exe_dir, "bin") != 0 && ! g_str_has_prefix (exe_dir, "lib"))
|
||||
{
|
||||
g_free (exe_dir);
|
||||
exe_dir = g_path_get_basename (dir2);
|
||||
if (g_str_has_prefix (exe_dir, "lib"))
|
||||
{
|
||||
/* Supporting multiarch folders, such as lib/x86_64-linux-gnu/ */
|
||||
gchar *dir3 = g_path_get_dirname (dir2);
|
||||
|
||||
g_free (dir2);
|
||||
dir2 = dir3;
|
||||
}
|
||||
}
|
||||
|
||||
g_free (dir1);
|
||||
g_free (exe_dir);
|
||||
|
||||
return dir2;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue