1 | #!/bin/bash |
---|---|
2 | |
3 | # Usage: buildall [-e] [-nocmp] [-work] |
4 | # |
5 | # Builds everything (std) for every GOOS/GOARCH combination but installs nothing. |
6 | # |
7 | # By default, runs the builds with -toolexec 'toolstash -cmp', to test that the |
8 | # toolchain is producing bit identical output to a previous known good toolchain. |
9 | # |
10 | # Options: |
11 | # -e: stop at first failure |
12 | # -nocmp: turn off toolstash -cmp; just check that ordinary builds succeed |
13 | # -work: pass -work to go command |
14 | |
15 | sete=false |
16 | if [ "$1" = "-e" ]; then |
17 | sete=true |
18 | shift |
19 | fi |
20 | |
21 | cmp=true |
22 | if [ "$1" = "-nocmp" ]; then |
23 | cmp=false |
24 | shift |
25 | fi |
26 | |
27 | work="" |
28 | if [ "$1" = "-work" ]; then |
29 | work="-work" |
30 | shift |
31 | fi |
32 | |
33 | cd $(go env GOROOT)/src |
34 | go install cmd/compile cmd/link cmd/asm || exit 1 |
35 | pattern="$1" |
36 | if [ "$pattern" = "" ]; then |
37 | pattern=. |
38 | fi |
39 | |
40 | targets="$(go tool dist list; echo linux/386/softfloat)" |
41 | targets="$(echo "$targets" | tr '/' '-' | sort | grep -E "$pattern" | grep -E -v 'android-arm|darwin-arm')" |
42 | |
43 | # put linux first in the target list to get all the architectures up front. |
44 | targets="$(echo "$targets" | grep -E 'linux') $(echo "$targets" | grep -E -v 'linux')" |
45 | |
46 | if [ "$sete" = true ]; then |
47 | set -e |
48 | fi |
49 | for target in $targets |
50 | do |
51 | echo $target |
52 | export GOOS=$(echo $target | sed 's/-.*//') |
53 | export GOARCH=$(echo $target | sed 's/.*-//') |
54 | unset GO386 |
55 | if [ "$GOARCH" = "softfloat" ]; then |
56 | export GOARCH=386 |
57 | export GO386=softfloat |
58 | fi |
59 | if $cmp; then |
60 | if [ "$GOOS" = "android" ]; then |
61 | go build $work -a -toolexec 'toolstash -cmp' std |
62 | else |
63 | go build $work -a -toolexec 'toolstash -cmp' std cmd |
64 | fi |
65 | else |
66 | go build $work -a std |
67 | fi |
68 | done |
69 |
Members