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-runtime.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-runtime.inc')
| -rw-r--r-- | meta/recipes-devtools/go/go-runtime.inc | 58 |
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 @@ | |||
| 1 | DEPENDS = "virtual/${TARGET_PREFIX}go go-native" | ||
| 2 | PROVIDES = "virtual/${TARGET_PREFIX}go-runtime" | ||
| 3 | |||
| 4 | export GOHOSTOS = "${BUILD_GOOS}" | ||
| 5 | export GOHOSTARCH = "${BUILD_GOARCH}" | ||
| 6 | export GOOS = "${TARGET_GOOS}" | ||
| 7 | export GOARCH = "${TARGET_GOARCH}" | ||
| 8 | export GOARM = "${TARGET_GOARM}" | ||
| 9 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" | ||
| 10 | export GOROOT_FINAL = "${libdir}/go" | ||
| 11 | export GO_TARGET_INSTALL = "std" | ||
| 12 | export CGO_ENABLED = "1" | ||
| 13 | export CC_FOR_TARGET="${CC}" | ||
| 14 | export CXX_FOR_TARGET="${CXX}" | ||
| 15 | export GOROOT_OVERRIDE = "1" | ||
| 16 | |||
| 17 | do_configure[noexec] = "1" | ||
| 18 | |||
| 19 | do_compile() { | ||
| 20 | export GOBIN="${B}/bin" | ||
| 21 | export CC="${@d.getVar('BUILD_CC').strip()}" | ||
| 22 | rm -rf ${GOBIN} ${B}/pkg | ||
| 23 | mkdir ${GOBIN} | ||
| 24 | cd src | ||
| 25 | GO_FLAGS="" ./make.bash | ||
| 26 | cd ${B} | ||
| 27 | } | ||
| 28 | |||
| 29 | do_install() { | ||
| 30 | install -d ${D}${libdir}/go/src | ||
| 31 | cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/ | ||
| 32 | if [ "${BUILD_GOTUPLE}" != "${TARGET_GOTUPLE}" ]; then | ||
| 33 | rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE} | ||
| 34 | rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE} | ||
| 35 | fi | ||
| 36 | rm -rf ${D}${libdir}/go/pkg/tool | ||
| 37 | rm -rf ${D}${libdir}/go/pkg/obj | ||
| 38 | rm -rf ${D}${libdir}/go/pkg/bootstrap | ||
| 39 | find src -mindepth 1 -maxdepth 1 -type d | while read srcdir; do | ||
| 40 | [ "$srcdir" = "./cmd" ] || cp --preserve=mode,timestamps -R $srcdir ${D}${libdir}/go/src/ | ||
| 41 | done | ||
| 42 | } | ||
| 43 | |||
| 44 | # These testdata directories aren't needed for builds and contain binaries | ||
| 45 | # that can cause errors in sysroot_strip(), so just remove them. | ||
| 46 | sysroot_stage_all_append() { | ||
| 47 | find ${SYSROOT_DESTDIR}${libdir}/go/src -depth -type d -name 'testdata' -exec rm -rf {} \; | ||
| 48 | } | ||
| 49 | |||
| 50 | ALLOW_EMPTY_${PN} = "1" | ||
| 51 | FILES_${PN}-dev = "${libdir}/go/src ${libdir}/go/pkg/include" | ||
| 52 | FILES_${PN}-staticdev = "${libdir}/go/pkg/${TARGET_GOTUPLE} ${libdir}/go/pkg/${TARGET_GOTUPLE}" | ||
| 53 | # The testdata directories in the source tree include some binaries for various | ||
| 54 | # architectures, scripts, and .a files | ||
| 55 | INSANE_SKIP_${PN}-dev = "staticdev ldflags file-rdeps arch" | ||
| 56 | |||
| 57 | INHIBIT_PACKAGE_STRIP = "1" | ||
| 58 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" | ||
