-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage-app.sh
More file actions
executable file
·37 lines (33 loc) · 1.75 KB
/
Copy pathpackage-app.sh
File metadata and controls
executable file
·37 lines (33 loc) · 1.75 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
#!/bin/bash
# Package LCTMac as a proper .app bundle.
# Running the bare SPM executable makes TCC attribute permission requests to the
# launching app (Terminal/Claude/etc.), which crashes with SIGABRT when that app
# lacks the usage descriptions. A real bundle owns its own TCC identity.
set -euo pipefail
cd "$(dirname "$0")"
swift build -c release
BIN_PATH=$(swift build -c release --show-bin-path)
APP=LCTMac.app
rm -rf "$APP"
mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources"
cp "$BIN_PATH/LCTMac" "$APP/Contents/MacOS/LCTMac"
cp LCTMac/Info.plist "$APP/Contents/Info.plist"
cp LCTMac/Resources/AppIcon.icns "$APP/Contents/Resources/AppIcon.icns"
# Stamp version from git so builds are distinguishable
VERSION=$(git describe --tags 2>/dev/null || echo "0.1.0")
BUILD=$(git rev-list --count HEAD 2>/dev/null || echo "1")
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $VERSION" "$APP/Contents/Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $BUILD" "$APP/Contents/Info.plist"
# Sign with a stable local identity if one exists, so macOS TCC permissions
# (screen recording, microphone, speech) survive rebuilds instead of being
# invalidated every time — ad-hoc signatures change on each build, which forces
# re-authorization. Create the dev identity once with: ./scripts/dev-cert.sh
# Falls back to ad-hoc on CI / machines without the cert.
SIGN_IDENTITY="${LCT_SIGN_IDENTITY:-LCT Dev}"
if security find-identity -p codesigning 2>/dev/null | grep -q "$SIGN_IDENTITY"; then
codesign --force --sign "$SIGN_IDENTITY" "$APP"
echo "Packaged $APP $VERSION ($BUILD), signed as '$SIGN_IDENTITY' — launch with: open $APP"
else
codesign --force --sign - "$APP"
echo "Packaged $APP $VERSION ($BUILD), ad-hoc signed — launch with: open $APP"
fi