build.sh: produce smaller binaries (#72)

* don't include psiphon until we need it

* strip the binaries
This commit is contained in:
Simone Basso 2019-11-14 12:20:04 +01:00 committed by GitHub
parent bc1314ca61
commit e5248d632b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,11 +5,15 @@ if [ "$GOPATH" != "" ]; then
unset GOPATH
fi
buildtags="-tags nopsiphon"
ldflags="-s -w"
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/ooniprobe.exe -v ./cmd/ooniprobe
go build $buildtags -ldflags="$ldflags" \
-o dist/windows/amd64/ooniprobe.exe -v ./cmd/ooniprobe
elif [ "$1" = "linux" ]; then
set -x
@ -17,11 +21,13 @@ elif [ "$1" = "linux" ]; then
docker run -v `pwd`:/oonibuild -w /oonibuild -t --cap-drop=all \
--user `id -u`:`id -g` -e 'GOCACHE=/tmp/go/cache' -e 'GOPATH=/tmp/go/path' \
oonibuild \
go build -o dist/linux/amd64/ooniprobe -v ./cmd/ooniprobe
go build $buildtags -ldflags="$ldflags" \
-o dist/linux/amd64/ooniprobe -v ./cmd/ooniprobe
elif [ "$1" = "macos" ]; then
set -x
go build -o dist/macos/amd64/ooniprobe -v ./cmd/ooniprobe
go build $buildtags -ldflags="$ldflags" \
-o dist/macos/amd64/ooniprobe -v ./cmd/ooniprobe
elif [ "$1" = "release" ]; then
set -x