Files
ewm/scripts/make-app.sh
Stefan ArentzandClaude Fable 5 3bb74324c0 Package EWM as a native Mac application (MAC_APP.md Phase 1)
scripts/make-app.sh assembles dist/EWM.app, a self-contained
double-clickable bundle:

- SDL3 is compiled from source and linked statically (a new sdl-static
  cargo feature; dev/CI builds keep the Homebrew pkg-config path as the
  default feature). Verified: otool -L shows only system frameworks.
- The icon is "][" rendered by the emulator's own Apple ][ character
  generator (examples/icon.rs), green phosphor on a dark bezel, drawn at
  integer scales per icon size and written as PNGs by a hand-rolled
  ~40-line PNG encoder (flate2 as a dev-dependency for the zlib stream);
  iconutil turns the set into EWM.icns at bundle time, so no binary icon
  is committed.
- Info.plist declares CFBundleDocumentTypes for .dsk/.do/.po/.nib/.woz
  and .hdv at Alternate rank, ad-hoc codesign for local use (real
  signing/notarization is Phase 2).

Opening a disk image from the Finder arrives as an SDL drop event, which
also buys drag-and-drop: the boo menu boots the ][+ with a dropped floppy
in drive 1 (or .hdv on slot 7), and dropping a floppy on a running
machine swaps drive 1. The new media module classifies images -- the one
subtlety is .po, which is a floppy at exactly 143,360 bytes and a ProDOS
hard-drive volume when larger.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 23:24:56 -04:00

101 lines
2.9 KiB
Bash
Executable File

#!/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" <<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>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleIdentifier</key>
<string>ca.arentz.ewm</string>
<key>CFBundleName</key>
<string>EWM</string>
<key>CFBundleExecutable</key>
<string>ewm</string>
<key>CFBundleIconFile</key>
<string>EWM</string>
<key>CFBundleShortVersionString</key>
<string>$VERSION</string>
<key>CFBundleVersion</key>
<string>$VERSION</string>
<key>LSMinimumSystemVersion</key>
<string>12.0</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.games</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>Apple II Floppy Disk Image</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>dsk</string>
<string>do</string>
<string>po</string>
<string>nib</string>
<string>woz</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>ProDOS Hard Drive Image</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>hdv</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
</dict>
</array>
</dict>
</plist>
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"