Files
spotifast/packaging/macos/bundle.sh
T
millia ampora 23d7777386 Repair three things the macOS bundle gets wrong
macOS 15 gates mDNS behind a declared purpose. Without
NSLocalNetworkUsageDescription and NSBonjourServices in Info.plist the
system blocks the browse, so LAN speaker discovery quietly finds nothing
and there is no error for the app to report.

arm64 refuses to launch an unsigned bundle, so bundle.sh now signs it:
ad-hoc by default, with CODESIGN_IDENTITY for a Developer ID, and verifies
the result.

The window icon set at startup replaces the dock icon macOS took from the
bundle's .icns, trading a 1024px drawing with the platform's rounding for a
flat 128px square. It is skipped there; every other platform still gets it.

Also drops icon_64x64 from the iconset. iconutil ignores that size without
saying so, so it was two sips calls producing nothing.
2026-08-28 12:37:13 +02:00

46 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# Build Fastpotify.app from a GUI binary, on a macOS machine.
#
# packaging/macos/bundle.sh <binary> <output.app> <version>
#
# Set CODESIGN_IDENTITY to sign with a Developer ID; the default is an ad-hoc
# signature, which arm64 requires before the app will launch at all.
#
# The .icns is generated here from the committed 1024px PNG, because iconutil
# only exists on macOS. The Info.plist template lives next to this script.
set -euo pipefail
binary="$1"
app="$2"
version="$3"
here="$(cd "$(dirname "$0")" && pwd)"
rm -rf "$app"
mkdir -p "$app/Contents/MacOS" "$app/Contents/Resources"
cp "$binary" "$app/Contents/MacOS/fastpotify"
chmod 755 "$app/Contents/MacOS/fastpotify"
sed "s/__VERSION__/$version/g" "$here/Info.plist" > "$app/Contents/Info.plist"
iconset="$(mktemp -d)/fastpotify.iconset"
mkdir -p "$iconset"
# iconutil reads only these base sizes, each with an optional @2x. It ignores
# an icon_64x64 without saying so, so generating one is two wasted sips calls.
for size in 16 32 128 256 512; do
sips -z $size $size "$here/icon-1024.png" --out "$iconset/icon_${size}x${size}.png" >/dev/null
double=$((size * 2))
sips -z $double $double "$here/icon-1024.png" --out "$iconset/icon_${size}x${size}@2x.png" >/dev/null
done
iconutil -c icns "$iconset" -o "$app/Contents/Resources/fastpotify.icns"
# arm64 refuses to launch an unsigned bundle, so sign one way or another.
if [ -n "${CODESIGN_IDENTITY:-}" ]; then
codesign --force --timestamp --options runtime \
--sign "$CODESIGN_IDENTITY" "$app"
else
codesign --force --sign - "$app"
fi
codesign --verify --strict "$app"
echo "$app"