This can run the given command with the Go environment for CBUILD.

Signed-off-by: James Le Cuirot <[email protected]>
---
 eclass/go-env.eclass | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/eclass/go-env.eclass b/eclass/go-env.eclass
index 295ecf5a5fd3..ddc2442004cd 100644
--- a/eclass/go-env.eclass
+++ b/eclass/go-env.eclass
@@ -86,6 +86,20 @@ go-env_set_compile_environment() {
        fi
 }
 
+# @FUNCTION: go-env_run
+# @DESCRIPTION:
+# Runs the given command under a localised environment configured by
+# go-env_set_compile_environment. It is not usually necessary to call this, but
+# it is useful when combined with tc-env_build.
+go-env_run() {
+       local -I AR CC CXX FC PKG_CONFIG \
+               GO{FLAGS,MAXPROCS,ARCH,OS,386,ARM,MIPS,MIPS64} \
+               CGO_{CFLAGS,CPPFLAGS,CXXFLAGS,LDFLAGS}
+
+       go-env_set_compile_environment
+       "${@}"
+}
+
 # @FUNCTION: go-env_goos
 # @USAGE: [toolchain prefix]
 # @DESCRIPTION:
-- 
2.53.0


Reply via email to