pgreco / rpms / golang

Forked from rpms/golang 5 years ago
Clone

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

de0c58
diff -up go/src/cmd/dist/buildtool.go.bootstrap go/src/cmd/dist/buildtool.go
864f2d
--- go/src/cmd/dist/buildtool.go.bootstrap	2017-07-11 12:05:00.041373419 +0200
864f2d
+++ go/src/cmd/dist/buildtool.go	2017-07-11 12:07:27.141775914 +0200
864f2d
@@ -153,18 +153,26 @@ func bootstrapBuildTools() {
de0c58
 	defer os.Setenv("GOBIN", os.Getenv("GOBIN"))
e1de19
 	os.Setenv("GOBIN", "")
e1de19
 
864f2d
+    hostos := os.Getenv("GOHOSTOS")
864f2d
+    hostarch := os.Getenv("GOHOSTARCH")
de0c58
+
de0c58
 	os.Setenv("GOOS", "")
de0c58
 	os.Setenv("GOHOSTOS", "")
de0c58
 	os.Setenv("GOARCH", "")
e1de19
 	os.Setenv("GOHOSTARCH", "")
e1de19
 
864f2d
+    bingopath := pathf("%s/bin/%s_%s/go", goroot_bootstrap, hostos, hostarch)
864f2d
+    if _, err := os.Stat(bingopath); os.IsNotExist(err) {
864f2d
+       bingopath = pathf("%s/bin/go", goroot_bootstrap)
864f2d
+    }
e1de19
+
de0c58
 	// Run Go 1.4 to build binaries. Use -gcflags=-l to disable inlining to
de0c58
 	// workaround bugs in Go 1.4's compiler. See discussion thread:
de0c58
 	// https://groups.google.com/d/msg/golang-dev/Ss7mCKsvk8w/Gsq7VYI0AwAJ
de0c58
 	// Use the math_big_pure_go build tag to disable the assembly in math/big
de0c58
 	// which may contain unsupported instructions.
864f2d
 	cmd := []string{
864f2d
-		pathf("%s/bin/go", goroot_bootstrap),
864f2d
+		bingopath,
864f2d
 		"install",
864f2d
 		"-gcflags=-l",
864f2d
 		"-tags=math_big_pure_go",
de0c58
diff -up go/src/make.bash.bootstrap go/src/make.bash
864f2d
--- go/src/make.bash.bootstrap	2017-07-11 12:05:00.036373439 +0200
864f2d
+++ go/src/make.bash	2017-07-11 12:05:00.041373419 +0200
de0c58
@@ -120,8 +120,15 @@ echo '##### Building Go bootstrap tool.'
e1de19
 echo cmd/dist
e1de19
 export GOROOT="$(cd .. && pwd)"
e1de19
 GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:-$HOME/go1.4}
e1de19
-if [ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]; then
e1de19
-	echo "ERROR: Cannot find $GOROOT_BOOTSTRAP/bin/go." >&2
e1de19
+if [ -x "$GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go" ]; then
e1de19
+	rm -f cmd/dist/dist
e1de19
+	GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go" build -o cmd/dist/dist ./cmd/dist
e1de19
+elif [ -x "$GOROOT_BOOTSTRAP/bin/go" ]; then
e1de19
+	rm -f cmd/dist/dist
e1de19
+	GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
e1de19
+else
e1de19
+	echo "ERROR: Cannot find $GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go." >&2
e1de19
+	echo "ERROR: or $GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go." >&2
e1de19
 	echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2
e1de19
 	exit 1
e1de19
 fi
864f2d
@@ -130,8 +137,6 @@ if [ "$GOROOT_BOOTSTRAP" = "$GOROOT" ];
e1de19
 	echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2
e1de19
 	exit 1
e1de19
 fi
e1de19
-rm -f cmd/dist/dist
e1de19
-GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
e1de19
 
e1de19
 # -e doesn't propagate out of eval, so check success by hand.
e1de19
 eval $(./cmd/dist/dist env -p || echo FAIL=true)