ooni-probe-cli/CLI/linux/build
Simone Basso c258a0fedd
CLI, debian, make: misc cleanup and changes (#336)
This PR	groups misc cleanup and changes from https://github.com/ooni/probe-cli/pull/331.

* CLI/linux/build: add documentation

* debian/.gitignore: ignore generated files

* debian/TODO: unnecessary at this point

* debian/ooniprobe-cli.service: remove commented out lines

* debian/rules: remove unnecessary actions

* make: reindent and fix spelling

* smoketest.sh: don't run in verbose mode

Part of https://github.com/ooni/probe/issues/1466
2021-05-06 21:20:45 +02:00

16 lines
497 B
Bash
Executable File

#!/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