Files
strawberry/dist/macos/bundle_sparkle.sh
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

86 lines
3.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
bundledir="${1:-}"
sparkle_framework_dir="${2:-}"
sparkle_bin_link="${3:-}"
sparkle_bin_real="${4:-}"
if [[ -z "$bundledir" || -z "$sparkle_framework_dir" ]]; then
echo "Usage: $0 <bundledir> <sparkle_framework_dir> [sparkle_bin_link] [sparkle_bin_real]" >&2
exit 2
fi
if [[ ! -d "$sparkle_framework_dir" ]]; then
echo "Sparkle.framework dir not found: $sparkle_framework_dir" >&2
exit 1
fi
src_framework_dir="$sparkle_framework_dir"
# Homebrew often provides /opt/homebrew/Frameworks/Sparkle.framework where Versions/* are symlinks
# pointing back into the Cellar. Copying that verbatim breaks inside an app bundle.
# Resolve to the real Cellar framework root via Versions/Current.
if [[ -e "${sparkle_framework_dir}/Versions/Current" ]]; then
current_real="$(cd "${sparkle_framework_dir}/Versions/Current" && pwd -P)"
# current_real is .../Sparkle.framework/Versions/B (or similar)
src_framework_dir="$(cd "${current_real}/../.." && pwd -P)"
fi
dst_framework="${bundledir}/Contents/Frameworks/Sparkle.framework"
main_bin="${bundledir}/Contents/MacOS/strawberry"
qtsparkle_dylib="${bundledir}/Contents/Frameworks/libqtsparkle-qt6.dylib"
mkdir -p "${bundledir}/Contents/Frameworks"
echo "Bundling Sparkle.framework -> ${dst_framework}"
rm -rf "${dst_framework}"
# Use ditto to preserve the framework's internal symlinks/structure.
ditto "${src_framework_dir}" "${dst_framework}"
# Prefer the canonical framework binary path.
dst_bin="${dst_framework}/Versions/Current/Sparkle"
if [[ ! -e "${dst_bin}" ]]; then
echo "Error: Sparkle binary missing at ${dst_bin}" >&2
exit 1
fi
sparkle_rpath="@rpath/Sparkle.framework/Versions/Current/Sparkle"
# Sanity check: top-level Sparkle entry should be a symlink (not a copied Mach-O file).
if [[ -e "${dst_framework}/Sparkle" && ! -L "${dst_framework}/Sparkle" ]]; then
echo "Warning: ${dst_framework}/Sparkle is not a symlink (unexpected). This can confuse codesign." >&2
fi
echo "Fixing Sparkle.framework install name"
install_name_tool -id "${sparkle_rpath}" "${dst_bin}"
echo "Ensuring main binary has Frameworks rpath"
install_name_tool -add_rpath "@executable_path/../Frameworks" "${main_bin}" || true
echo "Rewriting Sparkle.framework references to @rpath"
# Try to rewrite a few common Homebrew Sparkle install names as well, because the
# recorded install name may differ from the path returned by CMake's find_library.
old_candidates=(
"${sparkle_bin_link}"
"${sparkle_bin_real}"
"/opt/homebrew/opt/sparkle-framework/Frameworks/Sparkle.framework/Versions/A/Sparkle"
"/opt/homebrew/opt/sparkle-framework/Frameworks/Sparkle.framework/Versions/B/Sparkle"
"/opt/homebrew/Frameworks/Sparkle.framework/Versions/A/Sparkle"
"/opt/homebrew/Frameworks/Sparkle.framework/Versions/B/Sparkle"
"/usr/local/opt/sparkle-framework/Frameworks/Sparkle.framework/Versions/A/Sparkle"
"/usr/local/opt/sparkle-framework/Frameworks/Sparkle.framework/Versions/B/Sparkle"
"/usr/local/Frameworks/Sparkle.framework/Versions/A/Sparkle"
"/usr/local/Frameworks/Sparkle.framework/Versions/B/Sparkle"
)
for old in "${old_candidates[@]}"; do
if [[ -n "${old}" ]]; then
install_name_tool -change "${old}" "${sparkle_rpath}" "${main_bin}" || true
if [[ -f "${qtsparkle_dylib}" ]]; then
install_name_tool -change "${old}" "${sparkle_rpath}" "${qtsparkle_dylib}" || true
fi
fi
done