diff options
| author | Matt Madison <matt@madison.systems> | 2017-09-12 09:50:21 -0300 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-09-12 23:55:29 +0100 |
| commit | 9060b87711ffc5892c343165236ec40e5e3478e6 (patch) | |
| tree | b3b1d79264f22f000140d703849ba8ae4d41e010 /meta/classes/go.bbclass | |
| parent | 2a7a37e70d3709a0e2ca96d0341bbde102ee9978 (diff) | |
| download | poky-9060b87711ffc5892c343165236ec40e5e3478e6.tar.gz | |
go: split out go-runtime into separate recipe
Reorganize the Go toolchain build to split out
the Go standard runtime libraries into a separate
recipe. This simplifies the extension to crosssdk
and cross-canadian builds.
* Adds a patch to the go build tool to prevent it
from trying to rebuild anything in GOROOT, which
is now resident in the target sysroot.
* 'go' bb and inc files are now for building the
compiler for the target only.
* 'go-cross' bb and inc files are now just for
the cross-compiler.
* Adds virtual/<prefix> PROVIDES for the compiler
and runtime
* Removes testdata directories from the sysroot
during staging, as they are unnecessary and
can cause strip errors (some of the test files
are ELF files).
* Re-enables pacakage QA checks, adding selective
INSANE_SKIP settings where needed.
(From OE-Core rev: d2a7af7cd834e218c39d43ee3fa0c14d4f748727)
Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/go.bbclass')
| -rw-r--r-- | meta/classes/go.bbclass | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass index cb1e96d88b..b3464d2105 100644 --- a/meta/classes/go.bbclass +++ b/meta/classes/go.bbclass | |||
| @@ -20,11 +20,11 @@ def get_go_parallel_make(d): | |||
| 20 | GO_PARALLEL_BUILD ?= "${@get_go_parallel_make(d)}" | 20 | GO_PARALLEL_BUILD ?= "${@get_go_parallel_make(d)}" |
| 21 | 21 | ||
| 22 | GOROOT_class-native = "${STAGING_LIBDIR_NATIVE}/go" | 22 | GOROOT_class-native = "${STAGING_LIBDIR_NATIVE}/go" |
| 23 | GOROOT = "${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go" | 23 | GOROOT = "${STAGING_LIBDIR}/go" |
| 24 | GOBIN_FINAL_class-native = "${GOROOT_FINAL}/bin" | 24 | GOBIN_FINAL_class-native = "${GOROOT_FINAL}/bin" |
| 25 | GOBIN_FINAL = "${GOROOT_FINAL}/${GO_BUILD_BINDIR}" | 25 | GOBIN_FINAL = "${GOROOT_FINAL}/${GO_BUILD_BINDIR}" |
| 26 | 26 | ||
| 27 | DEPENDS_GOLANG_class-target = "go-cross-${TARGET_ARCH}" | 27 | DEPENDS_GOLANG_class-target = "virtual/${TARGET_PREFIX}go virtual/${TARGET_PREFIX}go-runtime" |
| 28 | DEPENDS_GOLANG_class-native = "go-native" | 28 | DEPENDS_GOLANG_class-native = "go-native" |
| 29 | 29 | ||
| 30 | DEPENDS_append = " ${DEPENDS_GOLANG}" | 30 | DEPENDS_append = " ${DEPENDS_GOLANG}" |
| @@ -32,14 +32,15 @@ DEPENDS_append = " ${DEPENDS_GOLANG}" | |||
| 32 | export GOBUILDFLAGS ?= "-v" | 32 | export GOBUILDFLAGS ?= "-v" |
| 33 | GOBUILDFLAGS_prepend_task-compile = "${GO_PARALLEL_BUILD} " | 33 | GOBUILDFLAGS_prepend_task-compile = "${GO_PARALLEL_BUILD} " |
| 34 | 34 | ||
| 35 | export GOOS = "${TARGET_GOOS}" | 35 | export GO = "${HOST_PREFIX}go" |
| 36 | export GOARCH = "${TARGET_GOARCH}" | 36 | GOTOOLDIR = "${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go/pkg/tool/${BUILD_GOTUPLE}" |
| 37 | export GOARM = "${TARGET_GOARM}" | 37 | GOTOOLDIR_class-native = "${STAGING_LIBDIR_NATIVE}/go/pkg/tool/${BUILD_GOTUPLE}" |
| 38 | export GOTOOLDIR | ||
| 38 | export CGO_ENABLED = "1" | 39 | export CGO_ENABLED = "1" |
| 39 | export GOROOT | 40 | export GOROOT |
| 40 | export GOROOT_FINAL = "${libdir}/${TARGET_SYS}/go" | 41 | export GOROOT_FINAL = "${libdir}/go" |
| 41 | export GOBIN_FINAL | 42 | export GOBIN_FINAL |
| 42 | export GOPKG_FINAL = "${GOROOT_FINAL}/pkg/${GOOS}_${GOARCH}" | 43 | export GOPKG_FINAL = "${GOROOT_FINAL}/pkg/${TARGET_GOTUPLE}" |
| 43 | export GOSRC_FINAL = "${GOROOT_FINAL}/src" | 44 | export GOSRC_FINAL = "${GOROOT_FINAL}/src" |
| 44 | export GO_GCFLAGS = "${TARGET_CFLAGS}" | 45 | export GO_GCFLAGS = "${TARGET_CFLAGS}" |
| 45 | export GO_LDFLAGS = "${TARGET_LDFLAGS}" | 46 | export GO_LDFLAGS = "${TARGET_LDFLAGS}" |
| @@ -55,6 +56,7 @@ GO_INSTALL ?= "${GO_IMPORT}/..." | |||
| 55 | GO_INSTALL_FILTEROUT ?= "${GO_IMPORT}/vendor/" | 56 | GO_INSTALL_FILTEROUT ?= "${GO_IMPORT}/vendor/" |
| 56 | 57 | ||
| 57 | B = "${WORKDIR}/build" | 58 | B = "${WORKDIR}/build" |
| 59 | export GOPATH = "${B}" | ||
| 58 | 60 | ||
| 59 | python go_do_unpack() { | 61 | python go_do_unpack() { |
| 60 | src_uri = (d.getVar('SRC_URI') or "").split() | 62 | src_uri = (d.getVar('SRC_URI') or "").split() |
| @@ -75,7 +77,7 @@ python go_do_unpack() { | |||
| 75 | } | 77 | } |
| 76 | 78 | ||
| 77 | go_list_packages() { | 79 | go_list_packages() { |
| 78 | GOPATH=${B}:${STAGING_LIBDIR}/${TARGET_SYS}/go go list -f '{{.ImportPath}}' ${GOBUILDFLAGS} ${GO_INSTALL} | \ | 80 | ${GO} list -f '{{.ImportPath}}' ${GOBUILDFLAGS} ${GO_INSTALL} | \ |
| 79 | egrep -v '${GO_INSTALL_FILTEROUT}' | 81 | egrep -v '${GO_INSTALL_FILTEROUT}' |
| 80 | } | 82 | } |
| 81 | 83 | ||
| @@ -84,9 +86,9 @@ go_do_configure() { | |||
| 84 | } | 86 | } |
| 85 | 87 | ||
| 86 | go_do_compile() { | 88 | go_do_compile() { |
| 87 | GOPATH=${B}:${STAGING_LIBDIR}/${TARGET_SYS}/go go env | 89 | ${GO} env |
| 88 | if [ -n "${GO_INSTALL}" ]; then | 90 | if [ -n "${GO_INSTALL}" ]; then |
| 89 | GOPATH=${B}:${STAGING_LIBDIR}/${TARGET_SYS}/go go install ${GOBUILDFLAGS} `go_list_packages` | 91 | ${GO} install ${GOBUILDFLAGS} `go_list_packages` |
| 90 | fi | 92 | fi |
| 91 | } | 93 | } |
| 92 | do_compile[cleandirs] = "${B}/bin ${B}/pkg" | 94 | do_compile[cleandirs] = "${B}/bin ${B}/pkg" |
