#!/bin/bash # scripts/build-display-control.sh # Compile the display_control binary for macOS. # # Requirements: Xcode Command Line Tools # xcode-select --install # # Run this on a Mac. Commit the resulting binary to resources/bin/ # so it is bundled into the packaged Electron app without any Homebrew dependency. set -e SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" SRC="$SCRIPT_DIR/display_control.m" OUT_DIR="$REPO_ROOT/resources/bin" OUT_BIN="$OUT_DIR/display_control" if ! command -v clang &>/dev/null; then echo "ERROR: clang not found." echo "Install Xcode Command Line Tools: xcode-select --install" exit 1 fi mkdir -p "$OUT_DIR" echo "Building display_control..." clang -framework Cocoa -framework Carbon \ -o "$OUT_BIN" "$SRC" chmod +x "$OUT_BIN" echo "Built: $OUT_BIN" echo "" echo "Test it:" echo " $OUT_BIN status" echo " $OUT_BIN extend" echo " $OUT_BIN mirror" echo "" echo "Once verified, commit resources/bin/display_control to the repo."