2016-11-03 18:09:50 -06:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Usage: buildall [-e] [-nocmp] [-work]
|
|
|
|
#
|
|
|
|
# Builds everything (std) for every GOOS/GOARCH combination but installs nothing.
|
|
|
|
#
|
|
|
|
# By default, runs the builds with -toolexec 'toolstash -cmp', to test that the
|
|
|
|
# toolchain is producing bit identical output to a previous known good toolchain.
|
|
|
|
#
|
|
|
|
# Options:
|
|
|
|
# -e: stop at first failure
|
|
|
|
# -nocmp: turn off toolstash -cmp; just check that ordinary builds succeed
|
|
|
|
# -work: pass -work to go command
|
|
|
|
|
|
|
|
sete=false
|
|
|
|
if [ "$1" = "-e" ]; then
|
|
|
|
sete=true
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
|
|
|
|
cmp=true
|
|
|
|
if [ "$1" = "-nocmp" ]; then
|
|
|
|
cmp=false
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
|
|
|
|
work=""
|
|
|
|
if [ "$1" = "-work" ]; then
|
|
|
|
work="-work"
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd $(go env GOROOT)/src
|
|
|
|
go install cmd/compile cmd/link cmd/asm || exit 1
|
|
|
|
pattern="$1"
|
|
|
|
if [ "$pattern" = "" ]; then
|
|
|
|
pattern=.
|
|
|
|
fi
|
|
|
|
|
2017-03-18 23:44:30 -06:00
|
|
|
targets="$(go tool dist list; echo linux/386/387)"
|
|
|
|
targets="$(echo "$targets" | tr '/' '-' | sort | egrep "$pattern" | egrep -v 'android-arm|darwin-arm')"
|
|
|
|
|
2016-11-03 18:09:50 -06:00
|
|
|
# put linux, nacl first in the target list to get all the architectures up front.
|
2017-03-18 23:44:30 -06:00
|
|
|
targets="$(echo "$targets" | egrep 'linux|nacl') $(echo "$targets" | egrep -v 'linux|nacl')"
|
|
|
|
|
2016-11-03 18:09:50 -06:00
|
|
|
if [ "$sete" = true ]; then
|
|
|
|
set -e
|
|
|
|
fi
|
|
|
|
for target in $targets
|
|
|
|
do
|
|
|
|
echo $target
|
|
|
|
export GOOS=$(echo $target | sed 's/-.*//')
|
|
|
|
export GOARCH=$(echo $target | sed 's/.*-//')
|
|
|
|
unset GO386
|
|
|
|
if [ "$GOARCH" = "387" ]; then
|
|
|
|
export GOARCH=386
|
|
|
|
export GO386=387
|
|
|
|
fi
|
|
|
|
if $cmp; then
|
2017-04-05 09:09:19 -06:00
|
|
|
if [ "$GOOS" = "android" ]; then
|
|
|
|
go build $work -a -toolexec 'toolstash -cmp' std
|
|
|
|
else
|
|
|
|
go build $work -a -toolexec 'toolstash -cmp' std cmd
|
|
|
|
fi
|
2016-11-03 18:09:50 -06:00
|
|
|
else
|
|
|
|
go build $work -a std
|
|
|
|
fi
|
|
|
|
done
|