[oe-commits] [openembedded-core] 16/17: go.bbclass: Export more GO* environment variables

git at git.openembedded.org git at git.openembedded.org
Wed Apr 10 12:47:32 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 6300c4a83f7c8fc88702798ffe25bd6d57091673
Author: Mark Asselstine <mark.asselstine at windriver.com>
AuthorDate: Mon Mar 18 11:21:52 2019 -0400

    go.bbclass: Export more GO* environment variables
    
    Currently we are not doing a good job of consolidating GO environment
    variables used by the go build system in the go.bbclass, instead we
    are relying on the individual GO recipe authors to perform the
    exports. This can result in inconsistent build results and often
    binaries that are not properly cross compiled, resulting in segfaults
    when the applications are run on the target.
    
    For example the GO documentation recommends that the environment
    include a value assigned to GOARM when cross building for ARMv5, ARMv6
    and ARMv7 (https://github.com/golang/go/wiki/GoArm).
    
    In order to avoid polluting the build scripts with unnecessary
    exports, such as run.do_compile, we attempt to only export variables
    when they apply to a specific arch.
    
    Signed-off-by: Mark Asselstine <mark.asselstine at windriver.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/go.bbclass | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index 7069c5f..78c2d68 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -8,6 +8,25 @@ GOROOT = "${STAGING_LIBDIR}/go"
 export GOROOT
 export GOROOT_FINAL = "${libdir}/go"
 
+export GOARCH = "${TARGET_GOARCH}"
+export GOOS = "${TARGET_GOOS}"
+export GOHOSTARCH="${BUILD_GOARCH}"
+export GOHOSTOS="${BUILD_GOOS}"
+
+GOARM[export] = "0"
+GOARM_arm_class-target = "${TARGET_GOARM}"
+GOARM_arm_class-target[export] = "1"
+
+GO386[export] = "0"
+GO386_x86_class-target = "${TARGET_GO386}"
+GO386_x86_class-target[export] = "1"
+GO386_i586_class-target = "${TARGET_GO386}"
+GO386_i586_class-target[export] = "1"
+
+GOMIPS[export] = "0"
+GOMIPS_mips_class-target = "${TARGET_GOMIPS}"
+GOMIPS_mips_class-target[export] = "1"
+
 DEPENDS_GOLANG_class-target = "virtual/${TUNE_PKGARCH}-go virtual/${TARGET_PREFIX}go-runtime"
 DEPENDS_GOLANG_class-native = "go-native"
 DEPENDS_GOLANG_class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk virtual/${TARGET_PREFIX}go-runtime"

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list