summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/go/go-runtime.inc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/go/go-runtime.inc')
-rw-r--r--meta/recipes-devtools/go/go-runtime.inc58
1 files changed, 28 insertions, 30 deletions
diff --git a/meta/recipes-devtools/go/go-runtime.inc b/meta/recipes-devtools/go/go-runtime.inc
index 29ae86e4ee..7a3b415b3f 100644
--- a/meta/recipes-devtools/go/go-runtime.inc
+++ b/meta/recipes-devtools/go/go-runtime.inc
@@ -10,11 +10,18 @@ export GOARM = "${TARGET_GOARM}"
10export GO386 = "${TARGET_GO386}" 10export GO386 = "${TARGET_GO386}"
11export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" 11export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go"
12export GOROOT_FINAL = "${libdir}/go" 12export GOROOT_FINAL = "${libdir}/go"
13export GO_TARGET_INSTALL = "std"
14export CGO_ENABLED = "1" 13export CGO_ENABLED = "1"
15export CC_FOR_TARGET="${CC}" 14export CGO_CFLAGS = "${CFLAGS}"
16export CXX_FOR_TARGET="${CXX}" 15export CGO_CPPFLAGS = "${CPPFLAGS}"
17export GOROOT_OVERRIDE = "1" 16export CGO_CXXFLAGS = "${CXXFLAGS}"
17export CGO_LDFLAGS = "${LDFLAGS}"
18export GOCACHE = "off"
19export GOTMPDIR ?= "${WORKDIR}/go-tmp"
20GOTMPDIR[vardepvalue] = ""
21GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS}"
22GO_LINKMODE ?= ""
23GO_LINKMODE_class-nativesdk = "--linkmode=external"
24GO_LDFLAGS ?= '-ldflags="${GO_LINKMODE} -extldflags '${GO_EXTLDFLAGS}'"'
18 25
19do_configure() { 26do_configure() {
20 : 27 :
@@ -25,21 +32,20 @@ do_configure_libc-musl() {
25} 32}
26 33
27do_compile() { 34do_compile() {
28 export GOBIN="${B}/bin" 35 export CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CC}"
29 export CC="${@d.getVar('BUILD_CC').strip()}" 36 export CXX_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CXX}"
30 rm -rf ${GOBIN} ${B}/pkg 37
31 mkdir ${GOBIN}
32 cd src 38 cd src
33 ./make.bash --host-only 39 ./make.bash --target-only --no-banner std
34 cp ${B}/pkg/tool/${BUILD_GOTUPLE}/go_bootstrap ${B}
35 rm -rf ${B}/pkg/${TARGET_GOTUPLE}
36 ./make.bash --target-only
37 if [ -n "${GO_DYNLINK}" ]; then 40 if [ -n "${GO_DYNLINK}" ]; then
38 cp ${B}/go_bootstrap ${B}/pkg/tool/${BUILD_GOTUPLE} 41 export GOTOOLDIR="${B}/pkg/tool/native_native"
39 GO_FLAGS="-buildmode=shared" GO_LDFLAGS="-extldflags \"${LDFLAGS}\"" ./make.bash --target-only 42 CC="$CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}" GOARCH="${TARGET_GOARCH}" GOOS="${TARGET_GOOS}" GOROOT=${B} \
43 $GOTOOLDIR/go_bootstrap install -linkshared -buildmode=shared ${GO_LDFLAGS} std
40 fi 44 fi
41 cd ${B} 45 cd ${B}
42} 46}
47do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg"
48do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
43 49
44do_install() { 50do_install() {
45 install -d ${D}${libdir}/go/src 51 install -d ${D}${libdir}/go/src
@@ -54,20 +60,10 @@ do_install() {
54 find src -mindepth 1 -maxdepth 1 -type d | while read srcdir; do 60 find src -mindepth 1 -maxdepth 1 -type d | while read srcdir; do
55 cp --preserve=mode,timestamps -R $srcdir ${D}${libdir}/go/src/ 61 cp --preserve=mode,timestamps -R $srcdir ${D}${libdir}/go/src/
56 done 62 done
63 find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \;
57 rm -f ${D}${libdir}/go/src/cmd/dist/dist 64 rm -f ${D}${libdir}/go/src/cmd/dist/dist
58} 65}
59 66
60# Remove test binaries that cannot be relocated
61do_install_append_class-nativesdk() {
62 rm -rf ${D}${libdir}/go/src/runtime/pprof/testdata
63}
64
65# These testdata directories aren't needed for builds and contain binaries
66# that can cause errors in sysroot_strip(), so just remove them.
67sysroot_stage_all_append() {
68 find ${SYSROOT_DESTDIR}${libdir}/go/src -depth -type d -name 'testdata' -exec rm -rf {} \;
69}
70
71ALLOW_EMPTY_${PN} = "1" 67ALLOW_EMPTY_${PN} = "1"
72FILES_${PN} = "${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*${SOLIBSDEV}" 68FILES_${PN} = "${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*${SOLIBSDEV}"
73FILES_${PN}-dev = "${libdir}/go/src ${libdir}/go/pkg/include \ 69FILES_${PN}-dev = "${libdir}/go/src ${libdir}/go/pkg/include \
@@ -78,8 +74,6 @@ FILES_${PN}-dev = "${libdir}/go/src ${libdir}/go/pkg/include \
78 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*.shlibname \ 74 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*.shlibname \
79 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*.shlibname \ 75 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*.shlibname \
80 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*/*.shlibname \ 76 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*/*.shlibname \
81"
82FILES_${PN}-staticdev = "${libdir}/go/pkg/${TARGET_GOTUPLE} \
83 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*.a \ 77 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*.a \
84 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*.a \ 78 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*.a \
85 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*.a \ 79 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*.a \
@@ -88,11 +82,15 @@ FILES_${PN}-staticdev = "${libdir}/go/pkg/${TARGET_GOTUPLE} \
88 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*.a \ 82 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*.a \
89 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*/*.a \ 83 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*/*.a \
90" 84"
91# The testdata directories in the source tree include some binaries for various 85FILES_${PN}-staticdev = "${libdir}/go/pkg/${TARGET_GOTUPLE}"
92# architectures, scripts, and .a files 86
93INSANE_SKIP_${PN}-dev = "staticdev ldflags file-rdeps arch" 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.
90INSANE_SKIP_${PN}-dev = "staticdev file-rdeps arch"
94 91
95INHIBIT_PACKAGE_STRIP = "1" 92INHIBIT_PACKAGE_STRIP = "1"
96INHIBIT_PACKAGE_DEBUG_SPLIT = "1" 93INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
94INHIBIT_SYSROOT_STRIP = "1"
97 95
98BBCLASSEXTEND = "nativesdk" 96BBCLASSEXTEND = "nativesdk"