nim / rpms / golang

Forked from rpms/golang 5 years ago
Clone

Blame golang-1.5-bootstrap-binary-path.patch

8d165df
diff --git a/src/cmd/dist/buildtool.go b/src/cmd/dist/buildtool.go
8d165df
index be54ac4..6744fbdc 100644
8d165df
--- a/src/cmd/dist/buildtool.go
8d165df
+++ b/src/cmd/dist/buildtool.go
8d165df
@@ -108,12 +108,20 @@ func bootstrapBuildTools() {
8d165df
 	os.Setenv("GOBIN", "")
8d165df
 
8d165df
 	os.Setenv("GOOS", "")
8d165df
-	os.Setenv("GOHOSTOS", "")
8d165df
 	os.Setenv("GOARCH", "")
8d165df
+
8d165df
+	hostos := os.Getenv("GOHOSTOS")
8d165df
+	hostarch := os.Getenv("GOHOSTARCH")
8d165df
+	os.Setenv("GOHOSTOS", "")
8d165df
 	os.Setenv("GOHOSTARCH", "")
8d165df
 
8d165df
+	bingopath := pathf("%s/bin/%s_%s/go", goroot_bootstrap, hostos, hostarch)
8d165df
+	if _, err := os.Stat(bingopath); os.IsNotExist(err) {
8d165df
+		bingopath = pathf("%s/bin/go", goroot_bootstrap)
8d165df
+	}
8d165df
+
8d165df
 	// Run Go 1.4 to build binaries.
8d165df
-	run(workspace, ShowOutput|CheckExit, pathf("%s/bin/go", goroot_bootstrap), "install", "-v", "bootstrap/...")
8d165df
+	run(workspace, ShowOutput|CheckExit, bingopath, "install", "-v", "bootstrap/...")
8d165df
 
8d165df
 	// Copy binaries into tool binary directory.
8d165df
 	for _, name := range bootstrapDirs {
8d165df
diff --git a/src/make.bash b/src/make.bash
8d165df
index f17648a..77f463c 100755
8d165df
--- a/src/make.bash
8d165df
+++ b/src/make.bash
8d165df
@@ -113,12 +113,17 @@ echo '##### Building Go bootstrap tool.'
8d165df
 echo cmd/dist
8d165df
 export GOROOT="$(cd .. && pwd)"
8d165df
 GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:-$HOME/go1.4}
8d165df
-if [ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]; then
8d165df
-	echo "ERROR: Cannot find $GOROOT_BOOTSTRAP/bin/go." >&2
8d165df
+if [ -x "$GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go" ]; then
8d165df
+	rm -f cmd/dist/dist
8d165df
+	GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go" build -o cmd/dist/dist ./cmd/dist
8d165df
+elif [ -x "$GOROOT_BOOTSTRAP/bin/go" ]; then
8d165df
+	rm -f cmd/dist/dist
8d165df
+	GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
8d165df
+else
8d165df
+	echo "ERROR: Cannot find $GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go." >&2
8d165df
+	echo "ERROR: or $GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go." >&2
8d165df
 	echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2
8d165df
 fi
8d165df
-rm -f cmd/dist/dist
8d165df
-GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
8d165df
 
8d165df
 # -e doesn't propagate out of eval, so check success by hand.
8d165df
 eval $(./cmd/dist/dist env -p || echo FAIL=true)