hsa-app/scripts/build.sh

14 lines
573 B
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
# Build the hsa binary into the repo root.
#
# CGO_ENABLED=0 makes a fully static binary (the SQLite driver is pure Go, so no
# C toolchain is needed): it runs on any linux/<arch> — glibc or musl/Alpine,
# scratch containers, etc. — with no shared-library dependencies.
# Cross-compile for another arch by setting GOARCH, e.g.:
# GOARCH=arm64 ./scripts/build.sh
set -euo pipefail
cd "$(dirname "$0")/.."
source scripts/go-env.sh
CGO_ENABLED=0 go build -ldflags "-s -w" -o hsa ./cmd/hsa
echo "Built ./hsa ($(go env GOOS)/$(go env GOARCH), static)"