diff options
Diffstat (limited to 'meta/recipes-devtools/go/go-1.10/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch')
| -rw-r--r-- | meta/recipes-devtools/go/go-1.10/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-1.10/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch b/meta/recipes-devtools/go/go-1.10/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch new file mode 100644 index 0000000000..818fe66700 --- /dev/null +++ b/meta/recipes-devtools/go/go-1.10/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | From acd179b49f1fc8d6f7f69e569fb4a56039c725a1 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Matt Madison <matt@madison.systems> | ||
| 3 | Date: Sat, 17 Feb 2018 05:24:20 -0800 | ||
| 4 | Subject: [PATCH 3/9] allow GOTOOLDIR to be overridden in the environment | ||
| 5 | |||
| 6 | to allow for split host/target build roots | ||
| 7 | |||
| 8 | Upstream-Status: Inappropriate [OE specific] | ||
| 9 | |||
| 10 | Signed-off-by: Matt Madison <matt@madison.systems> | ||
| 11 | --- | ||
| 12 | src/cmd/dist/build.go | 4 +++- | ||
| 13 | src/cmd/go/internal/cfg/cfg.go | 6 +++++- | ||
| 14 | src/go/build/build.go | 2 +- | ||
| 15 | 3 files changed, 9 insertions(+), 3 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go | ||
| 18 | index 49ed80033e..afc615b5c2 100644 | ||
| 19 | --- a/src/cmd/dist/build.go | ||
| 20 | +++ b/src/cmd/dist/build.go | ||
| 21 | @@ -220,7 +220,9 @@ func xinit() { | ||
| 22 | workdir = xworkdir() | ||
| 23 | xatexit(rmworkdir) | ||
| 24 | |||
| 25 | - tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch) | ||
| 26 | + if tooldir = os.Getenv("GOTOOLDIR"); tooldir == "" { | ||
| 27 | + tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch) | ||
| 28 | + } | ||
| 29 | } | ||
| 30 | |||
| 31 | // compilerEnv returns a map from "goos/goarch" to the | ||
| 32 | diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go | ||
| 33 | index 1de4f0dc79..4f6010d660 100644 | ||
| 34 | --- a/src/cmd/go/internal/cfg/cfg.go | ||
| 35 | +++ b/src/cmd/go/internal/cfg/cfg.go | ||
| 36 | @@ -96,7 +96,11 @@ func init() { | ||
| 37 | // as the tool directory does not move based on environment variables. | ||
| 38 | // This matches the initialization of ToolDir in go/build, | ||
| 39 | // except for using GOROOT rather than runtime.GOROOT(). | ||
| 40 | - build.ToolDir = filepath.Join(GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH) | ||
| 41 | + if s := os.Getenv("GOTOOLDIR"); s != "" { | ||
| 42 | + build.ToolDir = filepath.Clean(s) | ||
| 43 | + } else { | ||
| 44 | + build.ToolDir = filepath.Join(GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH) | ||
| 45 | + } | ||
| 46 | } | ||
| 47 | |||
| 48 | func findGOROOT() string { | ||
| 49 | diff --git a/src/go/build/build.go b/src/go/build/build.go | ||
| 50 | index 68fb423983..81b1b32270 100644 | ||
| 51 | --- a/src/go/build/build.go | ||
| 52 | +++ b/src/go/build/build.go | ||
| 53 | @@ -1594,7 +1594,7 @@ func init() { | ||
| 54 | } | ||
| 55 | |||
| 56 | // ToolDir is the directory containing build tools. | ||
| 57 | -var ToolDir = filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH) | ||
| 58 | +var ToolDir = envOr("GOTOOLDIR", filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)) | ||
| 59 | |||
| 60 | // IsLocalImport reports whether the import path is | ||
| 61 | // a local import path, like ".", "..", "./foo", or "../foo". | ||
| 62 | -- | ||
| 63 | 2.14.1 | ||
| 64 | |||
