diff options
author | Wei Congrui <crvv.mail@gmail.com> | 2017-08-22 13:36:19 +0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2017-08-25 05:36:27 +0000 |
commit | a164a2f5357ed5635cbda1fd4e8dacb835248cd0 (patch) | |
tree | a2ac3f98a85c2731e17736deeb9d09283ad0f079 /src/make.rc | |
parent | 3d62000adcec9b6e4a2d7ca89020f3bf68ece2ef (diff) | |
download | go-a164a2f5357ed5635cbda1fd4e8dacb835248cd0.tar.gz go-a164a2f5357ed5635cbda1fd4e8dacb835248cd0.zip |
build: add `go env GOROOT` as default GOROOT_BOOTSTRAP value
This change also added the same check in make.bash to make.rc,
which makes sure $GOROOT_BOOTSTRAP != $GOROOT.
Fixes #14339
Change-Id: I2758f4a845bae42ace02492fc6a911f6d6247d26
Reviewed-on: https://go-review.googlesource.com/57753
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/make.rc')
-rwxr-xr-x | src/make.rc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/make.rc b/src/make.rc index ba3554cd76..604e4a89c9 100755 --- a/src/make.rc +++ b/src/make.rc @@ -46,11 +46,26 @@ echo cmd/dist GOROOT = `{cd .. && pwd} if(! ~ $#GOROOT_BOOTSTRAP 1) GOROOT_BOOTSTRAP = $home/go1.4 +for(p in $path){ + if(! test -x $GOROOT_BOOTSTRAP/bin/go){ + if(go_exe = `{path=$p whatis go}){ + goroot = `{GOROOT='' $go_exe env GOROOT} + if(! ~ $goroot $GOROOT){ + GOROOT_BOOTSTRAP = $goroot + } + } + } +} if(! test -x $GOROOT_BOOTSTRAP/bin/go){ echo 'ERROR: Cannot find '$GOROOT_BOOTSTRAP'/bin/go.' >[1=2] echo 'Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4.' >[1=2] exit bootstrap } +if(~ $GOROOT_BOOTSTRAP $GOROOT){ + echo 'ERROR: $GOROOT_BOOTSTRAP must not be set to $GOROOT' >[1=2] + echo 'Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4.' >[1=2] + exit bootstrap +} rm -f cmd/dist/dist GOROOT=$GOROOT_BOOTSTRAP GOOS='' GOARCH='' $GOROOT_BOOTSTRAP/bin/go build -o cmd/dist/dist ./cmd/dist |