From 85044d78d11427315d25bba66849f65aa111d83e Mon Sep 17 00:00:00 2001 From: Bruno Lopes Date: Sat, 21 Mar 2026 14:50:12 -0300 Subject: [PATCH] app, build/macos: Move PYTHONHOME logic from .patch to core code This was tested with both in-house MacPorts, in-house HomeBrew and legacy CircleCI builds and I confirmed it works (it is needed only by the in-house MacPorts builds). --- app/main.c | 25 ++--------- ...ts-meson-plug-ins-Patch-macOS-bundle.patch | 44 ++----------------- 2 files changed, 7 insertions(+), 62 deletions(-) diff --git a/app/main.c b/app/main.c index e287d0e982..c8c91fb065 100644 --- a/app/main.c +++ b/app/main.c @@ -350,7 +350,6 @@ gimp_macos_setenv (const char * progname) gchar *etc_dir; size_t path_len; struct stat sb; - gboolean need_pythonhome = TRUE; bin_dir = g_path_get_dirname (resolved_path); tmp = g_strdup_printf ("%s/lib", gimp_installation_directory()); @@ -390,23 +389,6 @@ gimp_macos_setenv (const char * progname) } } - /* Detect we were built in homebrew for MacOS (for PYTHONHOME purposes) */ - tmp = g_strdup_printf ("%s/Frameworks/Python.framework", gimp_installation_directory()); - if (tmp && !stat (tmp, &sb) && S_ISDIR (sb.st_mode)) - { - g_print ("GIMP was built with homebrew\n"); - need_pythonhome = FALSE; - } - g_free (tmp); - /* Detect we were built in MacPorts for MacOS (for PYTHONHOME purposes) */ - tmp = g_strdup_printf ("%s/Library/Frameworks/Python.framework", gimp_installation_directory()); - if (tmp && !stat (tmp, &sb) && S_ISDIR (sb.st_mode)) - { - g_print ("GIMP was built with MacPorts\n"); - need_pythonhome = FALSE; - } - g_free (tmp); - /* Minimum runtime paths */ path_len = strlen (g_getenv ("PATH") ? g_getenv ("PATH") : "") + strlen (bin_dir) + 2; path = g_try_malloc (path_len); @@ -469,12 +451,13 @@ gimp_macos_setenv (const char * progname) tmp = g_strdup_printf ("%s/girepository-1.0", lib_dir); g_setenv ("GI_TYPELIB_PATH", tmp, TRUE); g_free (tmp); - if (need_pythonhome) + tmp = g_strdup_printf ("%s/Frameworks/Python.framework/Versions/%s", gimp_installation_directory(), PYTHON_VERSION); + if (tmp && !stat (tmp, &sb) && S_ISDIR (sb.st_mode)) { - tmp = g_strdup_printf ("%s/Library/Frameworks/Python.framework/Versions/%s", share_dir, PYTHON_VERSION); g_setenv ("PYTHONHOME", tmp, TRUE); - g_free (tmp); } + g_free (tmp); + g_free (lib_dir); g_free (share_dir); g_free (etc_dir); diff --git a/build/macos/patches/0001-app-libgimpwidgets-meson-plug-ins-Patch-macOS-bundle.patch b/build/macos/patches/0001-app-libgimpwidgets-meson-plug-ins-Patch-macOS-bundle.patch index d2fd2a4ad3..72e13cc4c8 100644 --- a/build/macos/patches/0001-app-libgimpwidgets-meson-plug-ins-Patch-macOS-bundle.patch +++ b/build/macos/patches/0001-app-libgimpwidgets-meson-plug-ins-Patch-macOS-bundle.patch @@ -1,50 +1,12 @@ -From f7ab93e52d6b736bc9eda287a8c4dfbb3f4b3453 Mon Sep 17 00:00:00 2001 +From f4a107250cc0d7d29fb1f55c8652dff219e663dc Mon Sep 17 00:00:00 2001 From: Bruno Lopes -Date: Thu, 19 Mar 2026 15:04:59 -0300 +Date: Sat, 21 Mar 2026 14:51:17 -0300 Subject: [PATCH] app, libgimpwidgets, meson, plug-ins: Patch macOS bundle --- - app/main.c | 19 +------------------ libgimpbase/gimpenv.c | 12 +++++++----- - 2 files changed, 8 insertions(+), 23 deletions(-) + 1 file changed, 7 insertions(+), 5 deletions(-) -diff --git a/app/main.c b/app/main.c -index 0a2419e94b..c14e8cb541 100644 ---- a/app/main.c -+++ b/app/main.c -@@ -390,23 +390,6 @@ gimp_macos_setenv (const char * progname) - } - } - -- /* Detect we were built in homebrew for MacOS (for PYTHONHOME purposes) */ -- tmp = g_strdup_printf ("%s/Frameworks/Python.framework", gimp_installation_directory()); -- if (tmp && !stat (tmp, &sb) && S_ISDIR (sb.st_mode)) -- { -- g_print ("GIMP was built with homebrew\n"); -- need_pythonhome = FALSE; -- } -- g_free (tmp); -- /* Detect we were built in MacPorts for MacOS (for PYTHONHOME purposes) */ -- tmp = g_strdup_printf ("%s/Library/Frameworks/Python.framework", gimp_installation_directory()); -- if (tmp && !stat (tmp, &sb) && S_ISDIR (sb.st_mode)) -- { -- g_print ("GIMP was built with MacPorts\n"); -- need_pythonhome = FALSE; -- } -- g_free (tmp); -- - /* Minimum runtime paths */ - path_len = strlen (g_getenv ("PATH") ? g_getenv ("PATH") : "") + strlen (bin_dir) + 2; - path = g_try_malloc (path_len); -@@ -471,7 +454,7 @@ gimp_macos_setenv (const char * progname) - g_free (tmp); - if (need_pythonhome) - { -- tmp = g_strdup_printf ("%s/Library/Frameworks/Python.framework/Versions/%s", share_dir, PYTHON_VERSION); -+ tmp = g_strdup_printf ("%s/Python.framework/Versions/%s", lib_dir, PYTHON_VERSION); - g_setenv ("PYTHONHOME", tmp, TRUE); - g_free (tmp); - } diff --git a/libgimpbase/gimpenv.c b/libgimpbase/gimpenv.c index 8961ad68ba..ba10796164 100644 --- a/libgimpbase/gimpenv.c