#!/bin/bash # Build the SpeechAnalyzer helper. # # On a managed Mac the freshly built binary is SIGKILLed (exit 137) until it has # been through the binary approval process, and the approval takes a few minutes # to sync. Rebuilding changes the binary, so it needs approving again. set -euo pipefail HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$HERE" swiftc -O -parse-as-library SpeechHelper.swift -o speech-helper echo "built $HERE/speech-helper" if ./speech-helper --check >/dev/null 2>&1; then echo "speech-helper runs — ./speech-helper --check for details" else status=$? if [ "$status" -eq 137 ]; then echo "built speech-helper, but killed on launch (137): request binary approval for" echo " $HERE/speech-helper" else echo "built speech-helper, but exited $status — run ./speech-helper --check to see why" fi fi if swiftc -O LLMHelper.swift -o llm-helper 2>/dev/null; then echo "built $HERE/llm-helper" if ./llm-helper --check >/dev/null 2>&1; then echo "llm-helper runs — ./llm-helper --check for details" fi else echo "could not build llm-helper with FoundationModels; fallback to Python MLX/PyObjC bridge will be available" fi