b2209bb637
This pull request fixes https://github.com/ooni/probe/issues/1471. We have replaced the original build script (`./make`) with the `./mk` makefile (executable using `#!/usr/bin/make -f`). We concluded supporting direct builds from Windows is not worth the effort and halving the code we need to maintain is probably a good plus. Both macOS and Linux install GNU make at `/usr/bin/make`, so we should be okay in the common use cases. I significantly simplified the management of Go versioning by requiring the user to manage it and by enforcing that we are using the desired Go version. This speeds up builds and works in sane operating systems that use the last version of a specific package. Otherwise, it's possible to use the `go get golang.org/dl/go${version}` feature. The remaining question mark was related to updating the Android SDK. I have determined that a good course of action is pinning to the latest CLI tools and always forcing the CLI tools to install the latest required packages (e.g., the NDK).
19 lines
527 B
Bash
Executable File
19 lines
527 B
Bash
Executable File
#!/bin/sh
|
|
# This script is executed by `./mk` 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
|
|
export GOPATH=$GOPATH
|
|
export CGO_ENABLED=1
|
|
export GOOS=linux
|
|
export GOARCH=$GOARCH
|
|
go build -o "./CLI/linux/$GOARCH/" -ldflags='-s -w -extldflags "-static"' "$@" ./cmd/ooniprobe
|