aboutsummaryrefslogtreecommitdiff
path: root/build-arm64-go.sh
blob: 4def18754ff95f512c198e1d91bc88242c1f980c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash

set -eu

: ${LAVA_USE_PREBUILT_BOOTSTRAP_COMPILER:="no"}

if [ "${LAVA_USE_PREBUILT_BOOTSTRAP_COMPILER}" = "yes" ]; then
    : ${LAVA_URL_PREBUILT_BOOTSTRAP_COMPILER:?"No URL for bootstrap compiler"}
    echo "Using existing boostrap compiler from: ${LAVA_URL_PREBUILT_BOOTSTRAP_COMPILER}"
    wget -q -O go1.4.tar.bz2 ${LAVA_URL_PREBUILT_BOOTSTRAP_COMPILER}
    rm -rf go1.4
    tar xf go1.4.tar.bz2
else
    basedir=$PWD
    echo "Building bootstrap compiler"
    rm -rf go1.4
    git clone http://github.com/golang/go go1.4
    pushd go1.4
    git checkout 36f456c789da341df496f161672df618b7410d58
    git checkout 36f456c789da341df496f161672df618b7410d58
    git apply $basedir/dist7.patch
    pushd src
    CC='arm-linux-gnueabihf-gcc -static' GO_DISTFLAGS=-s GOHOSTARCH=arm GOARM=7 CGO_ENABLED=0 ./make.bash
    popd
    popd
fi

rm -rf go
git clone --depth=1 http://github.com/4ad/go

export GOROOT_BOOTSTRAP=$PWD/go1.4
export GOROOT_FINAL=/usr/local/go

pushd $PWD
cd go/src && ./all.bash
popd

tar -acf go.tar.gz go/{bin,src,test,api,pkg}
tar -C /usr/local -axf go.tar.gz && /usr/local/go/bin/go env