2026-04-20 13:30:37 -06:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
2026-06-10 19:29:51 -04:00
|
|
|
SIDECARS=(buzz-acp buzz-agent buzz-dev-mcp git-credential-nostr buzz)
|
2026-06-09 11:52:41 -04:00
|
|
|
HOST=$(rustc -vV | sed -n 's|host: ||p')
|
|
|
|
|
TARGET=${1:-$HOST}
|
2026-08-02 14:39:27 -04:00
|
|
|
if [[ "$TARGET" != *windows* ]]; then
|
|
|
|
|
SIDECARS+=(buzz-backend-kubernetes)
|
|
|
|
|
BUILD_HINT="cargo build --release -p buzz-acp -p buzz-agent -p buzz-backend-kubernetes -p buzz-dev-mcp -p git-credential-nostr -p buzz-cli"
|
|
|
|
|
else
|
|
|
|
|
BUILD_HINT="cargo build --release -p buzz-acp -p buzz-agent -p buzz-dev-mcp -p git-credential-nostr -p buzz-cli"
|
|
|
|
|
fi
|
2026-04-20 13:30:37 -06:00
|
|
|
BINARIES_DIR="desktop/src-tauri/binaries"
|
|
|
|
|
|
2026-06-12 22:12:12 -04:00
|
|
|
# When --target is passed explicitly to cargo (even if it matches the host),
|
|
|
|
|
# binaries land in target/<triple>/release/. Without --target, they land in
|
|
|
|
|
# target/release/. The script receives the target as $1 only when cargo was
|
|
|
|
|
# invoked with --target, so use the qualified path whenever $1 is set.
|
|
|
|
|
if [[ -n "${1:-}" ]]; then
|
2026-06-09 11:52:41 -04:00
|
|
|
SRC_DIR="target/${TARGET}/release"
|
2026-06-12 22:12:12 -04:00
|
|
|
else
|
|
|
|
|
SRC_DIR="target/release"
|
2026-06-09 11:52:41 -04:00
|
|
|
fi
|
|
|
|
|
|
2026-06-12 14:50:03 -04:00
|
|
|
# MSVC emits <name>.exe; Tauri's externalBin then expects binaries/<name>-<triple>.exe.
|
|
|
|
|
if [[ "$TARGET" == *windows* ]]; then
|
|
|
|
|
EXE=".exe"
|
|
|
|
|
else
|
|
|
|
|
EXE=""
|
|
|
|
|
fi
|
|
|
|
|
|
2026-04-20 13:30:37 -06:00
|
|
|
missing=()
|
|
|
|
|
for bin in "${SIDECARS[@]}"; do
|
2026-06-12 14:50:03 -04:00
|
|
|
[[ -f "$SRC_DIR/${bin}${EXE}" ]] || missing+=("${bin}${EXE}")
|
2026-04-20 13:30:37 -06:00
|
|
|
done
|
|
|
|
|
if [[ ${#missing[@]} -gt 0 ]]; then
|
2026-06-09 11:52:41 -04:00
|
|
|
echo "Error: missing release binaries in $SRC_DIR: ${missing[*]}" >&2
|
2026-08-02 14:39:27 -04:00
|
|
|
echo "Run '$BUILD_HINT' first." >&2
|
2026-04-20 13:30:37 -06:00
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
mkdir -p "$BINARIES_DIR"
|
|
|
|
|
for bin in "${SIDECARS[@]}"; do
|
2026-07-26 12:13:51 +10:00
|
|
|
destination="$BINARIES_DIR/${bin}-${TARGET}${EXE}"
|
|
|
|
|
cp "$SRC_DIR/${bin}${EXE}" "$destination"
|
|
|
|
|
|
|
|
|
|
# cp preserves the mode of an existing destination on macOS. Generated
|
|
|
|
|
# sidecar placeholders may not be executable, so make the bundled Unix
|
|
|
|
|
# binaries executable explicitly.
|
|
|
|
|
if [[ -z "$EXE" ]]; then
|
|
|
|
|
chmod 755 "$destination"
|
|
|
|
|
fi
|
2026-04-20 13:30:37 -06:00
|
|
|
done
|
|
|
|
|
echo "Sidecars bundled for $TARGET"
|