diff --git a/build-syncthing.sh b/build-syncthing.sh index 7998bcb1..79ea364c 100755 --- a/build-syncthing.sh +++ b/build-syncthing.sh @@ -9,29 +9,27 @@ if [ ! -f "ext/syncthing/src/github.com/syncthing/syncthing/.git" ]; then git submodule update --init --recursive fi -# Check for GOLANG installation -if [ -z $GOROOT ]; then - mkdir -p "build" - tmpgo='build/go' - if [ ! -f "$tmpgo/bin/go" ]; then - # Download GOLANG v1.3 - wget -O go.src.tar.gz https://golang.org/dl/go1.3.src.tar.gz - sha1=$(sha1sum go.src.tar.gz) - if [ "$sha1" != "9f9dfcbcb4fa126b2b66c0830dc733215f2f056e go.src.tar.gz" ]; then - echo "go.src.tar.gz SHA1 checksum does not match!" - exit 1 - fi - mkdir -p $tmpgo - tar -xzf go.src.tar.gz --strip=1 -C $tmpgo - rm go.src.tar.gz - # Build GO for host - pushd $tmpgo/src - ./make.bash --no-clean - popd +# Use own Go instance, installing it if missing. +mkdir -p "build" +tmpgo='build/go' +if [ ! -f "$tmpgo/bin/go" ]; then + # Download GOLANG v1.3.3 + wget -O go.src.tar.gz https://golang.org/dl/go1.3.3.src.tar.gz + sha1=$(sha1sum go.src.tar.gz) + if [ "$sha1" != "b54b7deb7b7afe9f5d9a3f5dd830c7dede35393a go.src.tar.gz" ]; then + echo "go.src.tar.gz SHA1 checksum does not match!" + exit 1 fi - # Add GO to the environment - export GOROOT="$(pwd)/$tmpgo" + mkdir -p $tmpgo + tar -xzf go.src.tar.gz --strip=1 -C $tmpgo + rm go.src.tar.gz + # Build GO for host + pushd $tmpgo/src + ./make.bash --no-clean + popd fi +# Add GO to the environment +export GOROOT="$(pwd)/$tmpgo" # Add GO compiler to PATH export PATH=$PATH:$GOROOT/bin