diff options
Diffstat (limited to 'meta/recipes-devtools/go/go-1.9/0004-cmd-go-allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch')
| -rw-r--r-- | meta/recipes-devtools/go/go-1.9/0004-cmd-go-allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-1.9/0004-cmd-go-allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch b/meta/recipes-devtools/go/go-1.9/0004-cmd-go-allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch new file mode 100644 index 0000000000..180b06a4d3 --- /dev/null +++ b/meta/recipes-devtools/go/go-1.9/0004-cmd-go-allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | From 1369178b497b12088ec4c2794606cc9f14cc327c Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Matt Madison <matt@madison.systems> | ||
| 3 | Date: Wed, 13 Sep 2017 08:15:03 -0700 | ||
| 4 | Subject: [PATCH 4/7] cmd/go: allow GOTOOLDIR to be overridden in the | ||
| 5 | environment | ||
| 6 | |||
| 7 | For OE cross-builds, host-side tools reside in the native | ||
| 8 | GOROOT, not the target GOROOT. Allow GOTOOLDIR to be set | ||
| 9 | in the environment to allow that split, rather than always | ||
| 10 | computing GOTOOLDIR relative to the GOROOT setting. | ||
| 11 | |||
| 12 | Upstream-Status: Pending | ||
| 13 | |||
| 14 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 15 | Signed-off-by: Matt Madison <matt@madison.systems> | ||
| 16 | --- | ||
| 17 | src/cmd/go/internal/cfg/cfg.go | 7 ++++++- | ||
| 18 | src/cmd/go/internal/work/build.go | 2 +- | ||
| 19 | src/go/build/build.go | 2 +- | ||
| 20 | 3 files changed, 8 insertions(+), 3 deletions(-) | ||
| 21 | |||
| 22 | diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go | ||
| 23 | index b3ad1ce..c1dc974 100644 | ||
| 24 | --- a/src/cmd/go/internal/cfg/cfg.go | ||
| 25 | +++ b/src/cmd/go/internal/cfg/cfg.go | ||
| 26 | @@ -91,7 +91,12 @@ func init() { | ||
| 27 | // as the tool directory does not move based on environment variables. | ||
| 28 | // This matches the initialization of ToolDir in go/build, | ||
| 29 | // except for using GOROOT rather than runtime.GOROOT(). | ||
| 30 | - build.ToolDir = filepath.Join(GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH) | ||
| 31 | + s := os.Getenv("GOTOOLDIR") | ||
| 32 | + if s == "" { | ||
| 33 | + build.ToolDir = filepath.Join(GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH) | ||
| 34 | + } else { | ||
| 35 | + build.ToolDir = s | ||
| 36 | + } | ||
| 37 | } | ||
| 38 | |||
| 39 | func findGOROOT() string { | ||
| 40 | diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go | ||
| 41 | index 85df0b3..7b9a69e 100644 | ||
| 42 | --- a/src/cmd/go/internal/work/build.go | ||
| 43 | +++ b/src/cmd/go/internal/work/build.go | ||
| 44 | @@ -1337,7 +1337,7 @@ func (b *Builder) build(a *Action) (err error) { | ||
| 45 | } | ||
| 46 | |||
| 47 | var cgoExe string | ||
| 48 | - if a.cgo != nil && a.cgo.Target != "" { | ||
| 49 | + if a.cgo != nil && a.cgo.Target != "" && os.Getenv("GOTOOLDIR") == "" { | ||
| 50 | cgoExe = a.cgo.Target | ||
| 51 | } else { | ||
| 52 | cgoExe = base.Tool("cgo") | ||
| 53 | diff --git a/src/go/build/build.go b/src/go/build/build.go | ||
| 54 | index fd89871..e16145b 100644 | ||
| 55 | --- a/src/go/build/build.go | ||
| 56 | +++ b/src/go/build/build.go | ||
| 57 | @@ -1588,7 +1588,7 @@ func init() { | ||
| 58 | } | ||
| 59 | |||
| 60 | // ToolDir is the directory containing build tools. | ||
| 61 | -var ToolDir = filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH) | ||
| 62 | +var ToolDir = envOr("GOTOOLDIR", filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)) | ||
| 63 | |||
| 64 | // IsLocalImport reports whether the import path is | ||
| 65 | // a local import path, like ".", "..", "./foo", or "../foo". | ||
| 66 | -- | ||
| 67 | 2.7.4 | ||
| 68 | |||
