#!/bin/sh # build-bundle.sh — build the WhatsApp connector binaries for the Neuron app's bundled # connector-servers dir. Produces stripped native binaries (default darwin/arm64). # # whatsapp-mcp — the MCP server connectd spawns (@bin/whatsapp-mcp) # whatsapp-bridge — the whatsmeow sidecar that holds the paired session (@bin/whatsapp-bridge) # # Usage: scripts/build-bundle.sh [OUT_DIR] # OUT_DIR defaults to the neuron-ui bundled servers dir. The bridge uses go-sqlite3 (CGO), so # native builds need a C toolchain (present on macOS); cross-OS builds need a cross toolchain. set -eu ROOT=$(cd "$(dirname "$0")/.." && pwd) OUT="${1:-$HOME/Development/neuron-technologies/neuron-ui/resources/macos-arm64/neuron-connectd/servers}" GOOS="${GOOS:-darwin}" GOARCH="${GOARCH:-arm64}" mkdir -p "$OUT" echo "==> building whatsapp-mcp + whatsapp-bridge ($GOOS/$GOARCH, stripped) -> $OUT" ( cd "$ROOT/whatsapp-mcp-server" && \ CGO_ENABLED=1 GOOS="$GOOS" GOARCH="$GOARCH" go build -ldflags="-s -w" -o "$OUT/whatsapp-mcp" . ) ( cd "$ROOT/whatsapp-bridge" && \ CGO_ENABLED=1 GOOS="$GOOS" GOARCH="$GOARCH" go build -ldflags="-s -w" -o "$OUT/whatsapp-bridge" . ) chmod +x "$OUT/whatsapp-mcp" "$OUT/whatsapp-bridge" echo "==> done:" ls -lh "$OUT/whatsapp-mcp" "$OUT/whatsapp-bridge"