#!/bin/bash # Build a double-clickable JXL Optim.app from the SwiftPM executable. set -e cd "$(dirname "$0")" swift build -c release APP="JXL Optim.app" rm -rf "$APP" mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources" cp .build/release/JXLOptim "$APP/Contents/MacOS/" [ -f AppIcon.icns ] && cp AppIcon.icns "$APP/Contents/Resources/" cat > "$APP/Contents/Info.plist" < CFBundleNameJXL Optim CFBundleExecutableJXLOptim CFBundleIconFileAppIcon CFBundleIdentifiercom.local.jxloptim CFBundlePackageTypeAPPL CFBundleShortVersionString1.0 LSMinimumSystemVersion12.0 NSHighResolutionCapable PLIST # Sign. SIGN_ID can be a Developer ID for distribution; defaults to ad-hoc ("-") # so the app launches cleanly on the build machine without a paid certificate. SIGN_ID="${SIGN_ID:--}" # Hardened runtime only for real Developer ID (notarization). Ad-hoc + hardened # runtime blocks spawning /usr/local/bin/cjxl, so skip it for local builds. HARDEN=""; [ "$SIGN_ID" != "-" ] && HARDEN="--options runtime" codesign --force --deep $HARDEN --sign "$SIGN_ID" "$APP" codesign --verify --strict "$APP" && echo "Signed with: $SIGN_ID" echo "Built $APP — open it with: open '$APP'" echo "For distribution: SIGN_ID=\"Developer ID Application: NAME (TEAM)\" ./bundle.sh, then notarize (see README)."