Repository navigation
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·41 lines (36 loc) · 1.76 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·41 lines (36 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
# Builds "Where'd It Go.app" into ./build, signed ad hoc for local use.
# Release builds are universal (Apple silicon and Intel); debug builds are for this Mac only.
# SANDBOX=1 signs with the App Store sandbox entitlements, to try the App Store behavior locally.
set -euo pipefail
cd "$(dirname "$0")"
APP="build/Where'd It Go.app"
CONFIG="${1:-release}"
rm -rf "$APP" build/AppIcon.iconset
mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources" build/bin
# Both architectures build into the same folder, so keep each binary as it is built.
swift build -c "$CONFIG" --product WheredItGo
BIN=build/bin/WheredItGo-native
cp "$(swift build -c "$CONFIG" --show-bin-path)/WheredItGo" "$BIN"
if [ "$CONFIG" = release ]; then
INTEL=x86_64-apple-macosx14.0
swift build -c release --product WheredItGo --triple "$INTEL"
cp "$(swift build -c release --triple "$INTEL" --show-bin-path)/WheredItGo" build/bin/WheredItGo-x86_64
lipo -create "$BIN" build/bin/WheredItGo-x86_64 -output "$APP/Contents/MacOS/WheredItGo"
else
cp "$BIN" "$APP/Contents/MacOS/WheredItGo"
fi
cp Resources/Info.plist "$APP/Contents/Info.plist"
cp Resources/Camera.png "$APP/Contents/Resources/Camera.png"
cp Resources/Credits.jpg "$APP/Contents/Resources/Credits.jpg"
cp Resources/PrivacyInfo.xcprivacy "$APP/Contents/Resources/PrivacyInfo.xcprivacy"
cp Resources/Camera.png build/bin/Camera.png
cp Resources/Credits.jpg build/bin/Credits.jpg
"$BIN" --render-icon build/AppIcon.iconset
iconutil -c icns build/AppIcon.iconset -o "$APP/Contents/Resources/AppIcon.icns"
if [ "${SANDBOX:-0}" = 1 ]; then
codesign --force --sign - --options runtime --timestamp=none --entitlements Resources/WheredItGo.entitlements "$APP"
else
codesign --force --sign - --options runtime --timestamp=none "$APP"
fi
echo "Built $APP"