summaryrefslogtreecommitdiffstats
path: root/recipes-containers/kubernetes/go-crosssdk.inc
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-containers/kubernetes/go-crosssdk.inc')
-rw-r--r--recipes-containers/kubernetes/go-crosssdk.inc50
1 files changed, 50 insertions, 0 deletions
diff --git a/recipes-containers/kubernetes/go-crosssdk.inc b/recipes-containers/kubernetes/go-crosssdk.inc
new file mode 100644
index 00000000..94f6fb8e
--- /dev/null
+++ b/recipes-containers/kubernetes/go-crosssdk.inc
@@ -0,0 +1,50 @@
1inherit crosssdk
2
3DEPENDS = "go-native virtual/${TARGET_PREFIX}gcc-crosssdk virtual/nativesdk-${TARGET_PREFIX}compilerlibs virtual/${TARGET_PREFIX}binutils-crosssdk"
4PN = "go-crosssdk-${SDK_SYS}"
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"
13
14do_configure[noexec] = "1"
15
16do_compile() {
17 export CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}"
18 export CXX_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}"
19 cd src
20 ./make.bash --host-only --no-banner
21 cd ${B}
22}
23do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg"
24do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
25
26make_wrapper() {
27 rm -f ${D}${bindir}/$2
28 cat <<END >${D}${bindir}/$2
29#!/bin/bash
30here=\`dirname \$0\`
31export GOARCH="${TARGET_GOARCH}"
32export GOOS="${TARGET_GOOS}"
33\$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@"
34END
35 chmod +x ${D}${bindir}/$2
36}
37
38do_install() {
39 install -d ${D}${libdir}/go
40 install -d ${D}${libdir}/go/bin
41 install -d ${D}${libdir}/go/pkg/tool
42 install -d ${D}${bindir}
43 cp --preserve=mode,timestamps -R ${S}/pkg/tool/${BUILD_GOTUPLE} ${D}${libdir}/go/pkg/tool/
44 for f in ${B}/bin/*
45 do
46 base=`basename $f`
47 install -m755 $f ${D}${libdir}/go/bin
48 make_wrapper $base ${TARGET_PREFIX}$base
49 done
50}