summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/go/go-1.14/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/go/go-1.14/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch')
-rw-r--r--meta/recipes-devtools/go/go-1.14/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch47
1 files changed, 47 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-1.14/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch b/meta/recipes-devtools/go/go-1.14/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch
new file mode 100644
index 0000000000..662c705471
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.14/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch
@@ -0,0 +1,47 @@
1From 28ada8896b76d620240bafc22aa395071d601482 Mon Sep 17 00:00:00 2001
2From: Alex Kube <alexander.j.kube@gmail.com>
3Date: Wed, 23 Oct 2019 21:15:37 +0430
4Subject: [PATCH 3/9] cmd/go: Allow GOTOOLDIR to be overridden in the environment
5
6to allow for split host/target build roots
7
8Adapted to Go 1.13 from patches originally submitted to
9the meta/recipes-devtools/go tree by
10Matt Madison <matt@madison.systems>.
11
12Upstream-Status: Inappropriate [OE specific]
13
14Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
15---
16 src/cmd/dist/build.go | 4 +++-
17 src/cmd/go/internal/cfg/cfg.go | 6 +++++-
18 2 files changed, 8 insertions(+), 2 deletions(-)
19
20--- a/src/cmd/dist/build.go
21+++ b/src/cmd/dist/build.go
22@@ -246,7 +246,9 @@ func xinit() {
23 workdir = xworkdir()
24 xatexit(rmworkdir)
25
26- tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch)
27+ if tooldir = os.Getenv("GOTOOLDIR"); tooldir == "" {
28+ tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch)
29+ }
30 }
31
32 // compilerEnv returns a map from "goos/goarch" to the
33--- a/src/cmd/go/internal/cfg/cfg.go
34+++ b/src/cmd/go/internal/cfg/cfg.go
35@@ -64,7 +64,11 @@ func defaultContext() build.Context {
36 // variables. This matches the initialization of ToolDir in
37 // go/build, except for using ctxt.GOROOT rather than
38 // runtime.GOROOT.
39- build.ToolDir = filepath.Join(ctxt.GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
40+ if s := os.Getenv("GOTOOLDIR"); s != "" {
41+ build.ToolDir = filepath.Clean(s)
42+ } else {
43+ build.ToolDir = filepath.Join(ctxt.GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
44+ }
45 }
46
47 ctxt.GOPATH = envOr("GOPATH", ctxt.GOPATH)