GoPLS Viewer

Home|gopls/cmd/toolstash/buildall
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
15sete=false
16if [ "$1" = "-e" ]; then
17    sete=true
18    shift
19fi
20
21cmp=true
22if [ "$1" = "-nocmp" ]; then
23    cmp=false
24    shift
25fi
26
27work=""
28if [ "$1" = "-work" ]; then
29    work="-work"
30    shift
31fi
32
33cd $(go env GOROOT)/src
34go install cmd/compile cmd/link cmd/asm || exit 1
35pattern="$1"
36if [ "$pattern" = "" ]; then
37    pattern=.
38fi
39
40targets="$(go tool dist list; echo linux/386/softfloat)"
41targets="$(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.
44targets="$(echo "$targets" | grep -E 'linux') $(echo "$targets" | grep -E -v 'linux')"
45
46if [ "$sete" = true ]; then
47    set -e
48fi
49for target in $targets
50do
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
68done
69
MembersX
Members
X