From be0e6b84e95abaf388ebf03e209e6a0cd089bbae Mon Sep 17 00:00:00 2001 From: Jehan Date: Tue, 26 Mar 2024 19:06:20 +0100 Subject: [PATCH] libgimpbase: do not "fix" paths in build environment. When running GIMP in the build environment (even before it's installed), we don't want to "fix" paths. We had the case in particular on the macOS CI where the install PREFIX was a parent directory of the build directory and therefore we were "fixing" some perfectly good constructed directories (set by meson) into non-existing folder paths. Additionally this codepath should only run when ENABLE_RELOCATABLE_RESOURCES is set (even though this alone would not have fixed our CI issue because the macOS build is relocatable). Finally I am updating the gimp-data repository so that libraries are properly found from the (now correct thanks to this commit) paths set by meson when running gimp-console from within the build directory. --- gimp-data | 2 +- libgimpbase/gimpenv.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gimp-data b/gimp-data index 86bbe54495..363c98590c 160000 --- a/gimp-data +++ b/gimp-data @@ -1 +1 @@ -Subproject commit 86bbe5449596517c2b0efedfc06899983ae890b7 +Subproject commit 363c98590c55dcfc225aa70a5b8f9b98677bb962 diff --git a/libgimpbase/gimpenv.c b/libgimpbase/gimpenv.c index a854fdd510..7ada34ec4e 100644 --- a/libgimpbase/gimpenv.c +++ b/libgimpbase/gimpenv.c @@ -924,9 +924,8 @@ gimp_plug_in_directory_file (const gchar *first_element, * and *@path is replaced with a pointer to a new string with the * run-time prefix spliced in. * - * On Linux, it does the same thing, but only if BinReloc support is enabled. - * On other Unices, it does nothing because those platforms don't have a - * way to find out where our binary is. + * On Linux and other Unices, it does the same thing, but only if BinReloc + * support is enabled, and only if we are not running GIMP in-build directory. */ static void gimp_path_runtime_fix (gchar **path) @@ -963,10 +962,15 @@ gimp_path_runtime_fix (gchar **path) *path = g_build_filename (gimp_installation_directory (), *path, NULL); g_free (p); } -#else +#elif defined (ENABLE_RELOCATABLE_RESOURCES) gchar *p; - if (strncmp (*path, PREFIX G_DIR_SEPARATOR_S, + /* XXX: I could actually test any of the other GIMP_TESTING_* environment + * variables. The goal is only to check if we are running GIMP from within the + * build directory. In such case, no substitution should happen. + */ + if (! g_getenv ("GIMP_TESTING_PLUGINDIRS") && + strncmp (*path, PREFIX G_DIR_SEPARATOR_S, strlen (PREFIX G_DIR_SEPARATOR_S)) == 0) { /* This is a compile-time entry. Replace the path with the