77 lines
2.6 KiB
Bash
Executable File
77 lines
2.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# build_app.sh — Compila o app SwiftUI (GArt.app) a partir dos fontes em MacApp/Sources.
|
|
#
|
|
# Uso:
|
|
# ./MacApp/build_app.sh # compila e monta o .app em MacApp/build/
|
|
# ./MacApp/build_app.sh --run # compila e abre o app
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
SDK="$(xcrun --sdk macosx --show-sdk-path)"
|
|
TARGET="arm64-apple-macosx26.0"
|
|
|
|
APP_NAME="GArt"
|
|
BUILD_DIR="$ROOT/MacApp/build"
|
|
APP_BUNDLE="$BUILD_DIR/$APP_NAME.app"
|
|
CONTENTS="$APP_BUNDLE/Contents"
|
|
MACOS="$CONTENTS/MacOS"
|
|
RESOURCES="$CONTENTS/Resources"
|
|
|
|
echo "==> Compilando SwiftUI ($APP_NAME)..."
|
|
mkdir -p "$MACOS" "$RESOURCES"
|
|
swiftc -parse-as-library -O \
|
|
-sdk "$SDK" \
|
|
-target "$TARGET" \
|
|
"$ROOT"/MacApp/Sources/*.swift \
|
|
-o "$MACOS/$APP_NAME"
|
|
|
|
# Info.plist
|
|
cat > "$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>CFBundleName</key><string>$APP_NAME</string>
|
|
<key>CFBundleDisplayName</key><string>G-ART</string>
|
|
<key>CFBundleIdentifier</key><string>com.gart.transcription</string>
|
|
<key>CFBundleVersion</key><string>0.1</string>
|
|
<key>CFBundleShortVersionString</key><string>0.1.0</string>
|
|
<key>CFBundleExecutable</key><string>$APP_NAME</string>
|
|
<key>CFBundlePackageType</key><string>APPL</string>
|
|
<key>LSMinimumSystemVersion</key><string>14.0</string>
|
|
<key>NSPrincipalClass</key><string>NSApplication</string>
|
|
<key>NSHighResolutionCapable</key><true/>
|
|
<key>UTExportedTypeDeclarations</key>
|
|
<array>
|
|
<dict>
|
|
<key>UTTypeIdentifier</key><string>com.genial.fcpxml</string>
|
|
<key>UTTypeDescription</key><string>Final Cut Pro XML</string>
|
|
<key>UTTypeConformsTo</key><array><string>public.xml</string></array>
|
|
<key>UTTypeTagSpecification</key>
|
|
<dict>
|
|
<key>public.filename-extension</key>
|
|
<array><string>fcpxml</string></array>
|
|
<key>public.mime-type</key>
|
|
<string>text/xml</string>
|
|
</dict>
|
|
</dict>
|
|
</array>
|
|
</dict>
|
|
</plist>
|
|
PLIST
|
|
|
|
# Ícone (se existir)
|
|
if [ -f "$ROOT/MacApp/Assets/AppIcon.icns" ]; then
|
|
cp "$ROOT/MacApp/Assets/AppIcon.icns" "$RESOURCES/AppIcon.icns"
|
|
# Referenciar no Info.plist
|
|
/usr/libexec/PlistBuddy -c "Add :CFBundleIconFile string AppIcon" "$CONTENTS/Info.plist" 2>/dev/null || true
|
|
fi
|
|
|
|
chmod +x "$MACOS/$APP_NAME"
|
|
echo "==> App criado: $APP_BUNDLE"
|
|
|
|
if [[ "${1:-}" == "--run" ]]; then
|
|
echo "==> Abrindo app..."
|
|
open "$APP_BUNDLE"
|
|
fi
|