mirror of
https://github.com/Felitendo/spotifast.git
synced 2026-11-01 17:33:26 +01:00
Use Spotifast across the native app, commands, packages and documentation. Keep existing state, credential stores, protocol identities and package names; provide both command names and compatible updater payloads. Rename the guides with jekyll-redirect-from and prepare spotifast.rocks as the website domain. Keep product descriptions name-free.
49 lines
1.7 KiB
Bash
Executable File
49 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# Build Spotifast.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"
|
|
# The build number has to be numbers: a release candidate's -rc1 comes off.
|
|
build="${version%%-*}"
|
|
sed -e "s/__VERSION__/$version/g" -e "s/__BUILD__/$build/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"
|