1
0
mirror of https://github.com/golang/go synced 2024-11-17 12:24:51 -07:00

cmd/dist: detect GOHOSTARCH on iOS

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>
This commit is contained in:
Elias Naur 2019-04-30 20:00:23 +02:00
parent d7edc91643
commit 888bac1421

12
src/cmd/dist/main.go vendored
View File

@ -60,9 +60,6 @@ func main() {
// uname -m doesn't work under AIX // uname -m doesn't work under AIX
gohostarch = "ppc64" gohostarch = "ppc64"
case "darwin": 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 // macOS 10.9 and later require clang
defaultclang = true defaultclang = true
case "freebsd": case "freebsd":
@ -107,6 +104,11 @@ func main() {
gohostarch = "amd64" gohostarch = "amd64"
case strings.Contains(out, "86"): case strings.Contains(out, "86"):
gohostarch = "386" 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"): case strings.Contains(out, "aarch64"), strings.Contains(out, "arm64"):
gohostarch = "arm64" gohostarch = "arm64"
case strings.Contains(out, "arm"): case strings.Contains(out, "arm"):
@ -128,8 +130,8 @@ func main() {
case strings.Contains(out, "s390x"): case strings.Contains(out, "s390x"):
gohostarch = "s390x" gohostarch = "s390x"
case gohostos == "darwin": case gohostos == "darwin":
if strings.Contains(run("", CheckExit, "uname", "-v"), "RELEASE_ARM_") { if strings.Contains(run("", CheckExit, "uname", "-v"), "RELEASE_ARM64_") {
gohostarch = "arm" gohostarch = "arm64"
} }
default: default:
fatalf("unknown architecture: %s", out) fatalf("unknown architecture: %s", out)