hughesjr / rpms / golang

Forked from rpms/golang 5 years ago
Clone
Blob Blame History Raw
diff -up go/src/cmd/dist/buildtool.go.boot go/src/cmd/dist/buildtool.go
--- go/src/cmd/dist/buildtool.go.boot	2016-02-17 21:35:20.000000000 +0100
+++ go/src/cmd/dist/buildtool.go	2016-03-31 13:24:43.430883930 +0200
@@ -106,12 +106,20 @@ func bootstrapBuildTools() {
 	os.Setenv("GOBIN", "")
 
 	os.Setenv("GOOS", "")
-	os.Setenv("GOHOSTOS", "")
 	os.Setenv("GOARCH", "")
+
+	hostos := os.Getenv("GOHOSTOS")
+	hostarch := os.Getenv("GOHOSTARCH")
+	os.Setenv("GOHOSTOS", "")
 	os.Setenv("GOHOSTARCH", "")
 
+	bingopath := pathf("%s/bin/%s_%s/go", goroot_bootstrap, hostos, hostarch)
+	if _, err := os.Stat(bingopath); os.IsNotExist(err) {
+		bingopath = pathf("%s/bin/go", goroot_bootstrap)
+	}
+
 	// Run Go 1.4 to build binaries.
-	run(workspace, ShowOutput|CheckExit, pathf("%s/bin/go", goroot_bootstrap), "install", "-v", "bootstrap/...")
+	run(workspace, ShowOutput|CheckExit, bingopath, "install", "-v", "bootstrap/...")
 
 	// Copy binaries into tool binary directory.
 	for _, name := range bootstrapDirs {
diff -up go/src/make.bash.boot go/src/make.bash
--- go/src/make.bash.boot	2016-03-31 13:24:43.419883892 +0200
+++ go/src/make.bash	2016-03-31 13:33:43.223741348 +0200
@@ -112,8 +112,15 @@ echo '##### Building Go bootstrap tool.'
 echo cmd/dist
 export GOROOT="$(cd .. && pwd)"
 GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:-$HOME/go1.4}
-if [ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]; then
-	echo "ERROR: Cannot find $GOROOT_BOOTSTRAP/bin/go." >&2
+if [ -x "$GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go" ]; then
+	rm -f cmd/dist/dist
+	GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go" build -o cmd/dist/dist ./cmd/dist
+elif [ -x "$GOROOT_BOOTSTRAP/bin/go" ]; then
+	rm -f cmd/dist/dist
+	GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
+else
+	echo "ERROR: Cannot find $GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go." >&2
+	echo "ERROR: or $GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go." >&2
 	echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2
 	exit 1
 fi
@@ -122,8 +129,6 @@ if [ "$GOROOT_BOOTSTRAP" == "$GOROOT" ];
 	echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2
 	exit 1
 fi
-rm -f cmd/dist/dist
-GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$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)