From 9060b87711ffc5892c343165236ec40e5e3478e6 Mon Sep 17 00:00:00 2001 From: Matt Madison Date: Tue, 12 Sep 2017 09:50:21 -0300 Subject: 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/ 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 Signed-off-by: Otavio Salvador Signed-off-by: Richard Purdie --- meta/classes/go.bbclass | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'meta/classes/go.bbclass') 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): GO_PARALLEL_BUILD ?= "${@get_go_parallel_make(d)}" GOROOT_class-native = "${STAGING_LIBDIR_NATIVE}/go" -GOROOT = "${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go" +GOROOT = "${STAGING_LIBDIR}/go" GOBIN_FINAL_class-native = "${GOROOT_FINAL}/bin" GOBIN_FINAL = "${GOROOT_FINAL}/${GO_BUILD_BINDIR}" -DEPENDS_GOLANG_class-target = "go-cross-${TARGET_ARCH}" +DEPENDS_GOLANG_class-target = "virtual/${TARGET_PREFIX}go virtual/${TARGET_PREFIX}go-runtime" DEPENDS_GOLANG_class-native = "go-native" DEPENDS_append = " ${DEPENDS_GOLANG}" @@ -32,14 +32,15 @@ DEPENDS_append = " ${DEPENDS_GOLANG}" export GOBUILDFLAGS ?= "-v" GOBUILDFLAGS_prepend_task-compile = "${GO_PARALLEL_BUILD} " -export GOOS = "${TARGET_GOOS}" -export GOARCH = "${TARGET_GOARCH}" -export GOARM = "${TARGET_GOARM}" +export GO = "${HOST_PREFIX}go" +GOTOOLDIR = "${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go/pkg/tool/${BUILD_GOTUPLE}" +GOTOOLDIR_class-native = "${STAGING_LIBDIR_NATIVE}/go/pkg/tool/${BUILD_GOTUPLE}" +export GOTOOLDIR export CGO_ENABLED = "1" export GOROOT -export GOROOT_FINAL = "${libdir}/${TARGET_SYS}/go" +export GOROOT_FINAL = "${libdir}/go" export GOBIN_FINAL -export GOPKG_FINAL = "${GOROOT_FINAL}/pkg/${GOOS}_${GOARCH}" +export GOPKG_FINAL = "${GOROOT_FINAL}/pkg/${TARGET_GOTUPLE}" export GOSRC_FINAL = "${GOROOT_FINAL}/src" export GO_GCFLAGS = "${TARGET_CFLAGS}" export GO_LDFLAGS = "${TARGET_LDFLAGS}" @@ -55,6 +56,7 @@ GO_INSTALL ?= "${GO_IMPORT}/..." GO_INSTALL_FILTEROUT ?= "${GO_IMPORT}/vendor/" B = "${WORKDIR}/build" +export GOPATH = "${B}" python go_do_unpack() { src_uri = (d.getVar('SRC_URI') or "").split() @@ -75,7 +77,7 @@ python go_do_unpack() { } go_list_packages() { - GOPATH=${B}:${STAGING_LIBDIR}/${TARGET_SYS}/go go list -f '{{.ImportPath}}' ${GOBUILDFLAGS} ${GO_INSTALL} | \ + ${GO} list -f '{{.ImportPath}}' ${GOBUILDFLAGS} ${GO_INSTALL} | \ egrep -v '${GO_INSTALL_FILTEROUT}' } @@ -84,9 +86,9 @@ go_do_configure() { } go_do_compile() { - GOPATH=${B}:${STAGING_LIBDIR}/${TARGET_SYS}/go go env + ${GO} env if [ -n "${GO_INSTALL}" ]; then - GOPATH=${B}:${STAGING_LIBDIR}/${TARGET_SYS}/go go install ${GOBUILDFLAGS} `go_list_packages` + ${GO} install ${GOBUILDFLAGS} `go_list_packages` fi } do_compile[cleandirs] = "${B}/bin ${B}/pkg" -- cgit v1.2.3-54-g00ecf