]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: detect GOHOSTARCH on iOS
authorElias Naur <mail@eliasnaur.com>
Tue, 30 Apr 2019 18:00:23 +0000 (20:00 +0200)
committerElias Naur <mail@eliasnaur.com>
Tue, 30 Apr 2019 18:29:07 +0000 (18:29 +0000)
cmd/dist defaults to GOHOSTARCH=amd64 on darwin because no other
darwin host could build Go. With the upcoming self-hosted iOS
builders, GOHOSTARCH=arm64 is also possible.

Updates #31722

Change-Id: I9af47d9f8c57ea45475ce498acefbfe6bf4815b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/174306
Run-TryBot: Elias Naur <mail@eliasnaur.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/dist/main.go

index 7a7ffe8f0c154fad3013447cff42d7a95c4333c9..07361d828f7d55b02bc9e7c65800b231722cf841 100644 (file)
@@ -60,9 +60,6 @@ func main() {
                // uname -m doesn't work under AIX
                gohostarch = "ppc64"
        case "darwin":
-               // Even on 64-bit platform, darwin uname -m prints i386.
-               // We don't support any of the OS X versions that run on 32-bit-only hardware anymore.
-               gohostarch = "amd64"
                // macOS 10.9 and later require clang
                defaultclang = true
        case "freebsd":
@@ -107,6 +104,11 @@ func main() {
                        gohostarch = "amd64"
                case strings.Contains(out, "86"):
                        gohostarch = "386"
+                       if gohostos == "darwin" {
+                               // Even on 64-bit platform, some versions of macOS uname -m prints i386.
+                               // We don't support any of the OS X versions that run on 32-bit-only hardware anymore.
+                               gohostarch = "amd64"
+                       }
                case strings.Contains(out, "aarch64"), strings.Contains(out, "arm64"):
                        gohostarch = "arm64"
                case strings.Contains(out, "arm"):
@@ -128,8 +130,8 @@ func main() {
                case strings.Contains(out, "s390x"):
                        gohostarch = "s390x"
                case gohostos == "darwin":
-                       if strings.Contains(run("", CheckExit, "uname", "-v"), "RELEASE_ARM_") {
-                               gohostarch = "arm"
+                       if strings.Contains(run("", CheckExit, "uname", "-v"), "RELEASE_ARM64_") {
+                               gohostarch = "arm64"
                        }
                default:
                        fatalf("unknown architecture: %s", out)