#!/bin/bash set -e echo "=== BLE Relay Build Script ===" echo "" # Check Python if ! command -v python3 &> /dev/null && ! command -v python &> /dev/null; then echo "ERROR: Python not found. Please install Python 3." exit 1 fi PYTHON=$(command -v python3 || command -v python) # Install dependencies echo "Installing dependencies..." $PYTHON -m pip install pyinstaller bleak # Create output directory mkdir -p bin # Build echo "" echo "Building ble_relay..." $PYTHON -m PyInstaller --onefile --name ble_relay --distpath bin --specpath build --workpath build scripts/ble_relay.py # Copy to cmd/monitor for go:embed echo "" echo "Copying to cmd/monitor/ for embedding..." cp bin/ble_relay cmd/monitor/ble_relay echo "" echo "=== Build complete ===" echo " bin/ble_relay" echo " cmd/monitor/ble_relay" echo "" echo "Now run: go build -tags ble -o bin/opencode-monitor ./cmd/monitor"