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:51:37 +0100 |
commit | d2a7af7cd834e218c39d43ee3fa0c14d4f748727 (patch) | |
tree | dcf3007032b00a663a84e1259eac7693e2559184 /meta/recipes-devtools/go/go-cross.inc | |
parent | d9f54865ac90ed8d39a70b7989b1bf43ab26e248 (diff) | |
download | openembedded-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-cross.inc')
-rw-r--r-- | meta/recipes-devtools/go/go-cross.inc | 61 |
1 files changed, 53 insertions, 8 deletions
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 <<END >${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 +} |