From e45c86249d19783a553423fea577e045a368f32c Mon Sep 17 00:00:00 2001 From: deepend Date: Thu, 19 Feb 2026 13:54:50 -0700 Subject: [PATCH] Updated the macOS bundling script to detect whether staged GTK runtime modules are provided as .so or .dylib, using the current bundle prefix paths for GTK and GDK-Pixbuf. This avoids hard-coding .so assumptions in environments where Homebrew ships .dylib modules. Added conditional rewrite logic that updates zoitechat.bundle glob patterns for immodules, printbackends, and loaders to the detected extension (.dylib or .so) before running gtk-mac-bundler. --- osx/makebundle.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/osx/makebundle.sh b/osx/makebundle.sh index 9d05332e..239a31a7 100755 --- a/osx/makebundle.sh +++ b/osx/makebundle.sh @@ -82,6 +82,22 @@ if [ -n "$ENCHANT_PREFIX_PATH" ]; then fi fi +# GTK module extension differs across package manager builds: +# - Homebrew commonly installs .dylib modules +# - Some environments still ship .so modules +# Detect what exists in the staged prefix and rewrite the bundle definition +# so gtk-mac-bundler does not fail on a missing glob. +GTK_MODULE_EXT="so" +if find "$BUNDLE_PREFIX/lib/gtk-3.0" -type f \( -path '*/immodules/*.dylib' -o -path '*/printbackends/*.dylib' \) -print -quit 2>/dev/null | grep -q . \ + || find "$BUNDLE_PREFIX/lib/gdk-pixbuf-2.0" -type f -path '*/loaders/*.dylib' -print -quit 2>/dev/null | grep -q .; then + GTK_MODULE_EXT="dylib" +fi +if [ "$GTK_MODULE_EXT" = "dylib" ]; then + perl -0pi -e 's|(/immodules/)\*\.so|$1*.dylib|g; s|(/printbackends/)\*\.so|$1*.dylib|g; s|(/loaders/)\*\.so|$1*.dylib|g' "$BUNDLE_DEF" +else + perl -0pi -e 's|(/immodules/)\*\.dylib|$1*.so|g; s|(/printbackends/)\*\.dylib|$1*.so|g; s|(/loaders/)\*\.dylib|$1*.so|g' "$BUNDLE_DEF" +fi + # Keep Info.plist generation deterministic by always rendering from template # using a single, explicit version source.