#!/usr/bin/env bash # # Bundle agcanvas as a macOS .app for Finder. # Works on both Apple Silicon and Intel. # # Usage: # ./scripts/bundle-macos.sh # Build release + bundle # ./scripts/bundle-macos.sh --install # Also copy to /Applications # set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" APP_NAME="Augmented Canvas" BUNDLE_DIR="$PROJECT_ROOT/target/release/bundle" APP_BUNDLE="$BUNDLE_DIR/$APP_NAME.app" echo "==> Building agcanvas (release)..." cargo build --release -p agcanvas --manifest-path "$PROJECT_ROOT/Cargo.toml" echo "==> Creating $APP_NAME.app bundle..." rm -rf "$APP_BUNDLE" mkdir -p "$APP_BUNDLE/Contents/MacOS" mkdir -p "$APP_BUNDLE/Contents/Resources" cp "$PROJECT_ROOT/target/release/agcanvas" "$APP_BUNDLE/Contents/MacOS/agcanvas" cp "$PROJECT_ROOT/assets/Info.plist" "$APP_BUNDLE/Contents/Info.plist" if [ -f "$PROJECT_ROOT/assets/AppIcon.icns" ]; then cp "$PROJECT_ROOT/assets/AppIcon.icns" "$APP_BUNDLE/Contents/Resources/AppIcon.icns" echo " Icon: AppIcon.icns" else echo " Icon: none (add assets/AppIcon.icns for a custom icon)" fi printf 'APPL????' > "$APP_BUNDLE/Contents/PkgInfo" echo "==> Bundle created: $APP_BUNDLE" if [[ "${1:-}" == "--install" ]]; then echo "==> Installing to /Applications..." rm -rf "/Applications/$APP_NAME.app" cp -r "$APP_BUNDLE" "/Applications/$APP_NAME.app" echo "==> Installed: /Applications/$APP_NAME.app" echo " Open Finder → Applications → Augmented Canvas" fi echo "==> Done."