summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/go/go-cross-canadian.inc
diff options
context:
space:
mode:
authorMatt Madison <matt@madison.systems>2017-09-14 16:22:29 -0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-09-21 09:05:50 +0100
commit6590c03808c0c6728c6fa914c6bfecf72de1e95a (patch)
tree88a0bb0b63ae0be409fe76eaa7ce3dacdc57788f /meta/recipes-devtools/go/go-cross-canadian.inc
parent975246ffe6e053820c6929454c3d73fb329c54a1 (diff)
downloadpoky-6590c03808c0c6728c6fa914c6bfecf72de1e95a.tar.gz
go: fixes for cross-canadian builds
* Add patch for go's make script to allow for build system != host system * Add dependencies on the appropriate crosssdk recipes, and use the crosssdk C compiler and linker * Remove bashism in the wrapper script * Restrict installation to only the tool binaries to address some packaging errors (From OE-Core rev: e2171f14a2dbf630a926a6792f6e6355f80e18b1) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/go/go-cross-canadian.inc')
-rw-r--r--meta/recipes-devtools/go/go-cross-canadian.inc40
1 files changed, 18 insertions, 22 deletions
diff --git a/meta/recipes-devtools/go/go-cross-canadian.inc b/meta/recipes-devtools/go/go-cross-canadian.inc
index 0068f34d04..f3ab7351db 100644
--- a/meta/recipes-devtools/go/go-cross-canadian.inc
+++ b/meta/recipes-devtools/go/go-cross-canadian.inc
@@ -1,21 +1,24 @@
1inherit cross-canadian 1inherit cross-canadian
2 2
3DEPENDS = "go-native virtual/${HOST_PREFIX}gcc-crosssdk virtual/nativesdk-${HOST_PREFIX}libc-for-gcc virtual/nativesdk-${HOST_PREFIX}compilerlibs" 3DEPENDS = "go-native virtual/${HOST_PREFIX}go-crosssdk virtual/nativesdk-${HOST_PREFIX}go-runtime \
4 virtual/${HOST_PREFIX}gcc-crosssdk virtual/nativesdk-${HOST_PREFIX}libc-for-gcc \
5 virtual/nativesdk-${HOST_PREFIX}compilerlibs"
4PN = "go-cross-canadian-${TRANSLATED_TARGET_ARCH}" 6PN = "go-cross-canadian-${TRANSLATED_TARGET_ARCH}"
5 7
6export GOHOSTOS = "${BUILD_GOOS}" 8export GOHOSTOS = "${BUILD_GOOS}"
7export GOHOSTARCH = "${BUILD_GOARCH}" 9export GOHOSTARCH = "${BUILD_GOARCH}"
8export GOOS = "${HOST_GOOS}" 10export GOHOSTOS_CROSS = "${HOST_GOOS}"
9export GOARCH = "${HOST_GOARCH}" 11export GOHOSTARCH_CROSS = "${HOST_GOARCH}"
10export GOARM = "${HOST_GOARM}"
11export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" 12export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go"
12export GOTOOLDIR_BOOTSTRAP = "${GOROOT_BOOTSTRAP}/pkg/tool/${BUILD_GOTUPLE}" 13export GOTOOLDIR_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/${HOST_SYS}/go/pkg/tool/${BUILD_GOTUPLE}"
13export GOROOT_FINAL = "${libdir}/go" 14export GOROOT_FINAL = "${libdir}/go"
14export CGO_ENABLED = "1" 15export CGO_ENABLED = "1"
15export CC_FOR_TARGET = "${HOST_CC}" 16export CC_FOR_TARGET = "${TARGET_PREFIX}gcc"
16export CXX_FOR_TARGET = "${HOST_CXX}" 17export CXX_FOR_TARGET = "${TARGET_PREFIX}g++"
17CC = "${@d.getVar('BUILD_CC', True).strip()}" 18CC = "${HOST_PREFIX}gcc"
18export GO_LDFLAGS = '-linkmode external -extld ${HOST_PREFIX}gcc -extldflags "${TOOLCHAIN_OPTIONS} ${LDFLAGS}"' 19export CGO_CFLAGS = "--sysroot=${STAGING_DIR_TARGET} ${HOST_CC_ARCH} ${CFLAGS}"
20export CGO_LDFLAGS = "--sysroot=${STAGING_DIR_TARGET} ${HOST_CC_ARCH} ${LDFLAGS}"
21export GO_LDFLAGS = '-linkmode external -extld ${HOST_PREFIX}gcc -extldflags "--sysroot=${STAGING_DIR_TARGET} ${HOST_CC_ARCH} ${LDFLAGS}"'
19 22
20do_configure[noexec] = "1" 23do_configure[noexec] = "1"
21 24
@@ -32,34 +35,27 @@ do_compile() {
32make_wrapper() { 35make_wrapper() {
33 rm -f ${D}${bindir}/$2 36 rm -f ${D}${bindir}/$2
34 cat <<END >${D}${bindir}/$2 37 cat <<END >${D}${bindir}/$2
35#!/bin/bash 38#!/bin/sh
36here=\`dirname \$0\` 39here=\`dirname \$0\`
37native_goroot=\`readlink -f \$here/../../lib/${TARGET_SYS}/go\` 40native_goroot=\`readlink -f \$here/../../lib/${TARGET_SYS}/go\`
38export GOARCH="${TARGET_GOARCH}" 41export GOARCH="${TARGET_GOARCH}"
39export GOOS="${TARGET_GOOS}" 42export GOOS="${TARGET_GOOS}"
40export GOARM="\${GOARM:-${TARGET_GOARM}}" 43test -n "\$GOARM" || export GOARM="${TARGET_GOARM}"
41export GOTOOLDIR="\$native_goroot/pkg/tool/${HOST_GOTUPLE}" 44export GOTOOLDIR="\$native_goroot/pkg/tool/${HOST_GOTUPLE}"
42export GOROOT="\${GOROOT:-\$OECORE_TARGET_SYSROOT/${target_libdir}/go}" 45test -n "\$GOROOT" || export GOROOT="\$OECORE_TARGET_SYSROOT/${target_libdir}/go"
43\$here/../../lib/${TARGET_SYS}/go/bin/$1 "\$@" 46\$here/../../lib/${TARGET_SYS}/go/bin/$1 "\$@"
44END 47END
45 chmod +x ${D}${bindir}/$2 48 chmod +x ${D}${bindir}/$2
46} 49}
47 50
48do_install() { 51do_install() {
49 install -d ${D}${libdir}/go 52 install -d ${D}${libdir}/go/pkg/tool
50 cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/ 53 cp --preserve=mode,timestamps -R ${B}/pkg/tool/${HOST_GOTUPLE} ${D}${libdir}/go/pkg/tool/
51 install -d ${D}${libdir}/go/src
52 (cd ${S}/src; for d in *; do \
53 [ -d $d ] && cp --preserve=mode,timestamps -R ${S}/src/$d ${D}${libdir}/go/src/; \
54 done)
55 rm -rf ${D}${libdir}/go/src/runtime/pprof/testdata
56 install -d ${D}${bindir} ${D}${libdir}/go/bin 54 install -d ${D}${bindir} ${D}${libdir}/go/bin
57 for f in ${B}/bin/* 55 for f in ${B}/${GO_BUILD_BINDIR}/*
58 do 56 do
59 base=`basename $f` 57 base=`basename $f`
60 install -m755 $f ${D}${libdir}/go/bin 58 install -m755 $f ${D}${libdir}/go/bin
61 make_wrapper $base ${TARGET_PREFIX}$base 59 make_wrapper $base ${TARGET_PREFIX}$base
62 done 60 done
63} 61}
64
65FILES_${PN}-staticdev = "${libdir}/go/pkg"