Files
strawberry/Formula/macdeploycheck.rb
David Helkowski 32eee8f868
Some checks failed
Build / Build openSUSE (leap:15.6) (push) Has been cancelled
Build / Build openSUSE (leap:16.0) (push) Has been cancelled
Build / Build openSUSE (tumbleweed) (push) Has been cancelled
Build / Build Fedora (42) (push) Has been cancelled
Build / Build Fedora (43) (push) Has been cancelled
Build / Build Fedora (44) (push) Has been cancelled
Build / Build OpenMandriva (cooker) (push) Has been cancelled
Build / Build Mageia (9) (push) Has been cancelled
Build / Build Debian (bookworm) (push) Has been cancelled
Build / Build Debian (forky) (push) Has been cancelled
Build / Build Debian (trixie) (push) Has been cancelled
Build / Build Ubuntu (noble) (push) Has been cancelled
Build / Build Ubuntu (questing) (push) Has been cancelled
Build / Build Ubuntu (resolute) (push) Has been cancelled
Build / Upload Ubuntu PPA (noble) (push) Has been cancelled
Build / Upload Ubuntu PPA (questing) (push) Has been cancelled
Build / Upload Ubuntu PPA (resolute) (push) Has been cancelled
Build / Build FreeBSD (push) Has been cancelled
Build / Build OpenBSD (push) Has been cancelled
Build / Build macOS Public (release, macos-15) (push) Has been cancelled
Build / Build macOS Public (release, macos-15-intel) (push) Has been cancelled
Build / Build macOS Private (release, macos-arm64) (push) Has been cancelled
Build / Build Windows MinGW (i686, debug) (push) Has been cancelled
Build / Build Windows MinGW (i686, release) (push) Has been cancelled
Build / Build Windows MinGW (x86_64, debug) (push) Has been cancelled
Build / Build Windows MinGW (x86_64, release) (push) Has been cancelled
Build / Build Windows MSVC (arm64, debug, arm64 debug, windows-11-arm) (push) Has been cancelled
Build / Build Windows MSVC (arm64, release, arm64 release, windows-11-arm) (push) Has been cancelled
Build / Build Windows MSVC (x86, debug, x86 debug, windows-2022) (push) Has been cancelled
Build / Build Windows MSVC (x86, release, x86 release, windows-2022) (push) Has been cancelled
Build / Build Windows MSVC (x86_64, debug, x86_64 debug, windows-2022) (push) Has been cancelled
Build / Build Windows MSVC (x86_64, release, x86_64 release, windows-2022) (push) Has been cancelled
Build / Upload (push) Has been cancelled
Build / Attach to release (push) Has been cancelled
Enhance macOS deployment with Sparkle integration and update build scripts
This commit refines the CMake configuration for macOS by finding the Sparkle framework early in the build process, allowing it to be bundled with the application. The Dmg.cmake script is updated to handle Sparkle's framework paths and ensure proper deployment. Additionally, the build_sign_notarize.sh script is improved to sign Sparkle's helper executables correctly and includes enhanced notarization feedback. The Brewfile and install_brew_deps.sh are also updated to include the new macdeploycheck dependency for better deployment checks.
2026-01-22 17:04:57 +09:00

94 lines
2.8 KiB
Ruby

class Macdeploycheck < Formula
desc "Sanity checks a macOS .app bundle for accidental Homebrew runtime dependencies"
homepage "https://github.com/strawberrymusicplayer/strawberry"
url "file://#{__FILE__}"
version "0.1.0"
sha256 :no_check
license "MIT"
depends_on :macos
def install
(bin/"macdeploycheck").write <<~'EOS'
#!/usr/bin/env bash
set -euo pipefail
app="${1:-}"
if [[ -z "$app" ]]; then
echo "Usage: macdeploycheck <path/to/App.app>" >&2
exit 2
fi
if [[ ! -d "$app" ]]; then
echo "Error: app bundle not found: $app" >&2
exit 2
fi
if [[ ! -d "$app/Contents" ]]; then
echo "Error: not a macOS app bundle (missing Contents/): $app" >&2
exit 2
fi
fail=0
tmp="$(mktemp -t macdeploycheck.XXXXXX)"
trap 'rm -f "$tmp"' EXIT
# Collect Mach-O files (executables + dylibs) inside the bundle.
while IFS= read -r -d '' f; do
if file "$f" | grep -q "Mach-O"; then
echo "$f" >>"$tmp"
fi
done < <(find "$app/Contents" -type f \( -perm -111 -o -name "*.dylib" -o -name "*.so" \) -print0 2>/dev/null)
if [[ ! -s "$tmp" ]]; then
echo "Warning: no Mach-O files found under $app/Contents" >&2
exit 0
fi
echo "macdeploycheck: scanning for external (Homebrew) runtime deps..."
while IFS= read -r f; do
# otool -L prints:
# <file>:
# <dep> (compatibility version ..., current version ...)
deps="$(otool -L "$f" 2>/dev/null | tail -n +2 | awk '{print $1}' || true)"
while IFS= read -r dep; do
[[ -z "$dep" ]] && continue
# Ignore system and rpath/loader/executable paths.
case "$dep" in
/System/*|/usr/lib/*|@rpath/*|@loader_path/*|@executable_path/*) continue ;;
esac
# These are the common accidental runtime deps that will break distribution.
if [[ "$dep" == /opt/homebrew/* || "$dep" == /usr/local/* || "$dep" == /opt/local/* ]]; then
echo "ERROR: $f links to external path: $dep" >&2
fail=1
fi
done <<<"$deps"
done <"$tmp"
if [[ "$fail" -ne 0 ]]; then
cat >&2 <<'EOM'
One or more binaries in your .app link to a Homebrew (or MacPorts) path.
That usually means the bundle is not self-contained and will fail on other machines,
or will fail notarization/codesigning validation.
Fix: re-run your deploy step (e.g. macdeployqt) so frameworks/dylibs are bundled and
their install names are rewritten to @rpath/@loader_path.
EOM
exit 1
fi
echo "OK: no external Homebrew/MacPorts runtime deps detected."
exit 0
EOS
chmod 0755, bin/"macdeploycheck"
end
test do
# Basic smoke test: tool runs and prints usage.
system bin/"macdeploycheck"
end
end