|
|
#!/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" <<PLIST
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
|
<plist version="1.0"><dict>
|
|
|
<key>CFBundleName</key><string>JXL Optim</string>
|
|
|
<key>CFBundleExecutable</key><string>JXLOptim</string>
|
|
|
<key>CFBundleIconFile</key><string>AppIcon</string>
|
|
|
<key>CFBundleIdentifier</key><string>com.local.jxloptim</string>
|
|
|
<key>CFBundlePackageType</key><string>APPL</string>
|
|
|
<key>CFBundleShortVersionString</key><string>1.0</string>
|
|
|
<key>LSMinimumSystemVersion</key><string>12.0</string>
|
|
|
<key>NSHighResolutionCapable</key><true/>
|
|
|
</dict></plist>
|
|
|
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)."
|