diff options
Diffstat (limited to 'recipes-containers/kubernetes/go-target.inc')
-rw-r--r-- | recipes-containers/kubernetes/go-target.inc | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/recipes-containers/kubernetes/go-target.inc b/recipes-containers/kubernetes/go-target.inc new file mode 100644 index 00000000..91efd3e9 --- /dev/null +++ b/recipes-containers/kubernetes/go-target.inc | |||
@@ -0,0 +1,54 @@ | |||
1 | DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native" | ||
2 | DEPENDS_class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk go-native" | ||
3 | |||
4 | export GOHOSTOS = "${BUILD_GOOS}" | ||
5 | export GOHOSTARCH = "${BUILD_GOARCH}" | ||
6 | export GOOS = "${TARGET_GOOS}" | ||
7 | export GOARCH = "${TARGET_GOARCH}" | ||
8 | export GOARM = "${TARGET_GOARM}" | ||
9 | export GO386 = "${TARGET_GO386}" | ||
10 | export GOMIPS = "${TARGET_GOMIPS}" | ||
11 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" | ||
12 | export GOROOT_FINAL = "${libdir}/go" | ||
13 | export GOCACHE = "${B}/.cache" | ||
14 | GO_LDFLAGS = "" | ||
15 | GO_LDFLAGS_class-nativesdk = "-linkmode external" | ||
16 | export GO_LDFLAGS | ||
17 | |||
18 | CC_append_class-nativesdk = " ${SECURITY_NOPIE_CFLAGS}" | ||
19 | |||
20 | do_configure[noexec] = "1" | ||
21 | |||
22 | do_compile() { | ||
23 | export CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CC}" | ||
24 | export CXX_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CXX}" | ||
25 | |||
26 | cd src | ||
27 | ./make.bash --target-only --no-banner | ||
28 | cd ${B} | ||
29 | } | ||
30 | do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg" | ||
31 | do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg" | ||
32 | |||
33 | do_install() { | ||
34 | install -d ${D}${libdir}/go/pkg/tool | ||
35 | cp --preserve=mode,timestamps -R ${B}/pkg/tool/${TARGET_GOTUPLE} ${D}${libdir}/go/pkg/tool/ | ||
36 | install -d ${D}${libdir}/go/src | ||
37 | cp --preserve=mode,timestamps -R ${S}/src/cmd ${D}${libdir}/go/src/ | ||
38 | find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \; | ||
39 | install -d ${D}${libdir}/go/bin | ||
40 | install -d ${D}${bindir} | ||
41 | for f in ${B}/${GO_BUILD_BINDIR}/*; do | ||
42 | name=`basename $f` | ||
43 | install -m 0755 $f ${D}${libdir}/go/bin/ | ||
44 | ln -sf ../${baselib}/go/bin/$name ${D}${bindir}/ | ||
45 | done | ||
46 | } | ||
47 | |||
48 | PACKAGES = "${PN} ${PN}-dev" | ||
49 | FILES_${PN} = "${libdir}/go/bin ${libdir}/go/pkg/tool/${TARGET_GOTUPLE} ${bindir}" | ||
50 | FILES_${PN}-dev = "${libdir}/go" | ||
51 | RDEPENDS_${PN}-dev = "perl bash" | ||
52 | INSANE_SKIP_${PN} = "ldflags" | ||
53 | |||
54 | BBCLASSEXTEND = "nativesdk" | ||