71 lines
1.9 KiB
Bash
Executable File
71 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
CONFIG="${1:-debug}"
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cd "$ROOT"
|
|
|
|
echo "Baue LektorenPlan ($CONFIG)…"
|
|
swift build -c "$CONFIG"
|
|
|
|
BIN_DIR="$(swift build -c "$CONFIG" --show-bin-path)"
|
|
APP="$ROOT/build/LektorenPlan.app"
|
|
CONTENTS="$APP/Contents"
|
|
MACOS="$CONTENTS/MacOS"
|
|
RESOURCES="$CONTENTS/Resources"
|
|
|
|
rm -rf "$APP"
|
|
mkdir -p "$MACOS" "$RESOURCES"
|
|
|
|
cp "$BIN_DIR/LektorenPlan" "$MACOS/LektorenPlan"
|
|
|
|
# App icon
|
|
if [ -f "$ROOT/Resources/AppIcon.icns" ]; then
|
|
cp "$ROOT/Resources/AppIcon.icns" "$RESOURCES/AppIcon.icns"
|
|
fi
|
|
|
|
# Copy SwiftPM resource bundles so Bundle.module keeps working inside the app.
|
|
for bundle in "$BIN_DIR"/*.bundle; do
|
|
[ -e "$bundle" ] || continue
|
|
cp -R "$bundle" "$RESOURCES/"
|
|
done
|
|
|
|
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>CFBundleDevelopmentRegion</key>
|
|
<string>de</string>
|
|
<key>CFBundleExecutable</key>
|
|
<string>LektorenPlan</string>
|
|
<key>CFBundleIdentifier</key>
|
|
<string>de.badgodesberg.lektorenplan</string>
|
|
<key>CFBundleIconFile</key>
|
|
<string>AppIcon</string>
|
|
<key>CFBundleInfoDictionaryVersion</key>
|
|
<string>6.0</string>
|
|
<key>CFBundleName</key>
|
|
<string>LektorenPlan</string>
|
|
<key>CFBundleDisplayName</key>
|
|
<string>LektorenPlan</string>
|
|
<key>CFBundlePackageType</key>
|
|
<string>APPL</string>
|
|
<key>CFBundleShortVersionString</key>
|
|
<string>0.1</string>
|
|
<key>CFBundleVersion</key>
|
|
<string>1</string>
|
|
<key>LSMinimumSystemVersion</key>
|
|
<string>14.0</string>
|
|
<key>NSHighResolutionCapable</key>
|
|
<true/>
|
|
<key>NSPrincipalClass</key>
|
|
<string>NSApplication</string>
|
|
<key>NSHumanReadableCopyright</key>
|
|
<string>LektorenPlan Prototyp · Pfarreiengemeinschaft Bad Godesberg</string>
|
|
</dict>
|
|
</plist>
|
|
PLIST
|
|
|
|
echo "Fertig: $APP"
|