summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/go/go-crosssdk.inc
diff options
context:
space:
mode:
authorMatt Madison <matt@madison.systems>2017-09-12 09:50:29 -0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-09-12 23:55:29 +0100
commit4ccb075cdd39fedfe66f046e34b96c1d40edfcfc (patch)
tree236d824299ae938ae38b166af7055e75f4112497 /meta/recipes-devtools/go/go-crosssdk.inc
parent065bd819e1d4bf06b74253120153fd2a7593a059 (diff)
downloadpoky-4ccb075cdd39fedfe66f046e34b96c1d40edfcfc.tar.gz
go-crosssdk: add recipe
Enable crosssdk builds for the Go toolchain. (From OE-Core rev: 5dbca2ab4ab9fdd200bbc8eb0572098e6fdbac84) 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-crosssdk.inc')
-rw-r--r--meta/recipes-devtools/go/go-crosssdk.inc55
1 files changed, 55 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-crosssdk.inc b/meta/recipes-devtools/go/go-crosssdk.inc
new file mode 100644
index 0000000000..e9bc677131
--- /dev/null
+++ b/meta/recipes-devtools/go/go-crosssdk.inc
@@ -0,0 +1,55 @@
1inherit crosssdk
2
3DEPENDS = "go-native virtual/${TARGET_PREFIX}gcc-crosssdk virtual/nativesdk-${TARGET_PREFIX}compilerlibs virtual/${TARGET_PREFIX}binutils-crosssdk"
4PN = "go-crosssdk-${TARGET_ARCH}"
5PROVIDES = "virtual/${TARGET_PREFIX}go-crosssdk"
6
7export GOHOSTOS = "${BUILD_GOOS}"
8export GOHOSTARCH = "${BUILD_GOARCH}"
9export GOOS = "${TARGET_GOOS}"
10export GOARCH = "${TARGET_GOARCH}"
11export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go"
12export GOROOT_FINAL = "${libdir}/go"
13export CGO_ENABLED = "1"
14export CC_FOR_TARGET="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
15export CXX_FOR_TARGET="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
16CC = "${@d.getVar('BUILD_CC', True).strip()}"
17
18do_configure[noexec] = "1"
19
20do_compile() {
21 export GOBIN="${B}/bin"
22 rm -rf ${GOBIN} ${B}/pkg
23 mkdir ${GOBIN}
24 cd src
25 ./make.bash --host-only
26 cd ${B}
27}
28
29make_wrapper() {
30 rm -f ${D}${bindir}/$2
31 cat <<END >${D}${bindir}/$2
32#!/bin/bash
33here=\`dirname \$0\`
34export GOARCH="${TARGET_GOARCH}"
35export GOOS="${TARGET_GOOS}"
36\$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@"
37END
38 chmod +x ${D}${bindir}/$2
39}
40
41do_install() {
42 install -d ${D}${libdir}/go
43 install -d ${D}${libdir}/go/bin
44 install -d ${D}${libdir}/go/pkg/tool
45 install -d ${D}${bindir}
46 cp --preserve=mode,timestamps -R ${S}/pkg/tool/${TARGET_GOTUPLE} ${D}${libdir}/go/pkg/tool/
47 for f in ${B}/${GO_BUILD_BINDIR}/*
48 do
49 base=`basename $f`
50 install -m755 $f ${D}${libdir}/go/bin
51 make_wrapper $base ${TARGET_PREFIX}$base
52 done
53}
54
55FILES_${PN}-staticdev = "${libdir}/go/pkg"