pgreco / rpms / golang

Forked from rpms/golang 5 years ago
Clone

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

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