From dc0772a41eb84cbbfc62d9661fdaada493fbec02 Mon Sep 17 00:00:00 2001 From: Dave Cheney Date: Wed, 12 Mar 2014 09:52:02 +1100 Subject: [PATCH] go.tools/dashboard/builder: always cross compile for nacl builds If we are building, for example, linux/386 on a linux/amd64 machine we want to make sure that the whole build is done as a if this were compiled on a real linux/386 machine. In other words, we want to not do a cross compilation build. The exception to this rule is when we are doing nacl builds. These are by definition always cross compilation, and we have support built into cmd/go to be able to handle this case. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/74230043 --- dashboard/builder/env.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dashboard/builder/env.go b/dashboard/builder/env.go index 0d1d0dfe..40775a7c 100644 --- a/dashboard/builder/env.go +++ b/dashboard/builder/env.go @@ -54,11 +54,20 @@ func (b *Builder) envv() []string { if *buildTool == "go" { e = []string{ "GOOS=" + b.goos, - "GOHOSTOS=" + b.goos, "GOARCH=" + b.goarch, - "GOHOSTARCH=" + b.goarch, "GOROOT_FINAL=/usr/local/go", } + if b.goos != "nacl" { + // If we are building, for example, linux/386 on a linux/amd64 machine we want to + // make sure that the whole build is done as a if this were compiled on a real + // linux/386 machine. In other words, we want to not do a cross compilation build. + // To do this we set GOHOSTOS and GOHOSTARCH to override the detection in make.bash. + // + // The exception to this rule is when we are doing nacl builds. These are by definition + // always cross compilation, and we have support built into cmd/go to be able to handle + // this case. + e = append(e, "GOHOSTOS="+b.goos, "GOHOSTARCH="+b.goarch) + } } for _, k := range extraEnv {