diff options
Diffstat (limited to 'recipes-containers/kubernetes/go-runtime.inc')
-rw-r--r-- | recipes-containers/kubernetes/go-runtime.inc | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/recipes-containers/kubernetes/go-runtime.inc b/recipes-containers/kubernetes/go-runtime.inc new file mode 100644 index 00000000..9731e164 --- /dev/null +++ b/recipes-containers/kubernetes/go-runtime.inc | |||
@@ -0,0 +1,96 @@ | |||
1 | DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native" | ||
2 | DEPENDS_class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk" | ||
3 | PROVIDES = "virtual/${TARGET_PREFIX}go-runtime" | ||
4 | |||
5 | export GOHOSTOS = "${BUILD_GOOS}" | ||
6 | export GOHOSTARCH = "${BUILD_GOARCH}" | ||
7 | export GOOS = "${TARGET_GOOS}" | ||
8 | export GOARCH = "${TARGET_GOARCH}" | ||
9 | export GOARM = "${TARGET_GOARM}" | ||
10 | export GO386 = "${TARGET_GO386}" | ||
11 | export GOMIPS = "${TARGET_GOMIPS}" | ||
12 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" | ||
13 | export GOROOT_FINAL = "${libdir}/go" | ||
14 | export CGO_CFLAGS = "${CFLAGS}" | ||
15 | export CGO_CPPFLAGS = "${CPPFLAGS}" | ||
16 | export CGO_CXXFLAGS = "${CXXFLAGS}" | ||
17 | export CGO_LDFLAGS = "${LDFLAGS}" | ||
18 | export GOCACHE = "${B}/.cache" | ||
19 | |||
20 | GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS}" | ||
21 | GO_SHLIB_LDFLAGS ?= '-ldflags="--linkmode=external -extldflags '${GO_EXTLDFLAGS}'"' | ||
22 | |||
23 | do_configure() { | ||
24 | : | ||
25 | } | ||
26 | |||
27 | do_configure_libc-musl() { | ||
28 | rm -f ${S}/src/runtime/race/*.syso | ||
29 | } | ||
30 | |||
31 | do_compile() { | ||
32 | export CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CC}" | ||
33 | export CXX_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CXX}" | ||
34 | |||
35 | cd src | ||
36 | ./make.bash --target-only --no-banner std | ||
37 | if [ -n "${GO_DYNLINK}" ]; then | ||
38 | export GOTOOLDIR="${B}/pkg/tool/native_native" | ||
39 | CC="$CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}" GOARCH="${TARGET_GOARCH}" GOOS="${TARGET_GOOS}" GOROOT=${B} \ | ||
40 | $GOTOOLDIR/go_bootstrap install -linkshared -buildmode=shared ${GO_SHLIB_LDFLAGS} std | ||
41 | fi | ||
42 | cd ${B} | ||
43 | } | ||
44 | do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg" | ||
45 | do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg" | ||
46 | |||
47 | do_install() { | ||
48 | install -d ${D}${libdir}/go/src | ||
49 | cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/ | ||
50 | if [ "${BUILD_GOTUPLE}" != "${TARGET_GOTUPLE}" ]; then | ||
51 | rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE} | ||
52 | rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE} | ||
53 | fi | ||
54 | rm -rf ${D}${libdir}/go/pkg/tool | ||
55 | rm -rf ${D}${libdir}/go/pkg/obj | ||
56 | rm -rf ${D}${libdir}/go/pkg/bootstrap | ||
57 | find src -mindepth 1 -maxdepth 1 -type d | while read srcdir; do | ||
58 | cp --preserve=mode,timestamps -R $srcdir ${D}${libdir}/go/src/ | ||
59 | done | ||
60 | find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \; | ||
61 | rm -f ${D}${libdir}/go/src/cmd/dist/dist | ||
62 | rm -f ${D}${libdir}/go/src/cmd/cgo/zdefaultcc.go | ||
63 | rm -f ${D}${libdir}/go/src/cmd/go/internal/cfg/zdefaultcc.go | ||
64 | |||
65 | } | ||
66 | |||
67 | ALLOW_EMPTY_${PN} = "1" | ||
68 | FILES_${PN} = "${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*${SOLIBSDEV}" | ||
69 | FILES_${PN}-dev = "${libdir}/go/src ${libdir}/go/pkg/include \ | ||
70 | ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*.shlibname \ | ||
71 | ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*.shlibname \ | ||
72 | ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*.shlibname \ | ||
73 | ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*.shlibname \ | ||
74 | ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*.shlibname \ | ||
75 | ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*.shlibname \ | ||
76 | ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*/*.shlibname \ | ||
77 | ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*.a \ | ||
78 | ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*.a \ | ||
79 | ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*.a \ | ||
80 | ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*.a \ | ||
81 | ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*.a \ | ||
82 | ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*.a \ | ||
83 | ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*/*.a \ | ||
84 | " | ||
85 | FILES_${PN}-staticdev = "${libdir}/go/pkg/${TARGET_GOTUPLE}" | ||
86 | |||
87 | # Go sources include some scripts and pre-built binaries for | ||
88 | # multiple architectures. The static .a files for dynamically-linked | ||
89 | # runtime are also required in -dev. | ||
90 | INSANE_SKIP_${PN}-dev = "staticdev file-rdeps arch" | ||
91 | |||
92 | INHIBIT_PACKAGE_STRIP = "1" | ||
93 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" | ||
94 | INHIBIT_SYSROOT_STRIP = "1" | ||
95 | |||
96 | BBCLASSEXTEND = "nativesdk" | ||