diff --git a/scripts/bundle-macos.sh b/scripts/bundle-macos.sh index 84d9daf..4c68164 100755 --- a/scripts/bundle-macos.sh +++ b/scripts/bundle-macos.sh @@ -44,10 +44,21 @@ cp -R "$ROOT/share/." "$RES/share/" # Bundle Homebrew / MacPorts GTK stack next to the binary. echo "==> Relocating dylibs with dylibbundler" +BREW_PREFIX="$(brew --prefix 2>/dev/null || true)" +DYLIB_SEARCH=() +if [[ -n "$BREW_PREFIX" ]]; then + DYLIB_SEARCH+=(-s "$BREW_PREFIX/lib") + # Common keg-only / versioned lib dirs dylibbundler otherwise prompts for. + for sub in librsvg glib gettext; do + [[ -d "$BREW_PREFIX/opt/$sub/lib" ]] && DYLIB_SEARCH+=(-s "$BREW_PREFIX/opt/$sub/lib") + done +fi + dylibbundler -od -b \ -x "$MACOS/maturita-bin" \ -d "$FW" \ - -p "@executable_path/../Frameworks" + -p "@executable_path/../Frameworks" \ + "${DYLIB_SEARCH[@]+"${DYLIB_SEARCH[@]}"}" /dev/null || true shopt -s nullglob for loader in "$LOADERS_DST"/*; do [[ -f "$loader" ]] || continue - dylibbundler -od -b -x "$loader" -d "$FW" -p "@executable_path/../Frameworks" || true + # stdin closed → if a dep is still missing, fail instead of hanging CI. + dylibbundler -od -b -x "$loader" -d "$FW" \ + -p "@executable_path/../Frameworks" \ + "${DYLIB_SEARCH[@]+"${DYLIB_SEARCH[@]}"}" &2 done shopt -u nullglob if command -v gdk-pixbuf-query-loaders >/dev/null 2>&1; then