]> Cypherpunks.ru repositories - gostls13.git/commitdiff
[dev.cc] build: fix cross-compilation
authorRuss Cox <rsc@golang.org>
Wed, 14 Jan 2015 16:50:21 +0000 (11:50 -0500)
committerRuss Cox <rsc@golang.org>
Wed, 14 Jan 2015 18:49:21 +0000 (18:49 +0000)
Fixes #9574.

Change-Id: Ifd7ecccb25e934f9aba284b2d72b6b22f18cb0b6
Reviewed-on: https://go-review.googlesource.com/2812
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/make.bash
src/make.bat
src/make.rc

index 54c4d61249ac90258fb3ee1971b611cd07d008d7..2b07ee7780f3cd3d96ddf15a8cc3881f4dac914d 100755 (executable)
@@ -121,7 +121,7 @@ if [ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]; then
        echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2
 fi
 rm -f cmd/dist/dist
-GOROOT="$GOROOT_BOOTSTRAP" "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
+GOROOT="$GOROOT_BOOTSTRAP" GOOS="$GOHOSTOS" GOARCH="$GOHOSTARCH" "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
 
 # -e doesn't propagate out of eval, so check success by hand.
 eval $(./cmd/dist/dist env -p || echo FAIL=true)
index 945c8cc5f9668757362bc01aa80fc47aa97d7610..62401b622d194c93fef3c16aaa789bea0ecc79c1 100644 (file)
@@ -45,16 +45,10 @@ goto fail
 :: Clean old generated file that will cause problems in the build.
 del /F ".\pkg\runtime\runtime_defs.go" 2>NUL
 
-:: Grab default GOROOT_FINAL and set GOROOT for build.
-:: The expression %VAR:\=\\% means to take %VAR%
-:: and apply the substitution \ = \\, escaping the
-:: backslashes.  Then we wrap that in quotes to create
-:: a C string.
+:: Set GOROOT for build.
 cd ..
 set GOROOT=%CD%
 cd src
-if "x%GOROOT_FINAL%"=="x" set GOROOT_FINAL=%GOROOT%
-set DEFGOROOT=-DGOROOT_FINAL="\"%GOROOT_FINAL:\=\\%\""
 
 echo ##### Building Go bootstrap tool.
 echo cmd/dist
@@ -63,6 +57,8 @@ if "x%GOROOT_BOOTSTRAP%"=="x" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\Go1.4
 if not exist "%GOROOT_BOOTSTRAP%\bin\go.exe" goto bootstrapfail
 setlocal
 set GOROOT=%GOROOT_BOOTSTRAP%
+set GOOS=%GOHOSTOS%
+set GOARCH=%GOHOSTARCH%
 "%GOROOT_BOOTSTRAP%\bin\go" build -o cmd\dist\dist.exe .\cmd\dist
 endlocal
 if errorlevel 1 goto fail
index 2d2076297e5848c6e2cbfa1a55fa32d9ff9c79e0..761b93e99539a6e2e89d2f0bc2e9977e66ef2f33 100755 (executable)
@@ -58,7 +58,7 @@ if(! test -x $GOROOT_BOOTSTRAP/bin/go){
        exit bootstrap
 }
 rm -f cmd/dist/dist
-GOROOT=$GOROOT_BOOTSTRAP $GOROOT_BOOTSTRAP/bin/go build -o cmd/dist/dist ./cmd/dist
+GOROOT=$GOROOT_BOOTSTRAP GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH $GOROOT_BOOTSTRAP/bin/go build -o cmd/dist/dist ./cmd/dist
 
 eval `{./cmd/dist/dist env -9}
 echo