diff options
Diffstat (limited to 'recipes-containers/kubernetes/go-cross.inc')
-rw-r--r-- | recipes-containers/kubernetes/go-cross.inc | 62 |
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 @@ | |||
1 | inherit cross | ||
2 | |||
3 | PROVIDES = "virtual/${TUNE_PKGARCH}-go" | ||
4 | DEPENDS = "go-native" | ||
5 | |||
6 | PN = "go-cross-${TUNE_PKGARCH}" | ||
7 | |||
8 | export GOHOSTOS = "${BUILD_GOOS}" | ||
9 | export GOHOSTARCH = "${BUILD_GOARCH}" | ||
10 | export GOOS = "${TARGET_GOOS}" | ||
11 | export GOARCH = "${TARGET_GOARCH}" | ||
12 | export GOARM = "${TARGET_GOARM}" | ||
13 | export GO386 = "${TARGET_GO386}" | ||
14 | export GOMIPS = "${TARGET_GOMIPS}" | ||
15 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" | ||
16 | export GOROOT_FINAL = "${libdir}/go" | ||
17 | export GOCACHE = "${B}/.cache" | ||
18 | CC = "${@d.getVar('BUILD_CC').strip()}" | ||
19 | |||
20 | do_configure[noexec] = "1" | ||
21 | |||
22 | do_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 | } | ||
29 | do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg" | ||
30 | do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg" | ||
31 | |||
32 | make_wrapper() { | ||
33 | rm -f ${D}${bindir}/$2 | ||
34 | cat <<END >${D}${bindir}/$2 | ||
35 | #!/bin/bash | ||
36 | here=\`dirname \$0\` | ||
37 | export GOARCH="${TARGET_GOARCH}" | ||
38 | export GOOS="${TARGET_GOOS}" | ||
39 | export GOARM="\${GOARM:-${TARGET_GOARM}}" | ||
40 | export GO386="\${GO386:-${TARGET_GO386}}" | ||
41 | export GOMIPS="\${GOMIPS:-${TARGET_GOMIPS}}" | ||
42 | \$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@" | ||
43 | END | ||
44 | chmod +x ${D}${bindir}/$2 | ||
45 | } | ||
46 | |||
47 | do_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 | } | ||