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/recipes-devtools/go/go-cross.inc | 61 ++++++++++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 8 deletions(-) (limited to 'meta/recipes-devtools/go/go-cross.inc') diff --git a/meta/recipes-devtools/go/go-cross.inc b/meta/recipes-devtools/go/go-cross.inc index 1c2d9e3a3d..df3e4ea914 100644 --- a/meta/recipes-devtools/go/go-cross.inc +++ b/meta/recipes-devtools/go/go-cross.inc @@ -1,15 +1,60 @@ inherit cross -DEPENDS += "gcc-cross-${TARGET_ARCH}" +PROVIDES = "virtual/${TARGET_PREFIX}go" +DEPENDS += "go-native" PN = "go-cross-${TARGET_ARCH}" -# Ignore how TARGET_ARCH is computed. -TARGET_ARCH[vardepvalue] = "${TARGET_ARCH}" -# Ignore target os libc for cross compiler -#TARGET_OS[vardepexclude] = "LIBCEXTENSION" -FILESEXTRAPATHS =. "${FILE_DIRNAME}/go-cross:" +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 CGO_ENABLED = "1" +export CC_FOR_TARGET="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" +export CXX_FOR_TARGET="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" +CC = "${@d.getVar('BUILD_CC', True).strip()}" -GOROOT_FINAL = "${libdir}/go" -export GOROOT_FINAL +do_configure[noexec] = "1" +do_compile() { + export GOBIN="${B}/bin" + rm -rf ${GOBIN} ${B}/pkg + mkdir ${GOBIN} + cd src + ./make.bash --host-only + cd ${B} +} + + +make_wrapper() { + rm -f ${D}${bindir}/$2 + cat <${D}${bindir}/$2 +#!/bin/bash +here=\`dirname \$0\` +export GOARCH="${TARGET_GOARCH}" +export GOOS="${TARGET_GOOS}" +export GOARM="${TARGET_GOARM}" +\$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@" +END + chmod +x ${D}${bindir}/$2 +} + +do_install() { + install -d ${D}${libdir}/go + cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/ + install -d ${D}${libdir}/go/src + (cd ${S}/src; for d in *; do \ + [ ! -d $d ] || cp --preserve=mode,timestamps -R ${S}/src/$d ${D}${libdir}/go/src/; \ + done) + + install -d ${D}${bindir} ${D}${libdir}/go/bin + for f in ${B}/bin/* + do + base=`basename $f` + install -m755 $f ${D}${libdir}/go/bin + make_wrapper $base ${TARGET_PREFIX}$base + done +} -- cgit v1.2.3-54-g00ecf