summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/go/go-runtime.inc
diff options
context:
space:
mode:
authorMatt Madison <matt@madison.systems>2017-09-12 09:50:21 -0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-09-12 23:51:37 +0100
commitd2a7af7cd834e218c39d43ee3fa0c14d4f748727 (patch)
treedcf3007032b00a663a84e1259eac7693e2559184 /meta/recipes-devtools/go/go-runtime.inc
parentd9f54865ac90ed8d39a70b7989b1bf43ab26e248 (diff)
downloadopenembedded-core-contrib-d2a7af7cd834e218c39d43ee3fa0c14d4f748727.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. 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/recipes-devtools/go/go-runtime.inc')
-rw-r--r--meta/recipes-devtools/go/go-runtime.inc58
1 files changed, 58 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-runtime.inc b/meta/recipes-devtools/go/go-runtime.inc
new file mode 100644
index 0000000000..e3eddda837
--- /dev/null
+++ b/meta/recipes-devtools/go/go-runtime.inc
@@ -0,0 +1,58 @@
+DEPENDS = "virtual/${TARGET_PREFIX}go go-native"
+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 GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go"
+export GOROOT_FINAL = "${libdir}/go"
+export GO_TARGET_INSTALL = "std"
+export CGO_ENABLED = "1"
+export CC_FOR_TARGET="${CC}"
+export CXX_FOR_TARGET="${CXX}"
+export GOROOT_OVERRIDE = "1"
+
+do_configure[noexec] = "1"
+
+do_compile() {
+ export GOBIN="${B}/bin"
+ export CC="${@d.getVar('BUILD_CC').strip()}"
+ rm -rf ${GOBIN} ${B}/pkg
+ mkdir ${GOBIN}
+ cd src
+ GO_FLAGS="" ./make.bash
+ cd ${B}
+}
+
+do_install() {
+ install -d ${D}${libdir}/go/src
+ cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
+ if [ "${BUILD_GOTUPLE}" != "${TARGET_GOTUPLE}" ]; then
+ rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE}
+ rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE}
+ fi
+ rm -rf ${D}${libdir}/go/pkg/tool
+ rm -rf ${D}${libdir}/go/pkg/obj
+ rm -rf ${D}${libdir}/go/pkg/bootstrap
+ find src -mindepth 1 -maxdepth 1 -type d | while read srcdir; do
+ [ "$srcdir" = "./cmd" ] || cp --preserve=mode,timestamps -R $srcdir ${D}${libdir}/go/src/
+ done
+}
+
+# These testdata directories aren't needed for builds and contain binaries
+# that can cause errors in sysroot_strip(), so just remove them.
+sysroot_stage_all_append() {
+ find ${SYSROOT_DESTDIR}${libdir}/go/src -depth -type d -name 'testdata' -exec rm -rf {} \;
+}
+
+ALLOW_EMPTY_${PN} = "1"
+FILES_${PN}-dev = "${libdir}/go/src ${libdir}/go/pkg/include"
+FILES_${PN}-staticdev = "${libdir}/go/pkg/${TARGET_GOTUPLE} ${libdir}/go/pkg/${TARGET_GOTUPLE}"
+# The testdata directories in the source tree include some binaries for various
+# architectures, scripts, and .a files
+INSANE_SKIP_${PN}-dev = "staticdev ldflags file-rdeps arch"
+
+INHIBIT_PACKAGE_STRIP = "1"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"