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:55:29 +0100 |
commit | 9060b87711ffc5892c343165236ec40e5e3478e6 (patch) | |
tree | b3b1d79264f22f000140d703849ba8ae4d41e010 /meta/recipes-devtools/go/go-cross.inc | |
parent | 2a7a37e70d3709a0e2ca96d0341bbde102ee9978 (diff) | |
download | poky-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.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 @@ | |||
1 | inherit cross | 1 | inherit cross |
2 | 2 | ||
3 | DEPENDS += "gcc-cross-${TARGET_ARCH}" | 3 | PROVIDES = "virtual/${TARGET_PREFIX}go" |
4 | DEPENDS += "go-native" | ||
4 | 5 | ||
5 | PN = "go-cross-${TARGET_ARCH}" | 6 | PN = "go-cross-${TARGET_ARCH}" |
6 | 7 | ||
7 | # Ignore how TARGET_ARCH is computed. | 8 | export GOHOSTOS = "${BUILD_GOOS}" |
8 | TARGET_ARCH[vardepvalue] = "${TARGET_ARCH}" | 9 | export GOHOSTARCH = "${BUILD_GOARCH}" |
9 | # Ignore target os libc for cross compiler | 10 | export GOOS = "${TARGET_GOOS}" |
10 | #TARGET_OS[vardepexclude] = "LIBCEXTENSION" | 11 | export GOARCH = "${TARGET_GOARCH}" |
11 | FILESEXTRAPATHS =. "${FILE_DIRNAME}/go-cross:" | 12 | export GOARM = "${TARGET_GOARM}" |
13 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" | ||
14 | export GOROOT_FINAL = "${libdir}/go" | ||
15 | export CGO_ENABLED = "1" | ||
16 | export CC_FOR_TARGET="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" | ||
17 | export CXX_FOR_TARGET="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" | ||
18 | CC = "${@d.getVar('BUILD_CC', True).strip()}" | ||
12 | 19 | ||
13 | GOROOT_FINAL = "${libdir}/go" | 20 | do_configure[noexec] = "1" |
14 | export GOROOT_FINAL | ||
15 | 21 | ||
22 | do_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 | |||
32 | make_wrapper() { | ||
33 | rm -f ${D}${bindir}/$2 | ||
34 | cat <<END >${D}${bindir}/$2 | ||
35 | #!/bin/bash | ||
36 | here=\`dirname \$0\` | ||
37 | export GOARCH="${TARGET_GOARCH}" | ||
38 | export GOOS="${TARGET_GOOS}" | ||
39 | export GOARM="${TARGET_GOARM}" | ||
40 | \$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@" | ||
41 | END | ||
42 | chmod +x ${D}${bindir}/$2 | ||
43 | } | ||
44 | |||
45 | do_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 | } | ||