Files
AV-Live/launcher/build.sh
T
L'électron rare 7dfff1b7fa feat(launcher): icon + universal build
Context: the launcher .app needs (a) a real icon visible in Dock /
Mission Control / Finder when its log window is open, and (b) a binary
that runs on both Intel MBPs (the current target on the 192.168.0.189
machine) and Apple Silicon. Initial build was arm64-only.

Approach: SVG icon rendered via librsvg into a multi-size .iconset,
packed into AppIcon.icns by iconutil (no Xcode asset catalog needed).
build.sh now compiles for both arm64 and x86_64 separately and lipos
them into a fat binary before bundling. The icon is regenerated only
when the SVG is newer than the existing .icns. Also switched the
default oscope-of binary path to look inside the .app bundle that
oF Release produces, with a walk-up-to-bin/ heuristic for the cwd.

Changes:
- Resources/icon.svg : 1024x1024 design — orange electron with
  asymmetric googly eyes, sticking-out tongue, three rotated chaotic
  orbital ellipses (cyan / purple / pink), radiating yellow lightning
  bolts and scattered sparks on a dark purple radial gradient with
  Big-Sur rounded-rect mask
- Resources/make_icon.sh : rsvg-convert at 16/32/128/256/512 px @1x
  and @2x, then iconutil -c icns
- Resources/Info.plist : CFBundleIconFile = AppIcon
- build.sh : iterate ARCHS (default 'arm64 x86_64'), build each, lipo
  -create them, regen icon if SVG is newer, copy AppIcon.icns into
  Contents/Resources
- ProcessManager.swift :
  * default oscopePath now prefers
    .../bin/oscope-of.app/Contents/MacOS/oscope-of (the bundle that
    openFrameworks produces) with fallback to bare binary
  * new oscopeProjectRoot(from:) walks up the path to find the parent
    of 'bin/', so cwd is the oF project root regardless of bundle vs
    bare binary, letting oF locate bin/data/
- .gitignore : exclude generated AppIcon.iconset and AppIcon.icns

Impact: ./build.sh now produces a universal .app that launches on both
arm64 and Intel macs (smoke-tested on Big Sur Intel MBP). The icon
appears in the Dock when the log window is open, and oscope-of starts
correctly regardless of how it was built.
2026-05-07 12:16:13 +02:00

48 lines
1.6 KiB
Bash
Executable File

#!/bin/sh
# Build AVLiveLauncher and bundle it into a .app
set -eu
cd "$(dirname "$0")"
BIN_NAME="AVLiveLauncher"
APP_PATH="build/${BIN_NAME}.app"
ARCHS=${ARCHS:-arm64 x86_64}
# Build each arch and lipo them together when more than one
BIN_PARTS=""
for arch in ${ARCHS}; do
echo "==> swift build (release, ${arch})"
swift build -c release --arch "${arch}"
PART=".build/${arch}-apple-macosx/release/${BIN_NAME}"
[ -x "${PART}" ] || { echo "Missing ${PART}" >&2; exit 1; }
BIN_PARTS="${BIN_PARTS} ${PART}"
done
BIN_PATH=".build/release/${BIN_NAME}-universal"
mkdir -p "$(dirname "${BIN_PATH}")"
# shellcheck disable=SC2086
lipo -create -output "${BIN_PATH}" ${BIN_PARTS}
echo "==> universal binary $(lipo -info "${BIN_PATH}")"
echo "==> bundling ${APP_PATH}"
rm -rf "${APP_PATH}"
mkdir -p "${APP_PATH}/Contents/MacOS" "${APP_PATH}/Contents/Resources"
cp "${BIN_PATH}" "${APP_PATH}/Contents/MacOS/${BIN_NAME}"
cp Resources/Info.plist "${APP_PATH}/Contents/Info.plist"
# Build AppIcon.icns from SVG if missing or stale
if [ ! -f Resources/AppIcon.icns ] \
|| [ Resources/icon.svg -nt Resources/AppIcon.icns ]; then
if command -v rsvg-convert >/dev/null 2>&1; then
( cd Resources && ./make_icon.sh )
else
echo "warn: rsvg-convert missing, skipping icon regen" >&2
fi
fi
[ -f Resources/AppIcon.icns ] && cp Resources/AppIcon.icns "${APP_PATH}/Contents/Resources/AppIcon.icns"
# Ad-hoc sign so Gatekeeper at least lets the user open it manually
codesign --force --sign - "${APP_PATH}" 2>/dev/null || true
echo "==> done"
echo " open ${APP_PATH}"