-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·47 lines (42 loc) · 1.51 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·47 lines (42 loc) · 1.51 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
42
43
44
45
46
47
#!/bin/bash
# Builds Hogwatch.app — a minimal bundle is required because
# UNUserNotificationCenter refuses to run from a bare executable.
set -euo pipefail
cd "$(dirname "$0")"
APP="Hogwatch.app"
VERSION="${HOGWATCH_VERSION:-1.0}"
rm -rf "$APP"
mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources"
cat > "$APP/Contents/Info.plist" <<EOF
<?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>CFBundleIdentifier</key>
<string>be.jackjoe.hogwatch</string>
<key>CFBundleName</key>
<string>Hogwatch</string>
<key>CFBundleExecutable</key>
<string>Hogwatch</string>
<key>CFBundleIconFile</key>
<string>AppIcon</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>${VERSION}</string>
<key>LSMinimumSystemVersion</key>
<string>13.0</string>
<key>LSUIElement</key>
<true/>
</dict>
</plist>
EOF
cp AppIcon.icns "$APP/Contents/Resources/"
swiftc -O -target arm64-apple-macos13.0 -o "$APP/Contents/MacOS/Hogwatch.arm64" main.swift
swiftc -O -target x86_64-apple-macos13.0 -o "$APP/Contents/MacOS/Hogwatch.x86_64" main.swift
lipo -create -output "$APP/Contents/MacOS/Hogwatch" \
"$APP/Contents/MacOS/Hogwatch.arm64" "$APP/Contents/MacOS/Hogwatch.x86_64"
rm "$APP/Contents/MacOS/Hogwatch.arm64" "$APP/Contents/MacOS/Hogwatch.x86_64"
codesign --force -s - "$APP"
echo "Built $APP ($(lipo -archs "$APP/Contents/MacOS/Hogwatch"))"
echo "Run: open $APP"