#!/usr/bin/env bash # Build CxWebAppMac.app from the SwiftPM target. set -euo pipefail cd "$(dirname "$0")/.." CONFIG="${CONFIG:-release}" APP="CxWebAppMac.app" DST="build/$APP" echo "[1/3] swift build -c $CONFIG" swift build -c "$CONFIG" BIN=$(swift build -c "$CONFIG" --show-bin-path)/CxWebAppMac [[ -x "$BIN" ]] || { echo "FATAL: $BIN not found" >&2; exit 1; } echo "[2/3] assemble bundle at $DST" rm -rf "$DST" mkdir -p "$DST/Contents/MacOS" "$DST/Contents/Resources" cp "$BIN" "$DST/Contents/MacOS/CxWebAppMac" cat > "$DST/Contents/Info.plist" <<'PLIST' CFBundleIdentifier studio.cxai.cxwebapp.mac CFBundleName CxWebApp CFBundleExecutable CxWebAppMac CFBundlePackageType APPL CFBundleShortVersionString 1.1.0 CFBundleVersion 1 LSMinimumSystemVersion 13.0 NSHighResolutionCapable NSAppTransportSecurity NSAllowsLocalNetworking PLIST echo "[3/3] codesign (ad-hoc, no notarization)" codesign --force --sign - "$DST" 2>/dev/null || true echo echo "Built: $DST" echo "Run: open '$DST' (or: '$DST/Contents/MacOS/CxWebAppMac')"