aboutsummaryrefslogtreecommitdiff
path: root/crossbuild.bash
blob: 43bfd32cfec22383f27c4201a2ddee6d3d5bf8fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash -eu
#
# Build on all supported architectures & operating systems

cd "$(dirname "$0")"

export GO111MODULE=on
# Discard resulting binary by writing to /dev/null
B="go build -tags without_openssl -o /dev/null"

set -x

export CGO_ENABLED=0

GOOS=linux  GOARCH=amd64         $B

# See https://github.com/golang/go/wiki/GoArm
GOOS=linux  GOARCH=arm   GOARM=7 $B
GOOS=linux  GOARCH=arm64         $B

# MacOS on Intel
GOOS=darwin GOARCH=amd64 $B

# MacOS on Apple Silicon M1.
# Go 1.16 added support for the M1 and added ios/arm64,
# so we use this to check if we should attempt a build.
if go tool dist list | grep ios/arm64 ; then
	GOOS=darwin GOARCH=arm64 $B
fi