From 815df2aeb0ee124d58da5f20c1ec3464dffaff02 Mon Sep 17 00:00:00 2001 From: deepend Date: Wed, 18 Feb 2026 10:50:24 -0700 Subject: [PATCH] Updated osx/makebundle.sh to use a robust bundler invocation flow: prefer gtk-mac-bundler, fall back to python3 -m gtk_mac_bundler, fail fast with clear install guidance if neither is available, and verify the .app was actually produced before zipping. Also added macOS prefix/library expectation comments. Updated osx/zoitechat.bundle to target GTK3 (gtk+-3.0), refreshed runtime module paths (immodules, printbackends, gdk-pixbuf, pango), removed GTK2-specific engine/theme entries, and added prefix comments. This also keeps the requested anchor locations (launcher-script, ${prefix}/lib/${gtkdir}). Updated osx/launcher.sh to remove obsolete GTK2 environment assumptions (including GTK2_RC_FILES and old GTK2 loader file paths), set GTK3-relevant variables (GTK_IM_MODULE_FILE, GDK_PIXBUF_MODULE_FILE, GSETTINGS_SCHEMA_DIR), and minimize DYLD path hacking by only prepending when already set. Added launcher-script comment anchor and prefix/library docs. --- osx/launcher.sh | 20 +++++++++++++++----- osx/makebundle.sh | 40 ++++++++++++++++++++++++++++++++++------ osx/zoitechat.bundle | 38 +++++++++++++++----------------------- 3 files changed, 64 insertions(+), 34 deletions(-) diff --git a/osx/launcher.sh b/osx/launcher.sh index 130888c9..d6887fae 100755 --- a/osx/launcher.sh +++ b/osx/launcher.sh @@ -23,18 +23,28 @@ bundle_data="$bundle_res"/share bundle_etc="$bundle_res"/etc export PREFIX="$bundle_res" -export DYLD_LIBRARY_PATH="$bundle_lib" + +# launcher-script: runtime environment for bundled GTK3 on macOS. +# Expected package prefixes when building the app bundle: +# Homebrew: /opt/homebrew (Apple Silicon) or /usr/local (Intel) +# MacPorts: /opt/local +# Required libraries include GTK3, Pango, GDK-Pixbuf and enchant. + +# Keep DYLD path hacks to a minimum; install_name_tool should resolve most libs. +if test -n "${DYLD_LIBRARY_PATH:-}"; then + export DYLD_LIBRARY_PATH="$bundle_lib:$DYLD_LIBRARY_PATH" +fi + export XDG_CONFIG_DIRS="$bundle_etc"/xdg export XDG_DATA_DIRS="$bundle_data" export GTK_DATA_PREFIX="$bundle_res" export GTK_EXE_PREFIX="$bundle_res" -export GTK_PATH="$bundle_res" -export GTK2_RC_FILES="$bundle_etc/gtk-2.0/gtkrc" -export GTK_IM_MODULE_FILE="$bundle_etc/gtk-2.0/gtk.immodules" -export GDK_PIXBUF_MODULE_FILE="$bundle_etc/gtk-2.0/gdk-pixbuf.loaders" +export GTK_IM_MODULE_FILE="$bundle_etc/gtk-3.0/gtk.immodules" +export GDK_PIXBUF_MODULE_FILE="$bundle_etc/gtk-3.0/gdk-pixbuf.loaders" export PANGO_LIBDIR="$bundle_lib" export PANGO_SYSCONFDIR="$bundle_etc" +export GSETTINGS_SCHEMA_DIR="$bundle_data/glib-2.0/schemas" export OPENSSL_CONF="/System/Library/OpenSSL/openssl.cnf" diff --git a/osx/makebundle.sh b/osx/makebundle.sh index dc750491..3e679f5a 100755 --- a/osx/makebundle.sh +++ b/osx/makebundle.sh @@ -1,11 +1,39 @@ #!/bin/sh -rm -rf ZoiteChat.app -rm -f *.app.zip +set -eu -python $HOME/.local/bin/gtk-mac-bundler zoitechat.bundle +BUNDLE_DEF="zoitechat.bundle" +APP_NAME="ZoiteChat.app" + +# Expected prefixes for macOS GTK dependencies: +# - Homebrew: /opt/homebrew (Apple Silicon) or /usr/local (Intel) +# - MacPorts: /opt/local +# Required runtime stack includes GTK3, Pango, GDK-Pixbuf and enchant. + +if command -v gtk-mac-bundler >/dev/null 2>&1; then + BUNDLER_CMD="gtk-mac-bundler" +elif command -v python3 >/dev/null 2>&1 && python3 -c 'import gtk_mac_bundler' >/dev/null 2>&1; then + BUNDLER_CMD="python3 -m gtk_mac_bundler" +else + cat >&2 <<'MSG' +error: gtk-mac-bundler not found. +Install one of the following before running osx/makebundle.sh: + - executable: gtk-mac-bundler + - python module: gtk_mac_bundler (invoked via: python3 -m gtk_mac_bundler) +MSG + exit 1 +fi + +rm -rf "$APP_NAME" +rm -f ./*.app.zip + +# shellcheck disable=SC2086 +$BUNDLER_CMD "$BUNDLE_DEF" + +if [ ! -d "$APP_NAME" ]; then + echo "error: bundler finished but $APP_NAME was not created" >&2 + exit 1 +fi echo "Compressing bundle" -#hdiutil create -format UDBZ -srcdir ZoiteChat.app -quiet ZoiteChat-2.9.6.1-$(git rev-parse --short master).dmg -zip -9rXq ./ZoiteChat-$(git describe --tags).app.zip ./ZoiteChat.app - +zip -9rXq "./ZoiteChat-$(git describe --tags).app.zip" "./$APP_NAME" diff --git a/osx/zoitechat.bundle b/osx/zoitechat.bundle index 81145fb8..720fcbf3 100644 --- a/osx/zoitechat.bundle +++ b/osx/zoitechat.bundle @@ -2,13 +2,16 @@ + /usr/local /usr/local/opt/enchant-applespell ${project} - ${project}/launcher.sh - gtk+-2.0 + ${project}/launcher.sh + gtk+-3.0 ${project}/Info.plist @@ -28,39 +31,28 @@ ${prefix:enchant}/lib/enchant/libenchant_applespell.so + - ${prefix}/lib/${gtkdir}/modules/*.so - - - ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/engines/libquartz.so - - - ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/engines/libxamarin.so + ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/immodules/*.so ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/printbackends/*.so - - ${prefix}/lib/gdk-pixbuf-2.0/${pkg:${gtk}:gtk_binary_version}/loaders/*.so - - - ${prefix}/lib/pango/${pkg:pango:pango_module_version}/modules/ - - - ${prefix}/share/themes/Mac/gtk-2.0-key/gtkrc - - + + ${prefix}/lib/gdk-pixbuf-2.0/${pkg:gdk-pixbuf-2.0:gdk_pixbuf_binary_version}/loaders/*.so + + + ${prefix}/lib/pango/${pkg:pango:pango_module_version}/modules/*.so + + + ${prefix}/share/locale ${prefix}/share/locale - - ${project}/gtkrc - - ${project}/zoitechat.icns