42 lines
2.0 KiB
Bash
Executable File
42 lines
2.0 KiB
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
mac=$(cd "$(dirname "$0")" && pwd)
|
|
root=$(dirname "$mac")
|
|
shared=$HOME/Library/Caches/byre/build
|
|
build=$mac/.build
|
|
app=$build/byre.app
|
|
svg=$mac/icon.svg
|
|
icns=$build/byre.icns
|
|
mkdir -p "$shared" "$build"
|
|
lockf -k "$shared.lock" sh -ec '
|
|
rsync -rlc --delete --exclude /mac/.build --exclude /hands/.build "$1/mac" "$1/api" "$1/hands" "$2/"
|
|
swift build --package-path "$2/mac" --configuration release --no-color-diagnostics
|
|
swift build --package-path "$2/hands" --configuration release --no-color-diagnostics
|
|
cp "$2/mac/.build/release/Byre" "$3"
|
|
cp "$2/hands/.build/release/byre-hands" "$4"
|
|
' sh "$root" "$shared" "$build/Byre" "$build/byre-hands"
|
|
if [ ! "$icns" -nt "$svg" ]; then
|
|
iconset=$build/byre.iconset
|
|
rm -rf "$iconset"
|
|
mkdir -p "$iconset"
|
|
for size in 16 32 128 256 512; do
|
|
rsvg-convert --width $size --height $size --output "$iconset/icon_${size}x${size}.png" "$svg"
|
|
rsvg-convert --width $((size * 2)) --height $((size * 2)) --output "$iconset/icon_${size}x${size}@2x.png" "$svg"
|
|
done
|
|
iconutil --convert icns --output "$icns" "$iconset"
|
|
fi
|
|
rm -rf "$app"
|
|
mkdir -p "$app/Contents/MacOS" "$app/Contents/Resources/fonts"
|
|
cp "$build/Byre" "$app/Contents/MacOS/Byre"
|
|
cp "$build/byre-hands" "$app/Contents/MacOS/byre-hands"
|
|
codesign --force --sign "Apple Development" --identifier run.fc.byre.hands "$app/Contents/MacOS/byre-hands"
|
|
cp "$mac/Info.plist" "$app/Contents/Info.plist"
|
|
plutil -insert ByreCommit -string "$(git -C "$root" rev-parse HEAD)" "$app/Contents/Info.plist"
|
|
plutil -insert CFBundleShortVersionString -string "$(git -C "$root" rev-parse --short HEAD)" "$app/Contents/Info.plist"
|
|
plutil -insert CFBundleVersion -string "$(git -C "$root" rev-list --count HEAD)" "$app/Contents/Info.plist"
|
|
cp "$mac"/fonts/*.woff2 "$app/Contents/Resources/fonts/"
|
|
cp "$icns" "$app/Contents/Resources/byre.icns"
|
|
cp "$mac/byre.provisionprofile" "$app/Contents/embedded.provisionprofile"
|
|
codesign --force --sign "Apple Development" --entitlements "$mac/byre.entitlements" "$app"
|
|
echo "$app"
|