diff options
Diffstat (limited to 'recipes-containers/kubernetes/go-crosssdk.inc')
-rw-r--r-- | recipes-containers/kubernetes/go-crosssdk.inc | 50 |
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 @@ | |||
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-${SDK_SYS}" | ||
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 | |||
14 | do_configure[noexec] = "1" | ||
15 | |||
16 | do_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 | } | ||
23 | do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg" | ||
24 | do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg" | ||
25 | |||
26 | make_wrapper() { | ||
27 | rm -f ${D}${bindir}/$2 | ||
28 | cat <<END >${D}${bindir}/$2 | ||
29 | #!/bin/bash | ||
30 | here=\`dirname \$0\` | ||
31 | export GOARCH="${TARGET_GOARCH}" | ||
32 | export GOOS="${TARGET_GOOS}" | ||
33 | \$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@" | ||
34 | END | ||
35 | chmod +x ${D}${bindir}/$2 | ||
36 | } | ||
37 | |||
38 | do_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 | } | ||