blob: a07529e73356907d9b3b7484f7d3fa9c85fbbc42 [file] [log] [blame]
Brad Fitzpatrick3eed4222015-04-29 12:01:55 -07001#!/usr/bin/env bash
2# Copyright 2015 The Go Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style
4# license that can be found in the LICENSE file.
5
6# Usage: buildall.sh [-e] [pattern]
7#
8# buildall.bash builds the standard library for all Go-supported
Brad Fitzpatrick35748912015-04-29 15:08:49 -07009# architectures. It is used by the "all-compile" trybot builder,
10# as a smoke test to quickly flag portability issues.
Brad Fitzpatrick3eed4222015-04-29 12:01:55 -070011#
12# Options:
13# -e: stop at first failure
14
15if [ ! -f run.bash ]; then
16 echo 'buildall.bash must be run from $GOROOT/src' 1>&2
17 exit 1
18fi
19
20sete=false
21if [ "$1" = "-e" ]; then
22 sete=true
23 shift
24fi
25
26if [ "$sete" = true ]; then
27 set -e
28fi
29
30pattern="$1"
31if [ "$pattern" = "" ]; then
32 pattern=.
33fi
34
35# put linux, nacl first in the target list to get all the architectures up front.
Shenghou Ma965d00f82015-05-06 22:10:28 -040036targets="$((ls runtime | sed -n 's/^rt0_\(.*\)_\(.*\)\.s/\1-\2/p'; echo linux-386-387 linux-arm-arm5) | sort | egrep -v android-arm | egrep "$pattern" | egrep 'linux|nacl')
Brad Fitzpatrick3eed4222015-04-29 12:01:55 -070037$(ls runtime | sed -n 's/^rt0_\(.*\)_\(.*\)\.s/\1-\2/p' | egrep -v 'android-arm|darwin-arm' | egrep "$pattern" | egrep -v 'linux|nacl')"
38
39./make.bash
40GOROOT="$(cd .. && pwd)"
41
42failed=false
43for target in $targets
44do
45 echo ""
46 echo "### Building $target"
47 export GOOS=$(echo $target | sed 's/-.*//')
48 export GOARCH=$(echo $target | sed 's/.*-//')
Shenghou Ma965d00f82015-05-06 22:10:28 -040049 unset GO386 GOARM
50 if [ "$GOARCH" = "arm5" ]; then
51 export GOARCH=arm
52 export GOARM=5
53 fi
Brad Fitzpatrick3eed4222015-04-29 12:01:55 -070054 if [ "$GOARCH" = "387" ]; then
55 export GOARCH=386
56 export GO386=387
57 fi
Josh Bleecher Snyder9b66cf62015-04-29 16:10:23 -070058 if ! "$GOROOT/bin/go" build -a std cmd; then
Brad Fitzpatrick3eed4222015-04-29 12:01:55 -070059 failed=true
60 if $sete; then
61 exit 1
62 fi
63 fi
64done
65
66if [ "$failed" = "true" ]; then
67 echo "" 1>&2
68 echo "Build(s) failed." 1>&2
69 exit 1
70fi