PulseCanvas / app · pulsecanvas.ai / scripts / build-app.sh
| 1 | #!/bin/bash |
| 2 | set -euo pipefail |
| 3 | cd "$(dirname "$0")/.." |
| 4 | ./scripts/build-projectm.sh |
| 5 | swift build -c release |
| 6 | APP="build/PulseCanvas Studio.app" |
| 7 | mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources" |
| 8 | # Remove stale payloads when rebuilding a previously full-library bundle. |
| 9 | rm -f "$APP/Contents/Frameworks/libprojectM.dylib" "$APP/Contents/Resources/Third-Party-Notices.md" |
| 10 | rm -rf "$APP/Contents/Resources/Legal" |
| 11 | cp .build/release/PulseCanvas "$APP/Contents/MacOS/PulseCanvas" |
| 12 | find "$APP/Contents/Resources" -maxdepth 1 -name "*.bundle" -type d -exec rm -rf {} + |
| 13 | cp -R .build/release/PulseCanvas_PulseCanvas.bundle "$APP/Contents/Resources/" |
| 14 | rm -f "$APP/Contents/Resources/PulseCanvas-MIT-LICENSE.txt" |
| 15 | cp LICENSE "$APP/Contents/Resources/PulseCanvas-LICENSE.txt" |
| 16 | xcrun xcstringstool compile Localization/Localizable.xcstrings --output-directory "$APP/Contents/Resources" |
| 17 | ./scripts/prepare-legal-resources.sh "$APP/Contents/Resources/Legal" |
| 18 | release_version="$(awk '/^MARKETING_VERSION = / {print $3}' Version.xcconfig)" |
| 19 | release_build="$(awk '/^CURRENT_PROJECT_VERSION = / {print $3}' macOS/Release.xcconfig)" |
| 20 | cat > "$APP/Contents/Info.plist" <<PLIST |
| 21 | <?xml version="1.0" encoding="UTF-8"?> |
| 22 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 23 | <plist version="1.0"><dict> |
| 24 | <key>CFBundleDevelopmentRegion</key><string>en</string> |
| 25 | <key>CFBundleExecutable</key><string>PulseCanvas</string> |
| 26 | <key>CFBundleIdentifier</key><string>com.protomota.pulsecanvas</string> |
| 27 | <key>CFBundleName</key><string>PulseCanvas Studio</string> |
| 28 | <key>CFBundleDisplayName</key><string>PulseCanvas Studio</string> |
| 29 | <key>CFBundleIconFile</key><string>AppIcon</string> |
| 30 | <key>CFBundlePackageType</key><string>APPL</string> |
| 31 | <key>CFBundleShortVersionString</key><string>$release_version</string> |
| 32 | <key>CFBundleVersion</key><string>$release_build</string> |
| 33 | <key>LSMinimumSystemVersion</key><string>14.0</string> |
| 34 | <key>NSHighResolutionCapable</key><true/> |
| 35 | <key>NSPrincipalClass</key><string>NSApplication</string> |
| 36 | </dict></plist> |
| 37 | PLIST |
| 38 | xcrun swift scripts/build-icon.swift .build/AppIcon.iconset |
| 39 | xcrun iconutil -c icns .build/AppIcon.iconset -o "$APP/Contents/Resources/AppIcon.icns" |
| 40 | codesign --force --deep --sign - "$APP" |
| 41 | python3 scripts/verify-original-resources.py "$APP" |
| 42 | printf 'Built %s\n' "$PWD/$APP" |