ooni-probe-cli/CLI/linux/build

16 lines
497 B
Plaintext
Raw Normal View History

#!/bin/sh
# This script is executed by `./make` when building inside
# an Alpine Linux docker container. Using Alpine Linux, which
# uses musl libc, allows us to emit static binaries.
set -e
if [ "$GOARCH" = "" ]; then
echo 'fatal: $GOARCH is not set' 1>&2
exit 1
fi
set -x
apk update
apk upgrade
apk add --no-progress gcc git linux-headers musl-dev
CGO_ENABLED=1 GOOS=linux GOARCH=$GOARCH go build -o ./CLI/linux/$GOARCH/ \
-ldflags='-s -w -extldflags "-static"' "$@" ./cmd/ooniprobe