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:57:22 +0000 |
commit | d4aa1998364f2cac1419b442da4c39699e42391a (patch) | |
tree | 810b0f6a073feb954bbf0bfb1a50f780c8ad732c /meta/recipes-devtools/go | |
parent | 0dd3a42c3d79ca63248fbbab6ba19dd42f11b03f (diff) | |
download | poky-d4aa1998364f2cac1419b442da4c39699e42391a.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.
(From OE-Core rev: 1e3f040b1f68fa1f808851ecd9623544e935e9ad)
Signed-off-by: Alex Kube <alexander.j.kube@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/go')
-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" | |||
27 | GOTMPDIR[vardepvalue] = "" | 27 | GOTMPDIR[vardepvalue] = "" |
28 | export CGO_ENABLED = "1" | 28 | export CGO_ENABLED = "1" |
29 | 29 | ||
30 | export GOHOSTOS ?= "${BUILD_GOOS}" | ||
31 | export GOHOSTARCH ?= "${BUILD_GOARCH}" | ||
32 | export GOROOT_BOOTSTRAP ?= "${STAGING_LIBDIR_NATIVE}/go" | ||
33 | export GOOS ?= "${TARGET_GOOS}" | ||
34 | export GOARCH ?= "${TARGET_GOARCH}" | ||
35 | export GOARM ?= "${TARGET_GOARM}" | ||
36 | export GO386 ?= "${TARGET_GO386}" | ||
37 | export GOMIPS ?= "${TARGET_GOMIPS}" | ||
38 | export GOROOT_FINAL ?= "${libdir}/go" | ||
39 | |||
30 | do_compile_prepend() { | 40 | do_compile_prepend() { |
31 | BUILD_CC=${BUILD_CC} | 41 | BUILD_CC=${BUILD_CC} |
32 | } | 42 | } |
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 | |||
13 | -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \ | 13 | -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \ |
14 | " | 14 | " |
15 | 15 | ||
16 | export GOHOSTOS = "${BUILD_GOOS}" | ||
17 | export GOHOSTARCH = "${BUILD_GOARCH}" | ||
18 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" | ||
19 | export GOTOOLDIR_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/${HOST_SYS}/go/pkg/tool/${BUILD_GOTUPLE}" | 16 | export GOTOOLDIR_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/${HOST_SYS}/go/pkg/tool/${BUILD_GOTUPLE}" |
20 | export GOROOT_FINAL = "${libdir}/go" | ||
21 | export CGO_CFLAGS = "${CFLAGS}" | 17 | export CGO_CFLAGS = "${CFLAGS}" |
22 | export CGO_LDFLAGS = "${LDFLAGS}" | 18 | export CGO_LDFLAGS = "${LDFLAGS}" |
23 | export GO_LDFLAGS = '-linkmode external -extld ${HOST_PREFIX}gcc -extldflags "--sysroot=${STAGING_DIR_HOST} ${SECURITY_NOPIE_CFLAGS} ${HOST_CC_ARCH} ${LDFLAGS}"' | 19 | 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 "-- | |||
25 | do_configure[noexec] = "1" | 21 | do_configure[noexec] = "1" |
26 | 22 | ||
27 | do_compile() { | 23 | do_compile() { |
28 | export CC_FOR_${HOST_GOOS}_${HOST_GOARCH}="${HOST_PREFIX}gcc --sysroot=${STAGING_DIR_HOST}${SDKPATHNATIVE} ${SECURITY_NOPIE_CFLAGS}" | 24 | export CC_FOR_${HOST_GOTUPLE}="${HOST_PREFIX}gcc --sysroot=${STAGING_DIR_HOST}${SDKPATHNATIVE} ${SECURITY_NOPIE_CFLAGS}" |
29 | export CXX_FOR_${HOST_GOOS}_${HOST_GOARCH}="${HOST_PREFIX}gxx --sysroot=${STAGING_DIR_HOST}${SDKPATHNATIVE} ${SECURITY_NOPIE_CFLAGS}" | 25 | export CXX_FOR_${HOST_GOTUPLE}="${HOST_PREFIX}gxx --sysroot=${STAGING_DIR_HOST}${SDKPATHNATIVE} ${SECURITY_NOPIE_CFLAGS}" |
30 | cd src | 26 | cd src |
31 | ./make.bash --host-only --no-banner | 27 | ./make.bash --host-only --no-banner |
32 | cd ${B} | 28 | 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" | |||
5 | 5 | ||
6 | PN = "go-cross-${TUNE_PKGARCH}" | 6 | PN = "go-cross-${TUNE_PKGARCH}" |
7 | 7 | ||
8 | export GOHOSTOS = "${BUILD_GOOS}" | ||
9 | export GOHOSTARCH = "${BUILD_GOARCH}" | ||
10 | export GOOS = "${TARGET_GOOS}" | ||
11 | export GOARCH = "${TARGET_GOARCH}" | ||
12 | export GOARM = "${TARGET_GOARM}" | ||
13 | export GO386 = "${TARGET_GO386}" | ||
14 | export GOMIPS = "${TARGET_GOMIPS}" | ||
15 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" | ||
16 | export GOROOT_FINAL = "${libdir}/go" | ||
17 | export GOCACHE = "${B}/.cache" | 8 | export GOCACHE = "${B}/.cache" |
18 | CC = "${@d.getVar('BUILD_CC').strip()}" | 9 | CC = "${@d.getVar('BUILD_CC').strip()}" |
19 | 10 | ||
20 | do_configure[noexec] = "1" | 11 | do_configure[noexec] = "1" |
21 | 12 | ||
22 | do_compile() { | 13 | do_compile() { |
23 | export CC_FOR_${GOOS}_${GOARCH}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" | 14 | export CC_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" |
24 | export CXX_FOR_${GOOS}_${GOARCh}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" | 15 | export CXX_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" |
25 | cd src | 16 | cd src |
26 | ./make.bash --host-only --no-banner | 17 | ./make.bash --host-only --no-banner |
27 | cd ${B} | 18 | 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 | |||
4 | PN = "go-crosssdk-${SDK_SYS}" | 4 | PN = "go-crosssdk-${SDK_SYS}" |
5 | PROVIDES = "virtual/${TARGET_PREFIX}go-crosssdk" | 5 | PROVIDES = "virtual/${TARGET_PREFIX}go-crosssdk" |
6 | 6 | ||
7 | export GOHOSTOS = "${BUILD_GOOS}" | ||
8 | export GOHOSTARCH = "${BUILD_GOARCH}" | ||
9 | export GOOS = "${TARGET_GOOS}" | ||
10 | export GOARCH = "${TARGET_GOARCH}" | ||
11 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" | ||
12 | export GOROOT_FINAL = "${libdir}/go" | ||
13 | |||
14 | do_configure[noexec] = "1" | 7 | do_configure[noexec] = "1" |
15 | 8 | ||
16 | do_compile() { | 9 | do_compile() { |
17 | export CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}" | 10 | export CC_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}" |
18 | export CXX_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}" | 11 | export CXX_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}" |
19 | cd src | 12 | cd src |
20 | ./make.bash --host-only --no-banner | 13 | ./make.bash --host-only --no-banner |
21 | cd ${B} | 14 | 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" | |||
2 | DEPENDS_class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk" | 2 | DEPENDS_class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk" |
3 | PROVIDES = "virtual/${TARGET_PREFIX}go-runtime" | 3 | PROVIDES = "virtual/${TARGET_PREFIX}go-runtime" |
4 | 4 | ||
5 | export GOHOSTOS = "${BUILD_GOOS}" | ||
6 | export GOHOSTARCH = "${BUILD_GOARCH}" | ||
7 | export GOOS = "${TARGET_GOOS}" | ||
8 | export GOARCH = "${TARGET_GOARCH}" | ||
9 | export GOARM = "${TARGET_GOARM}" | ||
10 | export GO386 = "${TARGET_GO386}" | ||
11 | export GOMIPS = "${TARGET_GOMIPS}" | ||
12 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" | ||
13 | export GOROOT_FINAL = "${libdir}/go" | ||
14 | export CGO_CFLAGS = "${CFLAGS}" | 5 | export CGO_CFLAGS = "${CFLAGS}" |
15 | export CGO_CPPFLAGS = "${CPPFLAGS}" | 6 | export CGO_CPPFLAGS = "${CPPFLAGS}" |
16 | export CGO_CXXFLAGS = "${CXXFLAGS}" | 7 | export CGO_CXXFLAGS = "${CXXFLAGS}" |
@@ -29,14 +20,14 @@ do_configure_libc-musl() { | |||
29 | } | 20 | } |
30 | 21 | ||
31 | do_compile() { | 22 | do_compile() { |
32 | export CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CC}" | 23 | export CC_FOR_${TARGET_GOTUPLE}="${CC}" |
33 | export CXX_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CXX}" | 24 | export CXX_FOR_${TARGET_GOTUPLE}="${CXX}" |
34 | 25 | ||
35 | cd src | 26 | cd src |
36 | ./make.bash --target-only --no-banner std | 27 | ./make.bash --target-only --no-banner std |
37 | if [ -n "${GO_DYNLINK}" ]; then | 28 | if [ -n "${GO_DYNLINK}" ]; then |
38 | export GOTOOLDIR="${B}/pkg/tool/native_native" | 29 | export GOTOOLDIR="${B}/pkg/tool/native_native" |
39 | CC="$CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}" GOARCH="${TARGET_GOARCH}" GOOS="${TARGET_GOOS}" GOROOT=${B} \ | 30 | CC="$CC_FOR_${TARGET_GOTUPLE}" GOARCH="${TARGET_GOARCH}" GOOS="${TARGET_GOOS}" GOROOT=${B} \ |
40 | $GOTOOLDIR/go_bootstrap install -linkshared -buildmode=shared ${GO_SHLIB_LDFLAGS} std | 31 | $GOTOOLDIR/go_bootstrap install -linkshared -buildmode=shared ${GO_SHLIB_LDFLAGS} std |
41 | fi | 32 | fi |
42 | cd ${B} | 33 | 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 @@ | |||
1 | DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native" | 1 | DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native" |
2 | DEPENDS_class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk go-native" | 2 | DEPENDS_class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk go-native" |
3 | 3 | ||
4 | export GOHOSTOS = "${BUILD_GOOS}" | ||
5 | export GOHOSTARCH = "${BUILD_GOARCH}" | ||
6 | export GOOS = "${TARGET_GOOS}" | ||
7 | export GOARCH = "${TARGET_GOARCH}" | ||
8 | export GOARM = "${TARGET_GOARM}" | ||
9 | export GO386 = "${TARGET_GO386}" | ||
10 | export GOMIPS = "${TARGET_GOMIPS}" | ||
11 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" | ||
12 | export GOROOT_FINAL = "${libdir}/go" | ||
13 | export GOCACHE = "${B}/.cache" | 4 | export GOCACHE = "${B}/.cache" |
14 | GO_LDFLAGS = "" | 5 | GO_LDFLAGS = "" |
15 | GO_LDFLAGS_class-nativesdk = "-linkmode external" | 6 | GO_LDFLAGS_class-nativesdk = "-linkmode external" |