summaryrefslogtreecommitdiffstats
path: root/recipes-containers/kubernetes/go-cross.inc
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2019-12-09 16:10:59 +0800
committerBruce Ashfield <bruce.ashfield@gmail.com>2019-12-10 02:26:15 -0500
commit06dad20a32c81b6a8b6e93c99cda6f1133abddc6 (patch)
tree330233c2bf4c12dfa7d2bed28384ca1ede512b38 /recipes-containers/kubernetes/go-cross.inc
parentc31e46fce79f32a6692358105e15d77c652a9c9a (diff)
downloadmeta-virtualization-06dad20a32c81b6a8b6e93c99cda6f1133abddc6.tar.gz
go: add back 1.12 version to avoid compilation failure
go 1.12 was removed from oe-core, but currently k8s cannot be built successfully with go 1.13. See link below. https://github.com/kubernetes/kubernetes/issues/82531 We need to wait for k8s to support go 1.13 and update it to latest release, as well as its depedencies. Before this is done, add back go 1.12 and use it. Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
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}