diff options
author | Matt Madison <matt@madison.systems> | 2017-09-12 09:50:29 -0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-09-12 23:55:29 +0100 |
commit | 4ccb075cdd39fedfe66f046e34b96c1d40edfcfc (patch) | |
tree | 236d824299ae938ae38b166af7055e75f4112497 /meta/recipes-devtools/go/go-crosssdk.inc | |
parent | 065bd819e1d4bf06b74253120153fd2a7593a059 (diff) | |
download | poky-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.inc | 55 |
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 @@ | |||
1 | inherit crosssdk | ||
2 | |||
3 | DEPENDS = "go-native virtual/${TARGET_PREFIX}gcc-crosssdk virtual/nativesdk-${TARGET_PREFIX}compilerlibs virtual/${TARGET_PREFIX}binutils-crosssdk" | ||
4 | PN = "go-crosssdk-${TARGET_ARCH}" | ||
5 | PROVIDES = "virtual/${TARGET_PREFIX}go-crosssdk" | ||
6 | |||
7 | export GOHOSTOS = "${BUILD_GOOS}" | ||
8 | export GOHOSTARCH = "${BUILD_GOARCH}" | ||
9 | export GOOS = "${TARGET_GOOS}" | ||
10 | export GOARCH = "${TARGET_GOARCH}" | ||
11 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" | ||
12 | export GOROOT_FINAL = "${libdir}/go" | ||
13 | export CGO_ENABLED = "1" | ||
14 | export CC_FOR_TARGET="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" | ||
15 | export CXX_FOR_TARGET="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" | ||
16 | CC = "${@d.getVar('BUILD_CC', True).strip()}" | ||
17 | |||
18 | do_configure[noexec] = "1" | ||
19 | |||
20 | do_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 | |||
29 | make_wrapper() { | ||
30 | rm -f ${D}${bindir}/$2 | ||
31 | cat <<END >${D}${bindir}/$2 | ||
32 | #!/bin/bash | ||
33 | here=\`dirname \$0\` | ||
34 | export GOARCH="${TARGET_GOARCH}" | ||
35 | export GOOS="${TARGET_GOOS}" | ||
36 | \$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@" | ||
37 | END | ||
38 | chmod +x ${D}${bindir}/$2 | ||
39 | } | ||
40 | |||
41 | do_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 | |||
55 | FILES_${PN}-staticdev = "${libdir}/go/pkg" | ||