9992690f8f
* Gopkg.lock: use MK v0.10.3 * ooni: stop using legacy GeoIP database files * Some yak shaving of Makefile 1. remove now broken commands to download deps 2. also define the CXX cross compiler * chore(dep): migrate from dep to go 1.11+ modules See https://blog.callr.tech/migrating-from-dep-to-go-1.11-modules/ I need this to simplify my life in building for Travis. * Introduce build.sh and repair build In going forward, I believe we don't actually need a Makefile but I didn't want to make such a radical change now. * Another strategy wrt gopath * travis: run regress tests on macOS Closes #30
78 lines
2.1 KiB
Bash
Executable File
78 lines
2.1 KiB
Bash
Executable File
#!/bin/sh
|
|
set -e
|
|
|
|
if [ "$GOPATH" != "" ]; then
|
|
echo "$0: WARNING: unsetting GOPATH as we don't need it" 1>&2
|
|
unset GOPATH
|
|
fi
|
|
|
|
if [ "$1" = "windows" ]; then
|
|
set -x
|
|
CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ \
|
|
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 \
|
|
go build -o dist/windows/amd64/ooni.exe -v ./cmd/ooni
|
|
|
|
elif [ "$1" = "linux" ]; then
|
|
set -x
|
|
docker build -t oonibuild .
|
|
docker run -v `pwd`:/oonibuild -w /oonibuild -t oonibuild \
|
|
go build -o dist/linux/amd64/ooni -v ./cmd/ooni
|
|
|
|
elif [ "$1" = "macos" ]; then
|
|
set -x
|
|
go build -o dist/macos/amd64/ooni -v ./cmd/ooni
|
|
|
|
elif [ "$1" = "_travis-linux" ]; then
|
|
set -x
|
|
$0 linux
|
|
docker run -v `pwd`:/oonibuild -w /oonibuild -t oonibuild \
|
|
go test -v -coverprofile=ooni.cov ./...
|
|
|
|
elif [ "$1" = "_travis-osx" ]; then
|
|
set -x
|
|
brew tap measurement-kit/measurement-kit
|
|
brew update
|
|
brew upgrade
|
|
brew install measurement-kit
|
|
$0 macos
|
|
go test -v -coverprofile=ooni.cov ./...
|
|
|
|
elif [ "$1" = "help" ]; then
|
|
echo "Usage: $0 linux | macos | windows"
|
|
echo ""
|
|
echo "Builds OONI on supported systems. The output binary will"
|
|
echo "be saved at './dist/<system>/<arch>/ooni[.exe]'."
|
|
echo ""
|
|
echo "# Linux"
|
|
echo ""
|
|
echo "To compile for Linux we use a docker container with the binary"
|
|
echo "Measurement Kit dependency installed. So you need docker installed."
|
|
echo ""
|
|
echo "# macOS"
|
|
echo ""
|
|
echo "You must be on macOS. You must install Measurement Kit once using:"
|
|
echo ""
|
|
echo "- brew tap measurement-kit/measurement-kit"
|
|
echo "- brew install measurement-kit"
|
|
echo ""
|
|
echo "You should keep Measurement Kit up-to-date using:"
|
|
echo ""
|
|
echo "- brew upgrade"
|
|
echo ""
|
|
echo "# Windows"
|
|
echo ""
|
|
echo "You must be on macOS. You must install Measurement Kit once using:"
|
|
echo ""
|
|
echo "- brew tap measurement-kit/measurement-kit"
|
|
echo "- brew install mingw-w64-measurement-kit"
|
|
echo ""
|
|
echo "You should keep Measurement Kit up-to-date using:"
|
|
echo ""
|
|
echo "- brew upgrade"
|
|
echo ""
|
|
|
|
else
|
|
echo "Invalid usage; try '$0 help' for more help." 1>&2
|
|
exit 1
|
|
fi
|