#!/bin/sh # Assemble menubar-pet.app around the SwiftPM executable. # # SwiftPM cannot emit a .app, and a menu-bar app needs one: LSUIElement is what # keeps it out of the Dock and off the window list. Rather than take on an # .xcodeproj — which would stop `swift build` being the whole story and make # the Homebrew formula harder — the bundle is four files and a script. # # bundle.sh # # Writes /menubar-pet.app. set -eu exe=${1:?usage: bundle.sh } outdir=${2:?usage: bundle.sh } [ -x "$exe" ] || { echo "bundle.sh: $exe is not executable" >&2; exit 1; } app="$outdir/menubar-pet.app" rm -rf "$app" mkdir -p "$app/Contents/MacOS" cp "$exe" "$app/Contents/MacOS/menubar-pet" cat > "$app/Contents/Info.plist" <<'PLIST' CFBundleName menubar-pet CFBundleDisplayName Menubar Pet CFBundleIdentifier net.krz.ambient-companions.menubar-pet CFBundleExecutable menubar-pet CFBundlePackageType APPL CFBundleInfoDictionaryVersion 6.0 LSMinimumSystemVersion 13.0 LSUIElement PLIST plutil -lint "$app/Contents/Info.plist" >/dev/null echo "$app"