build_ble_relay.sh 897 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash
  2. set -e
  3. echo "=== BLE Relay Build Script ==="
  4. echo ""
  5. # Check Python
  6. if ! command -v python3 &> /dev/null && ! command -v python &> /dev/null; then
  7. echo "ERROR: Python not found. Please install Python 3."
  8. exit 1
  9. fi
  10. PYTHON=$(command -v python3 || command -v python)
  11. # Install dependencies
  12. echo "Installing dependencies..."
  13. $PYTHON -m pip install pyinstaller bleak
  14. # Create output directory
  15. mkdir -p bin
  16. # Build
  17. echo ""
  18. echo "Building ble_relay..."
  19. $PYTHON -m PyInstaller --onefile --name ble_relay --distpath bin --specpath build --workpath build scripts/ble_relay.py
  20. # Copy to cmd/monitor for go:embed
  21. echo ""
  22. echo "Copying to cmd/monitor/ for embedding..."
  23. cp bin/ble_relay cmd/monitor/ble_relay
  24. echo ""
  25. echo "=== Build complete ==="
  26. echo " bin/ble_relay"
  27. echo " cmd/monitor/ble_relay"
  28. echo ""
  29. echo "Now run: go build -tags ble -o bin/opencode-monitor ./cmd/monitor"