summaryrefslogtreecommitdiffstats
path: root/recipes-containers/kubernetes/go-cross.inc
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-containers/kubernetes/go-cross.inc')
-rw-r--r--recipes-containers/kubernetes/go-cross.inc62
1 files changed, 62 insertions, 0 deletions
diff --git a/recipes-containers/kubernetes/go-cross.inc b/recipes-containers/kubernetes/go-cross.inc
new file mode 100644
index 00000000..3d344a74
--- /dev/null
+++ b/recipes-containers/kubernetes/go-cross.inc
@@ -0,0 +1,62 @@
1inherit cross
2
3PROVIDES = "virtual/${TUNE_PKGARCH}-go"
4DEPENDS = "go-native"
5
6PN = "go-cross-${TUNE_PKGARCH}"
7
8export GOHOSTOS = "${BUILD_GOOS}"
9export GOHOSTARCH = "${BUILD_GOARCH}"
10export GOOS = "${TARGET_GOOS}"
11export GOARCH = "${TARGET_GOARCH}"
12export GOARM = "${TARGET_GOARM}"
13export GO386 = "${TARGET_GO386}"
14export GOMIPS = "${TARGET_GOMIPS}"
15export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go"
16export GOROOT_FINAL = "${libdir}/go"
17export GOCACHE = "${B}/.cache"
18CC = "${@d.getVar('BUILD_CC').strip()}"
19
20do_configure[noexec] = "1"
21
22do_compile() {
23 export CC_FOR_${GOOS}_${GOARCH}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
24 export CXX_FOR_${GOOS}_${GOARCh}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
25 cd src
26 ./make.bash --host-only --no-banner
27 cd ${B}
28}
29do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg"
30do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
31
32make_wrapper() {
33 rm -f ${D}${bindir}/$2
34 cat <<END >${D}${bindir}/$2
35#!/bin/bash
36here=\`dirname \$0\`
37export GOARCH="${TARGET_GOARCH}"
38export GOOS="${TARGET_GOOS}"
39export GOARM="\${GOARM:-${TARGET_GOARM}}"
40export GO386="\${GO386:-${TARGET_GO386}}"
41export GOMIPS="\${GOMIPS:-${TARGET_GOMIPS}}"
42\$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@"
43END
44 chmod +x ${D}${bindir}/$2
45}
46
47do_install() {
48 install -d ${D}${libdir}/go
49 cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
50 install -d ${D}${libdir}/go/src
51 (cd ${S}/src; for d in *; do \
52 [ ! -d $d ] || cp --preserve=mode,timestamps -R ${S}/src/$d ${D}${libdir}/go/src/; \
53 done)
54 find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \;
55 install -d ${D}${bindir} ${D}${libdir}/go/bin
56 for f in ${B}/bin/*
57 do
58 base=`basename $f`
59 install -m755 $f ${D}${libdir}/go/bin
60 make_wrapper $base ${TARGET_PREFIX}$base
61 done
62}