chore: sync from fn-registry agent
This commit is contained in:
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
# Cross-compile device_agent para 4 targets. CGO-free (modernc.org/sqlite).
|
||||
# Output: build/<goos>-<goarch>/device_agent[.exe]
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
mkdir -p build
|
||||
|
||||
TARGETS=(
|
||||
"linux/amd64"
|
||||
"linux/arm64"
|
||||
"windows/amd64"
|
||||
"darwin/arm64"
|
||||
)
|
||||
|
||||
for tgt in "${TARGETS[@]}"; do
|
||||
GOOS=${tgt%/*}
|
||||
GOARCH=${tgt#*/}
|
||||
EXT=""
|
||||
[ "$GOOS" = "windows" ] && EXT=".exe"
|
||||
OUT="build/$GOOS-$GOARCH/device_agent$EXT"
|
||||
mkdir -p "build/$GOOS-$GOARCH"
|
||||
echo "==> Building $tgt -> $OUT"
|
||||
CGO_ENABLED=0 GOOS="$GOOS" GOARCH="$GOARCH" \
|
||||
go build -ldflags="-s -w" -o "$OUT" .
|
||||
ls -la "$OUT"
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "All targets built OK."
|
||||
Reference in New Issue
Block a user