From eb8dc40360f0cfef56fb6947cc817a547d6d9bc6 Mon Sep 17 00:00:00 2001 From: Dave Cobbley Date: Tue, 14 Aug 2018 10:05:37 -0700 Subject: [Subtree] Removing import-layers directory As part of the move to subtrees, need to bring all the import layers content to the top level. Change-Id: I4a163d10898cbc6e11c27f776f60e1a470049d8f Signed-off-by: Dave Cobbley Signed-off-by: Brad Bishop --- ...w-GOTOOLDIR-to-be-overridden-in-the-envir.patch | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 poky/meta/recipes-devtools/go/go-1.9/0004-cmd-go-allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch (limited to 'poky/meta/recipes-devtools/go/go-1.9/0004-cmd-go-allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch') diff --git a/poky/meta/recipes-devtools/go/go-1.9/0004-cmd-go-allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch b/poky/meta/recipes-devtools/go/go-1.9/0004-cmd-go-allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch new file mode 100644 index 000000000..180b06a4d --- /dev/null +++ b/poky/meta/recipes-devtools/go/go-1.9/0004-cmd-go-allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch @@ -0,0 +1,68 @@ +From 1369178b497b12088ec4c2794606cc9f14cc327c Mon Sep 17 00:00:00 2001 +From: Matt Madison +Date: Wed, 13 Sep 2017 08:15:03 -0700 +Subject: [PATCH 4/7] cmd/go: allow GOTOOLDIR to be overridden in the + environment + +For OE cross-builds, host-side tools reside in the native +GOROOT, not the target GOROOT. Allow GOTOOLDIR to be set +in the environment to allow that split, rather than always +computing GOTOOLDIR relative to the GOROOT setting. + +Upstream-Status: Pending + +Signed-off-by: Khem Raj +Signed-off-by: Matt Madison +--- + src/cmd/go/internal/cfg/cfg.go | 7 ++++++- + src/cmd/go/internal/work/build.go | 2 +- + src/go/build/build.go | 2 +- + 3 files changed, 8 insertions(+), 3 deletions(-) + +diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go +index b3ad1ce..c1dc974 100644 +--- a/src/cmd/go/internal/cfg/cfg.go ++++ b/src/cmd/go/internal/cfg/cfg.go +@@ -91,7 +91,12 @@ func init() { + // as the tool directory does not move based on environment variables. + // This matches the initialization of ToolDir in go/build, + // except for using GOROOT rather than runtime.GOROOT(). +- build.ToolDir = filepath.Join(GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH) ++ s := os.Getenv("GOTOOLDIR") ++ if s == "" { ++ build.ToolDir = filepath.Join(GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH) ++ } else { ++ build.ToolDir = s ++ } + } + + func findGOROOT() string { +diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go +index 85df0b3..7b9a69e 100644 +--- a/src/cmd/go/internal/work/build.go ++++ b/src/cmd/go/internal/work/build.go +@@ -1337,7 +1337,7 @@ func (b *Builder) build(a *Action) (err error) { + } + + var cgoExe string +- if a.cgo != nil && a.cgo.Target != "" { ++ if a.cgo != nil && a.cgo.Target != "" && os.Getenv("GOTOOLDIR") == "" { + cgoExe = a.cgo.Target + } else { + cgoExe = base.Tool("cgo") +diff --git a/src/go/build/build.go b/src/go/build/build.go +index fd89871..e16145b 100644 +--- a/src/go/build/build.go ++++ b/src/go/build/build.go +@@ -1588,7 +1588,7 @@ func init() { + } + + // ToolDir is the directory containing build tools. +-var ToolDir = filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH) ++var ToolDir = envOr("GOTOOLDIR", filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)) + + // IsLocalImport reports whether the import path is + // a local import path, like ".", "..", "./foo", or "../foo". +-- +2.7.4 + -- cgit v1.2.1