summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/go/go-cross.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:55:29 +0100
commit9060b87711ffc5892c343165236ec40e5e3478e6 (patch)
treeb3b1d79264f22f000140d703849ba8ae4d41e010 /meta/recipes-devtools/go/go-cross.inc
parent2a7a37e70d3709a0e2ca96d0341bbde102ee9978 (diff)
downloadpoky-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/recipes-devtools/go/go-cross.inc')
-rw-r--r--meta/recipes-devtools/go/go-cross.inc61
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 @@
1inherit cross 1inherit cross
2 2
3DEPENDS += "gcc-cross-${TARGET_ARCH}" 3PROVIDES = "virtual/${TARGET_PREFIX}go"
4DEPENDS += "go-native"
4 5
5PN = "go-cross-${TARGET_ARCH}" 6PN = "go-cross-${TARGET_ARCH}"
6 7
7# Ignore how TARGET_ARCH is computed. 8export GOHOSTOS = "${BUILD_GOOS}"
8TARGET_ARCH[vardepvalue] = "${TARGET_ARCH}" 9export GOHOSTARCH = "${BUILD_GOARCH}"
9# Ignore target os libc for cross compiler 10export GOOS = "${TARGET_GOOS}"
10#TARGET_OS[vardepexclude] = "LIBCEXTENSION" 11export GOARCH = "${TARGET_GOARCH}"
11FILESEXTRAPATHS =. "${FILE_DIRNAME}/go-cross:" 12export GOARM = "${TARGET_GOARM}"
13export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go"
14export GOROOT_FINAL = "${libdir}/go"
15export CGO_ENABLED = "1"
16export CC_FOR_TARGET="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
17export CXX_FOR_TARGET="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
18CC = "${@d.getVar('BUILD_CC', True).strip()}"
12 19
13GOROOT_FINAL = "${libdir}/go" 20do_configure[noexec] = "1"
14export GOROOT_FINAL
15 21
22do_compile() {
23 export GOBIN="${B}/bin"
24 rm -rf ${GOBIN} ${B}/pkg
25 mkdir ${GOBIN}
26 cd src
27 ./make.bash --host-only
28 cd ${B}
29}
30
31
32make_wrapper() {
33 rm -f ${D}${bindir}/$2
34 cat <<END >${D}${bindir}/$2
35#!/bin/bash
36here=\`dirname \$0\`
37export GOARCH="${TARGET_GOARCH}"
38export GOOS="${TARGET_GOOS}"
39export GOARM="${TARGET_GOARM}"
40\$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@"
41END
42 chmod +x ${D}${bindir}/$2
43}
44
45do_install() {
46 install -d ${D}${libdir}/go
47 cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
48 install -d ${D}${libdir}/go/src
49 (cd ${S}/src; for d in *; do \
50 [ ! -d $d ] || cp --preserve=mode,timestamps -R ${S}/src/$d ${D}${libdir}/go/src/; \
51 done)
52
53 install -d ${D}${bindir} ${D}${libdir}/go/bin
54 for f in ${B}/bin/*
55 do
56 base=`basename $f`
57 install -m755 $f ${D}${libdir}/go/bin
58 make_wrapper $base ${TARGET_PREFIX}$base
59 done
60}