diff options
Diffstat (limited to 'meta/recipes-devtools/go/go-runtime.inc')
-rw-r--r-- | meta/recipes-devtools/go/go-runtime.inc | 58 |
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}" | |||
10 | export GO386 = "${TARGET_GO386}" | 10 | export GO386 = "${TARGET_GO386}" |
11 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" | 11 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" |
12 | export GOROOT_FINAL = "${libdir}/go" | 12 | export GOROOT_FINAL = "${libdir}/go" |
13 | export GO_TARGET_INSTALL = "std" | ||
14 | export CGO_ENABLED = "1" | 13 | export CGO_ENABLED = "1" |
15 | export CC_FOR_TARGET="${CC}" | 14 | export CGO_CFLAGS = "${CFLAGS}" |
16 | export CXX_FOR_TARGET="${CXX}" | 15 | export CGO_CPPFLAGS = "${CPPFLAGS}" |
17 | export GOROOT_OVERRIDE = "1" | 16 | export CGO_CXXFLAGS = "${CXXFLAGS}" |
17 | export CGO_LDFLAGS = "${LDFLAGS}" | ||
18 | export GOCACHE = "off" | ||
19 | export GOTMPDIR ?= "${WORKDIR}/go-tmp" | ||
20 | GOTMPDIR[vardepvalue] = "" | ||
21 | GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS}" | ||
22 | GO_LINKMODE ?= "" | ||
23 | GO_LINKMODE_class-nativesdk = "--linkmode=external" | ||
24 | GO_LDFLAGS ?= '-ldflags="${GO_LINKMODE} -extldflags '${GO_EXTLDFLAGS}'"' | ||
18 | 25 | ||
19 | do_configure() { | 26 | do_configure() { |
20 | : | 27 | : |
@@ -25,21 +32,20 @@ do_configure_libc-musl() { | |||
25 | } | 32 | } |
26 | 33 | ||
27 | do_compile() { | 34 | do_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 | } |
47 | do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg" | ||
48 | do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg" | ||
43 | 49 | ||
44 | do_install() { | 50 | do_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 | ||
61 | do_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. | ||
67 | sysroot_stage_all_append() { | ||
68 | find ${SYSROOT_DESTDIR}${libdir}/go/src -depth -type d -name 'testdata' -exec rm -rf {} \; | ||
69 | } | ||
70 | |||
71 | ALLOW_EMPTY_${PN} = "1" | 67 | ALLOW_EMPTY_${PN} = "1" |
72 | FILES_${PN} = "${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*${SOLIBSDEV}" | 68 | FILES_${PN} = "${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*${SOLIBSDEV}" |
73 | FILES_${PN}-dev = "${libdir}/go/src ${libdir}/go/pkg/include \ | 69 | FILES_${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 | " | ||
82 | FILES_${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 | 85 | FILES_${PN}-staticdev = "${libdir}/go/pkg/${TARGET_GOTUPLE}" |
92 | # architectures, scripts, and .a files | 86 | |
93 | INSANE_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. | ||
90 | INSANE_SKIP_${PN}-dev = "staticdev file-rdeps arch" | ||
94 | 91 | ||
95 | INHIBIT_PACKAGE_STRIP = "1" | 92 | INHIBIT_PACKAGE_STRIP = "1" |
96 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" | 93 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" |
94 | INHIBIT_SYSROOT_STRIP = "1" | ||
97 | 95 | ||
98 | BBCLASSEXTEND = "nativesdk" | 96 | BBCLASSEXTEND = "nativesdk" |