#!/bin/sh # Assemble dist/EWM.app -- a self-contained, double-clickable macOS bundle. # # scripts/make-app.sh # # Phase 1 of notes/MAC_APP.md: static SDL3 (no Homebrew dependency at run # time; CMake required at build time), the icon rendered by the emulator's # own character generator, ad-hoc code signing, and Finder document types # for the disk-image extensions. Real signing/notarization is Phase 2. set -e cd "$(dirname "$0")/.." VERSION=$(grep '^version' Cargo.toml | head -1 | cut -d '"' -f 2) DIST=dist APP="$DIST/EWM.app" echo "==> generating the icon (examples/icon.rs)" cargo run -q -p ewm --example icon -- "$DIST/EWM.iconset" echo "==> building the release binary (static SDL3; first build compiles SDL from source)" cargo build --release -p ewm --no-default-features --features sdl-static echo "==> assembling $APP" rm -rf "$APP" mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources" cp target/release/ewm "$APP/Contents/MacOS/ewm" iconutil -c icns -o "$APP/Contents/Resources/EWM.icns" "$DIST/EWM.iconset" cat > "$APP/Contents/Info.plist" < CFBundlePackageType APPL CFBundleIdentifier ca.arentz.ewm CFBundleName EWM CFBundleExecutable ewm CFBundleIconFile EWM CFBundleShortVersionString $VERSION CFBundleVersion $VERSION LSMinimumSystemVersion 12.0 LSApplicationCategoryType public.app-category.games NSHighResolutionCapable CFBundleDocumentTypes CFBundleTypeName Apple II Floppy Disk Image CFBundleTypeExtensions dsk do po nib woz CFBundleTypeRole Viewer LSHandlerRank Alternate CFBundleTypeName ProDOS Hard Drive Image CFBundleTypeExtensions hdv CFBundleTypeRole Viewer LSHandlerRank Alternate PLIST plutil -lint "$APP/Contents/Info.plist" echo "==> code signing (ad hoc)" codesign --force -s - "$APP" echo "==> verifying the binary is self-contained" if otool -L "$APP/Contents/MacOS/ewm" | grep -q '/opt/homebrew\|/usr/local'; then echo "ERROR: the binary links non-system libraries:" otool -L "$APP/Contents/MacOS/ewm" exit 1 fi echo "==> done: $APP"