|
| 1 | +#!/bin/bash |
| 2 | +# |
| 3 | +# Contains the Go tool-chain pure-Go bootstrapper, that as of Go 1.5, initiates |
| 4 | +# not only a few pre-built Go cross compilers, but rather bootstraps all of the |
| 5 | +# supported platforms from the origin Linux amd64 distribution. |
| 6 | +# |
| 7 | +# Usage: bootstrap.sh |
| 8 | +# |
| 9 | +# Needed environment variables: |
| 10 | +# FETCH - Remote file fetcher and checksum verifier (injected by image) |
| 11 | +# ROOT_DIST - 64 bit Linux Go binary distribution package |
| 12 | +# ROOT_DIST_SHA1 - 64 bit Linux Go distribution package checksum |
| 13 | +set -e |
| 14 | + |
| 15 | +# Download, verify and install the root distribution |
| 16 | +$FETCH $ROOT_DIST $ROOT_DIST_SHA1 |
| 17 | + |
| 18 | +tar -C /usr/local -xzf `basename $ROOT_DIST` |
| 19 | +rm -f `basename $ROOT_DIST` |
| 20 | + |
| 21 | +export GOROOT=/usr/local/go |
| 22 | +export GOROOT_BOOTSTRAP=$GOROOT |
| 23 | + |
| 24 | +# Pre-build all guest distributions based on the root distribution |
| 25 | +echo "Bootstrapping linux/386..." |
| 26 | +GOOS=linux GOARCH=386 CGO_ENABLED=1 go install std |
| 27 | + |
| 28 | +echo "Bootstrapping linux/arm..." |
| 29 | +GOOS=linux GOARCH=arm CGO_ENABLED=1 CC=arm-linux-gnueabi-gcc go install std |
| 30 | + |
| 31 | +echo "Bootstrapping windows/amd64..." |
| 32 | +GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc go install std |
| 33 | + |
| 34 | +echo "Bootstrapping windows/386..." |
| 35 | +GOOS=windows GOARCH=386 CGO_ENABLED=1 CC=i686-w64-mingw32-gcc go install std |
| 36 | + |
| 37 | +echo "Bootstrapping darwin/amd64..." |
| 38 | +GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 CC=o64-clang go install std |
| 39 | + |
| 40 | +echo "Bootstrapping darwin/386..." |
| 41 | +GOOS=darwin GOARCH=386 CGO_ENABLED=1 CC=o32-clang go install std |
0 commit comments