66 lines
2.7 KiB
Bash
Executable File
66 lines
2.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Builds build/Sst.app (a normal Dock app, no LSUIElement). Pass --install to copy it to /Applications.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
|
|
APP="build/Sst.app"
|
|
IDENTIFIER="local.sst.app"
|
|
VERSION="0.2.0"
|
|
|
|
swift build -c release --product Sst
|
|
BIN=".build/release/Sst"
|
|
|
|
rm -rf "$APP"
|
|
mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources"
|
|
cp "$BIN" "$APP/Contents/MacOS/Sst"
|
|
# SwiftPM resource bundles (if any dependency ships them) live next to the binary.
|
|
for b in .build/release/*.bundle; do
|
|
[ -e "$b" ] && cp -R "$b" "$APP/Contents/Resources/"
|
|
done
|
|
if [ -f Design/AppIcon.icns ]; then
|
|
cp Design/AppIcon.icns "$APP/Contents/Resources/AppIcon.icns"
|
|
else
|
|
echo "Let op: Design/AppIcon.icns ontbreekt; run scripts/make-icon.sh."
|
|
fi
|
|
|
|
cat > "$APP/Contents/Info.plist" <<PLIST
|
|
<?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>$IDENTIFIER</string>
|
|
<key>CFBundleName</key><string>Sst</string>
|
|
<key>CFBundleDisplayName</key><string>Sst</string>
|
|
<key>CFBundleExecutable</key><string>Sst</string>
|
|
<key>CFBundlePackageType</key><string>APPL</string>
|
|
<key>CFBundleShortVersionString</key><string>$VERSION</string>
|
|
<key>CFBundleVersion</key><string>1</string>
|
|
<key>CFBundleIconFile</key><string>AppIcon</string>
|
|
<key>LSMinimumSystemVersion</key><string>14.0</string>
|
|
<key>LSApplicationCategoryType</key><string>public.app-category.productivity</string>
|
|
<key>NSHighResolutionCapable</key><true/>
|
|
<key>NSMicrophoneUsageDescription</key>
|
|
<string>Sst neemt je stem op zolang je de sneltoets ingedrukt houdt, om die lokaal naar tekst om te zetten.</string>
|
|
</dict>
|
|
</plist>
|
|
PLIST
|
|
|
|
# A stable signing identity keeps the macOS permissions (Microphone, Accessibility, Input Monitoring) across rebuilds.
|
|
IDENTITY="${SST_SIGN_IDENTITY:-$(security find-identity -v -p codesigning | sed -n 's/.*"\(Apple Development: [^"]*\)".*/\1/p' | head -1)}"
|
|
if [ -n "$IDENTITY" ]; then
|
|
codesign --force --sign "$IDENTITY" --identifier "$IDENTIFIER" "$APP"
|
|
echo "Ondertekend met: $IDENTITY"
|
|
else
|
|
codesign --force --sign - --identifier "$IDENTIFIER" "$APP"
|
|
echo "WAARSCHUWING: geen Apple Development-certificaat gevonden; ad-hoc ondertekend (rechten gaan na elke herbouw verloren)."
|
|
fi
|
|
codesign --verify --strict "$APP"
|
|
echo "Gebouwd: $APP"
|
|
echo "Eenmalig na het wisselen van ondertekening: tccutil reset Accessibility $IDENTIFIER; tccutil reset ListenEvent $IDENTIFIER; tccutil reset Microphone $IDENTIFIER (en geef de rechten opnieuw)."
|
|
|
|
if [ "${1:-}" = "--install" ]; then
|
|
rm -rf /Applications/Sst.app
|
|
cp -R "$APP" /Applications/Sst.app
|
|
echo "Geïnstalleerd: /Applications/Sst.app"
|
|
fi
|