aboutsummaryrefslogtreecommitdiff
path: root/src/make.bat
diff options
context:
space:
mode:
authorGiovanni Bajo <rasky@develer.com>2018-02-25 11:32:59 +0100
committerGiovanni Bajo <rasky@develer.com>2020-03-22 08:44:07 +0000
commit683c266f958db9acff705856f2c0aeb031d9782c (patch)
treea9232b88b672ffe1e7879fe452dcb729e90ee5a9 /src/make.bat
parent787e7b048cff392d1cb68c57c99ff71602997475 (diff)
downloadgo-683c266f958db9acff705856f2c0aeb031d9782c.tar.gz
go-683c266f958db9acff705856f2c0aeb031d9782c.zip
build: add default GOROOT_BOOTSTRAP in Windows
CL 57753 added support to make.bash and make.rc to default GOROOT_BOOTSTRAP to 'go env GOROOT'. This patch does the same in make.bat for Windows. Updates #18545 Fixes #28641 Change-Id: I9152cc5080ed219b4de5bad0bd12d7725422ee1a Reviewed-on: https://go-review.googlesource.com/c/go/+/96455 Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Diffstat (limited to 'src/make.bat')
-rw-r--r--src/make.bat20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/make.bat b/src/make.bat
index 5dbde85564..f7955ec88a 100644
--- a/src/make.bat
+++ b/src/make.bat
@@ -61,7 +61,8 @@ del /F ".\pkg\runtime\runtime_defs.go" 2>NUL
:: Set GOROOT for build.
cd ..
-set GOROOT=%CD%
+set GOROOT_TEMP=%CD%
+set GOROOT=
cd src
set vflag=
if x%1==x-v set vflag=-v
@@ -70,8 +71,25 @@ if x%3==x-v set vflag=-v
if x%4==x-v set vflag=-v
if not exist ..\bin\tool mkdir ..\bin\tool
+
+:: Calculating GOROOT_BOOTSTRAP
+if not "x%GOROOT_BOOTSTRAP%"=="x" goto bootstrapset
+for /f "tokens=*" %%g in ('where go 2^>nul') do (
+ if "x%GOROOT_BOOTSTRAP%"=="x" (
+ for /f "tokens=*" %%i in ('%%g env GOROOT 2^>nul') do (
+ if /I not %%i==%GOROOT_TEMP% (
+ set GOROOT_BOOTSTRAP=%%i
+ )
+ )
+ )
+)
if "x%GOROOT_BOOTSTRAP%"=="x" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\Go1.4
+
+:bootstrapset
if not exist "%GOROOT_BOOTSTRAP%\bin\go.exe" goto bootstrapfail
+set GOROOT=%GOROOT_TEMP%
+set GOROOT_TEMP=
+
echo Building Go cmd/dist using %GOROOT_BOOTSTRAP%
if x%vflag==x-v echo cmd/dist
setlocal