|
| 1 | +#!/bin/bash |
| 2 | +set -euo pipefail |
| 3 | + |
| 4 | +ROOT=$(cd "$(dirname "$0")/.." && pwd) |
| 5 | +source "$ROOT/version.env" |
| 6 | + |
| 7 | +APP_NAME="MiniWhisper" |
| 8 | +BUILD_CONFIG="${1:-release}" |
| 9 | +BUILD_DIR=".build/${BUILD_CONFIG}" |
| 10 | +APP_BUNDLE="build/${APP_NAME}.app" |
| 11 | +BUNDLE_ID_DEBUG="com.miniwhisper.dev" |
| 12 | +BUNDLE_ID_RELEASE="com.miniwhisper.app" |
| 13 | + |
| 14 | +if [[ "$BUILD_CONFIG" == "debug" ]]; then |
| 15 | + BUNDLE_ID="$BUNDLE_ID_DEBUG" |
| 16 | + DISPLAY_NAME="MiniWhisper Dev" |
| 17 | +else |
| 18 | + BUNDLE_ID="$BUNDLE_ID_RELEASE" |
| 19 | + DISPLAY_NAME="MiniWhisper" |
| 20 | +fi |
| 21 | + |
| 22 | +echo "Building $APP_NAME ($BUILD_CONFIG)..." |
| 23 | + |
| 24 | +swift build -c "$BUILD_CONFIG" |
| 25 | + |
| 26 | +echo "Creating app bundle..." |
| 27 | +rm -rf "$APP_BUNDLE" |
| 28 | +mkdir -p "$APP_BUNDLE/Contents/MacOS" |
| 29 | +mkdir -p "$APP_BUNDLE/Contents/Resources" |
| 30 | + |
| 31 | +cp "$BUILD_DIR/$APP_NAME" "$APP_BUNDLE/Contents/MacOS/" |
| 32 | + |
| 33 | +cat > "$APP_BUNDLE/Contents/Info.plist" << PLIST |
| 34 | +<?xml version="1.0" encoding="UTF-8"?> |
| 35 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 36 | +<plist version="1.0"> |
| 37 | +<dict> |
| 38 | + <key>CFBundleDevelopmentRegion</key> |
| 39 | + <string>en</string> |
| 40 | + <key>CFBundleDisplayName</key> |
| 41 | + <string>${DISPLAY_NAME}</string> |
| 42 | + <key>CFBundleExecutable</key> |
| 43 | + <string>${APP_NAME}</string> |
| 44 | + <key>CFBundleIdentifier</key> |
| 45 | + <string>${BUNDLE_ID}</string> |
| 46 | + <key>CFBundleInfoDictionaryVersion</key> |
| 47 | + <string>6.0</string> |
| 48 | + <key>CFBundleName</key> |
| 49 | + <string>${APP_NAME}</string> |
| 50 | + <key>CFBundlePackageType</key> |
| 51 | + <string>APPL</string> |
| 52 | + <key>CFBundleShortVersionString</key> |
| 53 | + <string>${MARKETING_VERSION}</string> |
| 54 | + <key>CFBundleVersion</key> |
| 55 | + <string>${BUILD_NUMBER}</string> |
| 56 | + <key>LSApplicationCategoryType</key> |
| 57 | + <string>public.app-category.utilities</string> |
| 58 | + <key>LSMinimumSystemVersion</key> |
| 59 | + <string>14.0</string> |
| 60 | + <key>LSUIElement</key> |
| 61 | + <true/> |
| 62 | + <key>NSHighResolutionCapable</key> |
| 63 | + <true/> |
| 64 | + <key>NSPrincipalClass</key> |
| 65 | + <string>NSApplication</string> |
| 66 | + <key>CFBundleIconFile</key> |
| 67 | + <string>AppIcon</string> |
| 68 | + <key>NSHumanReadableCopyright</key> |
| 69 | + <string>Copyright © 2026 Andy Tran. All rights reserved.</string> |
| 70 | + <key>NSMicrophoneUsageDescription</key> |
| 71 | + <string>MiniWhisper needs microphone access to record and transcribe speech.</string> |
| 72 | +</dict> |
| 73 | +</plist> |
| 74 | +PLIST |
| 75 | + |
| 76 | +cp "Sources/MiniWhisper/Resources/AppIcon.icns" "$APP_BUNDLE/Contents/Resources/" |
| 77 | + |
| 78 | +echo -n "APPL????" > "$APP_BUNDLE/Contents/PkgInfo" |
| 79 | + |
| 80 | +chmod +x "$APP_BUNDLE/Contents/MacOS/$APP_NAME" |
| 81 | + |
| 82 | +# Copy entitlements (used by signing in justfile, not embedded in bundle) |
| 83 | +cp "Sources/MiniWhisper/Resources/MiniWhisper.entitlements" "build/" |
| 84 | + |
| 85 | +echo "Bundle created: $APP_BUNDLE" |
0 commit comments