diff options
author | Alex Kube <alexander.j.kube@gmail.com> | 2019-10-25 23:49:15 +0430 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-11-25 17:54:06 +0000 |
commit | 1e3f040b1f68fa1f808851ecd9623544e935e9ad (patch) | |
tree | 9e71dc12f2e6cbefc26579fa5afcb0f6e662be42 /meta | |
parent | 2b76e904a5f7d6479974a179d6d17d6ee9af94e7 (diff) | |
download | openembedded-core-contrib-1e3f040b1f68fa1f808851ecd9623544e935e9ad.tar.gz |
go: Extract common environment setup.
Add default values for go environment variables to go-common.inc.
Override where appropriate in other go*.inc files, and use
host/target tuples from goarch for setting CC flags.
Signed-off-by: Alex Kube <alexander.j.kube@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-devtools/go/go-common.inc | 10 | ||||
-rw-r--r-- | meta/recipes-devtools/go/go-cross-canadian.inc | 8 | ||||
-rw-r--r-- | meta/recipes-devtools/go/go-cross.inc | 13 | ||||
-rw-r--r-- | meta/recipes-devtools/go/go-crosssdk.inc | 11 | ||||
-rw-r--r-- | meta/recipes-devtools/go/go-runtime.inc | 15 | ||||
-rw-r--r-- | meta/recipes-devtools/go/go-target.inc | 9 |
6 files changed, 19 insertions, 47 deletions
diff --git a/meta/recipes-devtools/go/go-common.inc b/meta/recipes-devtools/go/go-common.inc index 93a3d3b5fb..f18d928c70 100644 --- a/meta/recipes-devtools/go/go-common.inc +++ b/meta/recipes-devtools/go/go-common.inc @@ -27,6 +27,16 @@ export GOTMPDIR ?= "${WORKDIR}/go-tmp" GOTMPDIR[vardepvalue] = "" export CGO_ENABLED = "1" +export GOHOSTOS ?= "${BUILD_GOOS}" +export GOHOSTARCH ?= "${BUILD_GOARCH}" +export GOROOT_BOOTSTRAP ?= "${STAGING_LIBDIR_NATIVE}/go" +export GOOS ?= "${TARGET_GOOS}" +export GOARCH ?= "${TARGET_GOARCH}" +export GOARM ?= "${TARGET_GOARM}" +export GO386 ?= "${TARGET_GO386}" +export GOMIPS ?= "${TARGET_GOMIPS}" +export GOROOT_FINAL ?= "${libdir}/go" + do_compile_prepend() { BUILD_CC=${BUILD_CC} } diff --git a/meta/recipes-devtools/go/go-cross-canadian.inc b/meta/recipes-devtools/go/go-cross-canadian.inc index 945d0f9d10..d49250a8e2 100644 --- a/meta/recipes-devtools/go/go-cross-canadian.inc +++ b/meta/recipes-devtools/go/go-cross-canadian.inc @@ -13,11 +13,7 @@ DEBUG_PREFIX_MAP = "-fdebug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDP -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \ " -export GOHOSTOS = "${BUILD_GOOS}" -export GOHOSTARCH = "${BUILD_GOARCH}" -export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" export GOTOOLDIR_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/${HOST_SYS}/go/pkg/tool/${BUILD_GOTUPLE}" -export GOROOT_FINAL = "${libdir}/go" export CGO_CFLAGS = "${CFLAGS}" export CGO_LDFLAGS = "${LDFLAGS}" export GO_LDFLAGS = '-linkmode external -extld ${HOST_PREFIX}gcc -extldflags "--sysroot=${STAGING_DIR_HOST} ${SECURITY_NOPIE_CFLAGS} ${HOST_CC_ARCH} ${LDFLAGS}"' @@ -25,8 +21,8 @@ export GO_LDFLAGS = '-linkmode external -extld ${HOST_PREFIX}gcc -extldflags "-- do_configure[noexec] = "1" do_compile() { - export CC_FOR_${HOST_GOOS}_${HOST_GOARCH}="${HOST_PREFIX}gcc --sysroot=${STAGING_DIR_HOST}${SDKPATHNATIVE} ${SECURITY_NOPIE_CFLAGS}" - export CXX_FOR_${HOST_GOOS}_${HOST_GOARCH}="${HOST_PREFIX}gxx --sysroot=${STAGING_DIR_HOST}${SDKPATHNATIVE} ${SECURITY_NOPIE_CFLAGS}" + export CC_FOR_${HOST_GOTUPLE}="${HOST_PREFIX}gcc --sysroot=${STAGING_DIR_HOST}${SDKPATHNATIVE} ${SECURITY_NOPIE_CFLAGS}" + export CXX_FOR_${HOST_GOTUPLE}="${HOST_PREFIX}gxx --sysroot=${STAGING_DIR_HOST}${SDKPATHNATIVE} ${SECURITY_NOPIE_CFLAGS}" cd src ./make.bash --host-only --no-banner cd ${B} diff --git a/meta/recipes-devtools/go/go-cross.inc b/meta/recipes-devtools/go/go-cross.inc index 3d344a74d3..3d5803bf07 100644 --- a/meta/recipes-devtools/go/go-cross.inc +++ b/meta/recipes-devtools/go/go-cross.inc @@ -5,23 +5,14 @@ DEPENDS = "go-native" PN = "go-cross-${TUNE_PKGARCH}" -export GOHOSTOS = "${BUILD_GOOS}" -export GOHOSTARCH = "${BUILD_GOARCH}" -export GOOS = "${TARGET_GOOS}" -export GOARCH = "${TARGET_GOARCH}" -export GOARM = "${TARGET_GOARM}" -export GO386 = "${TARGET_GO386}" -export GOMIPS = "${TARGET_GOMIPS}" -export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" -export GOROOT_FINAL = "${libdir}/go" export GOCACHE = "${B}/.cache" CC = "${@d.getVar('BUILD_CC').strip()}" do_configure[noexec] = "1" do_compile() { - export CC_FOR_${GOOS}_${GOARCH}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" - export CXX_FOR_${GOOS}_${GOARCh}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" + export CC_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" + export CXX_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" cd src ./make.bash --host-only --no-banner cd ${B} diff --git a/meta/recipes-devtools/go/go-crosssdk.inc b/meta/recipes-devtools/go/go-crosssdk.inc index 94f6fb8eb7..f0bec79719 100644 --- a/meta/recipes-devtools/go/go-crosssdk.inc +++ b/meta/recipes-devtools/go/go-crosssdk.inc @@ -4,18 +4,11 @@ DEPENDS = "go-native virtual/${TARGET_PREFIX}gcc-crosssdk virtual/nativesdk-${TA PN = "go-crosssdk-${SDK_SYS}" PROVIDES = "virtual/${TARGET_PREFIX}go-crosssdk" -export GOHOSTOS = "${BUILD_GOOS}" -export GOHOSTARCH = "${BUILD_GOARCH}" -export GOOS = "${TARGET_GOOS}" -export GOARCH = "${TARGET_GOARCH}" -export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" -export GOROOT_FINAL = "${libdir}/go" - do_configure[noexec] = "1" do_compile() { - export CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}" - export CXX_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}" + export CC_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}" + export CXX_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}" cd src ./make.bash --host-only --no-banner cd ${B} diff --git a/meta/recipes-devtools/go/go-runtime.inc b/meta/recipes-devtools/go/go-runtime.inc index 9731e164e9..21179a83a0 100644 --- a/meta/recipes-devtools/go/go-runtime.inc +++ b/meta/recipes-devtools/go/go-runtime.inc @@ -2,15 +2,6 @@ DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native" DEPENDS_class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk" PROVIDES = "virtual/${TARGET_PREFIX}go-runtime" -export GOHOSTOS = "${BUILD_GOOS}" -export GOHOSTARCH = "${BUILD_GOARCH}" -export GOOS = "${TARGET_GOOS}" -export GOARCH = "${TARGET_GOARCH}" -export GOARM = "${TARGET_GOARM}" -export GO386 = "${TARGET_GO386}" -export GOMIPS = "${TARGET_GOMIPS}" -export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" -export GOROOT_FINAL = "${libdir}/go" export CGO_CFLAGS = "${CFLAGS}" export CGO_CPPFLAGS = "${CPPFLAGS}" export CGO_CXXFLAGS = "${CXXFLAGS}" @@ -29,14 +20,14 @@ do_configure_libc-musl() { } do_compile() { - export CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CC}" - export CXX_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CXX}" + export CC_FOR_${TARGET_GOTUPLE}="${CC}" + export CXX_FOR_${TARGET_GOTUPLE}="${CXX}" cd src ./make.bash --target-only --no-banner std if [ -n "${GO_DYNLINK}" ]; then export GOTOOLDIR="${B}/pkg/tool/native_native" - CC="$CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}" GOARCH="${TARGET_GOARCH}" GOOS="${TARGET_GOOS}" GOROOT=${B} \ + CC="$CC_FOR_${TARGET_GOTUPLE}" GOARCH="${TARGET_GOARCH}" GOOS="${TARGET_GOOS}" GOROOT=${B} \ $GOTOOLDIR/go_bootstrap install -linkshared -buildmode=shared ${GO_SHLIB_LDFLAGS} std fi cd ${B} diff --git a/meta/recipes-devtools/go/go-target.inc b/meta/recipes-devtools/go/go-target.inc index 91efd3e977..316bf6f038 100644 --- a/meta/recipes-devtools/go/go-target.inc +++ b/meta/recipes-devtools/go/go-target.inc @@ -1,15 +1,6 @@ DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native" DEPENDS_class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk go-native" -export GOHOSTOS = "${BUILD_GOOS}" -export GOHOSTARCH = "${BUILD_GOARCH}" -export GOOS = "${TARGET_GOOS}" -export GOARCH = "${TARGET_GOARCH}" -export GOARM = "${TARGET_GOARM}" -export GO386 = "${TARGET_GO386}" -export GOMIPS = "${TARGET_GOMIPS}" -export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" -export GOROOT_FINAL = "${libdir}/go" export GOCACHE = "${B}/.cache" GO_LDFLAGS = "" GO_LDFLAGS_class-nativesdk = "-linkmode external" |