diff options
author | Matt Madison <matt@madison.systems> | 2017-09-14 16:22:29 -0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-09-21 09:05:50 +0100 |
commit | 6590c03808c0c6728c6fa914c6bfecf72de1e95a (patch) | |
tree | 88a0bb0b63ae0be409fe76eaa7ce3dacdc57788f /meta/recipes-devtools | |
parent | 975246ffe6e053820c6929454c3d73fb329c54a1 (diff) | |
download | poky-6590c03808c0c6728c6fa914c6bfecf72de1e95a.tar.gz |
go: fixes for cross-canadian builds
* Add patch for go's make script to allow for
build system != host system
* Add dependencies on the appropriate crosssdk recipes,
and use the crosssdk C compiler and linker
* Remove bashism in the wrapper script
* Restrict installation to only the tool binaries
to address some packaging errors
(From OE-Core rev: e2171f14a2dbf630a926a6792f6e6355f80e18b1)
Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
3 files changed, 52 insertions, 22 deletions
diff --git a/meta/recipes-devtools/go/go-1.9.inc b/meta/recipes-devtools/go/go-1.9.inc index d538f4c3a3..0b0aca3fbe 100644 --- a/meta/recipes-devtools/go/go-1.9.inc +++ b/meta/recipes-devtools/go/go-1.9.inc | |||
@@ -13,6 +13,7 @@ SRC_URI += "\ | |||
13 | file://0005-cmd-go-make-GOROOT-precious-by-default.patch \ | 13 | file://0005-cmd-go-make-GOROOT-precious-by-default.patch \ |
14 | file://0006-make.bash-add-GOTOOLDIR_BOOTSTRAP-environment-variab.patch \ | 14 | file://0006-make.bash-add-GOTOOLDIR_BOOTSTRAP-environment-variab.patch \ |
15 | file://0007-ld-add-soname-to-shareable-objects.patch \ | 15 | file://0007-ld-add-soname-to-shareable-objects.patch \ |
16 | file://0008-make.bash-add-GOHOSTxx-indirection-for-cross-canadia.patch \ | ||
16 | " | 17 | " |
17 | SRC_URI[main.md5sum] = "da2d44ea384076efec43ee1f8b7d45d2" | 18 | SRC_URI[main.md5sum] = "da2d44ea384076efec43ee1f8b7d45d2" |
18 | SRC_URI[main.sha256sum] = "a4ab229028ed167ba1986825751463605264e44868362ca8e7accc8be057e993" | 19 | SRC_URI[main.sha256sum] = "a4ab229028ed167ba1986825751463605264e44868362ca8e7accc8be057e993" |
diff --git a/meta/recipes-devtools/go/go-1.9/0008-make.bash-add-GOHOSTxx-indirection-for-cross-canadia.patch b/meta/recipes-devtools/go/go-1.9/0008-make.bash-add-GOHOSTxx-indirection-for-cross-canadia.patch new file mode 100644 index 0000000000..0977c78350 --- /dev/null +++ b/meta/recipes-devtools/go/go-1.9/0008-make.bash-add-GOHOSTxx-indirection-for-cross-canadia.patch | |||
@@ -0,0 +1,33 @@ | |||
1 | From 03e6c339d4fb712fbb8c4ca6ef2fc7100dcdb3d7 Mon Sep 17 00:00:00 2001 | ||
2 | From: Matt Madison <matt@madison.systems> | ||
3 | Date: Thu, 14 Sep 2017 05:38:10 -0700 | ||
4 | Subject: [PATCH 8/8] make.bash: add GOHOSTxx indirection for cross-canadian | ||
5 | builds | ||
6 | |||
7 | Add environment variables for specifying the host OS/arch | ||
8 | that we are building the compiler for, so it can differ from | ||
9 | the build host OS/arch. | ||
10 | |||
11 | Upstream-Status: Pending | ||
12 | |||
13 | Signed-off-by: Matt Madison <matt@madison.systems> | ||
14 | --- | ||
15 | src/make.bash | 2 ++ | ||
16 | 1 file changed, 2 insertions(+) | ||
17 | |||
18 | diff --git a/src/make.bash b/src/make.bash | ||
19 | index 2e6fb05..0bdadc6 100755 | ||
20 | --- a/src/make.bash | ||
21 | +++ b/src/make.bash | ||
22 | @@ -173,6 +173,8 @@ if [ "$do_host_build" = "yes" ]; then | ||
23 | echo | ||
24 | |||
25 | GOTOOLDIR_BOOTSTRAP="${GOTOOLDIR_BOOTSTRAP:-$GOTOOLDIR}" | ||
26 | + GOHOSTOS="${GOHOSTOS_CROSS:-$GOHOSTOS}" | ||
27 | + GOHOSTARCH="${GOHOSTARCH_CROSS:-$GOHOSTARCH}" | ||
28 | echo "##### Building packages and commands for host, $GOHOSTOS/$GOHOSTARCH." | ||
29 | # CC_FOR_TARGET is recorded as the default compiler for the go tool. When building for the host, however, | ||
30 | # use the host compiler, CC, from `cmd/dist/dist env` instead. | ||
31 | -- | ||
32 | 2.7.4 | ||
33 | |||
diff --git a/meta/recipes-devtools/go/go-cross-canadian.inc b/meta/recipes-devtools/go/go-cross-canadian.inc index 0068f34d04..f3ab7351db 100644 --- a/meta/recipes-devtools/go/go-cross-canadian.inc +++ b/meta/recipes-devtools/go/go-cross-canadian.inc | |||
@@ -1,21 +1,24 @@ | |||
1 | inherit cross-canadian | 1 | inherit cross-canadian |
2 | 2 | ||
3 | DEPENDS = "go-native virtual/${HOST_PREFIX}gcc-crosssdk virtual/nativesdk-${HOST_PREFIX}libc-for-gcc virtual/nativesdk-${HOST_PREFIX}compilerlibs" | 3 | DEPENDS = "go-native virtual/${HOST_PREFIX}go-crosssdk virtual/nativesdk-${HOST_PREFIX}go-runtime \ |
4 | virtual/${HOST_PREFIX}gcc-crosssdk virtual/nativesdk-${HOST_PREFIX}libc-for-gcc \ | ||
5 | virtual/nativesdk-${HOST_PREFIX}compilerlibs" | ||
4 | PN = "go-cross-canadian-${TRANSLATED_TARGET_ARCH}" | 6 | PN = "go-cross-canadian-${TRANSLATED_TARGET_ARCH}" |
5 | 7 | ||
6 | export GOHOSTOS = "${BUILD_GOOS}" | 8 | export GOHOSTOS = "${BUILD_GOOS}" |
7 | export GOHOSTARCH = "${BUILD_GOARCH}" | 9 | export GOHOSTARCH = "${BUILD_GOARCH}" |
8 | export GOOS = "${HOST_GOOS}" | 10 | export GOHOSTOS_CROSS = "${HOST_GOOS}" |
9 | export GOARCH = "${HOST_GOARCH}" | 11 | export GOHOSTARCH_CROSS = "${HOST_GOARCH}" |
10 | export GOARM = "${HOST_GOARM}" | ||
11 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" | 12 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" |
12 | export GOTOOLDIR_BOOTSTRAP = "${GOROOT_BOOTSTRAP}/pkg/tool/${BUILD_GOTUPLE}" | 13 | export GOTOOLDIR_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/${HOST_SYS}/go/pkg/tool/${BUILD_GOTUPLE}" |
13 | export GOROOT_FINAL = "${libdir}/go" | 14 | export GOROOT_FINAL = "${libdir}/go" |
14 | export CGO_ENABLED = "1" | 15 | export CGO_ENABLED = "1" |
15 | export CC_FOR_TARGET = "${HOST_CC}" | 16 | export CC_FOR_TARGET = "${TARGET_PREFIX}gcc" |
16 | export CXX_FOR_TARGET = "${HOST_CXX}" | 17 | export CXX_FOR_TARGET = "${TARGET_PREFIX}g++" |
17 | CC = "${@d.getVar('BUILD_CC', True).strip()}" | 18 | CC = "${HOST_PREFIX}gcc" |
18 | export GO_LDFLAGS = '-linkmode external -extld ${HOST_PREFIX}gcc -extldflags "${TOOLCHAIN_OPTIONS} ${LDFLAGS}"' | 19 | export CGO_CFLAGS = "--sysroot=${STAGING_DIR_TARGET} ${HOST_CC_ARCH} ${CFLAGS}" |
20 | export CGO_LDFLAGS = "--sysroot=${STAGING_DIR_TARGET} ${HOST_CC_ARCH} ${LDFLAGS}" | ||
21 | export GO_LDFLAGS = '-linkmode external -extld ${HOST_PREFIX}gcc -extldflags "--sysroot=${STAGING_DIR_TARGET} ${HOST_CC_ARCH} ${LDFLAGS}"' | ||
19 | 22 | ||
20 | do_configure[noexec] = "1" | 23 | do_configure[noexec] = "1" |
21 | 24 | ||
@@ -32,34 +35,27 @@ do_compile() { | |||
32 | make_wrapper() { | 35 | make_wrapper() { |
33 | rm -f ${D}${bindir}/$2 | 36 | rm -f ${D}${bindir}/$2 |
34 | cat <<END >${D}${bindir}/$2 | 37 | cat <<END >${D}${bindir}/$2 |
35 | #!/bin/bash | 38 | #!/bin/sh |
36 | here=\`dirname \$0\` | 39 | here=\`dirname \$0\` |
37 | native_goroot=\`readlink -f \$here/../../lib/${TARGET_SYS}/go\` | 40 | native_goroot=\`readlink -f \$here/../../lib/${TARGET_SYS}/go\` |
38 | export GOARCH="${TARGET_GOARCH}" | 41 | export GOARCH="${TARGET_GOARCH}" |
39 | export GOOS="${TARGET_GOOS}" | 42 | export GOOS="${TARGET_GOOS}" |
40 | export GOARM="\${GOARM:-${TARGET_GOARM}}" | 43 | test -n "\$GOARM" || export GOARM="${TARGET_GOARM}" |
41 | export GOTOOLDIR="\$native_goroot/pkg/tool/${HOST_GOTUPLE}" | 44 | export GOTOOLDIR="\$native_goroot/pkg/tool/${HOST_GOTUPLE}" |
42 | export GOROOT="\${GOROOT:-\$OECORE_TARGET_SYSROOT/${target_libdir}/go}" | 45 | test -n "\$GOROOT" || export GOROOT="\$OECORE_TARGET_SYSROOT/${target_libdir}/go" |
43 | \$here/../../lib/${TARGET_SYS}/go/bin/$1 "\$@" | 46 | \$here/../../lib/${TARGET_SYS}/go/bin/$1 "\$@" |
44 | END | 47 | END |
45 | chmod +x ${D}${bindir}/$2 | 48 | chmod +x ${D}${bindir}/$2 |
46 | } | 49 | } |
47 | 50 | ||
48 | do_install() { | 51 | do_install() { |
49 | install -d ${D}${libdir}/go | 52 | install -d ${D}${libdir}/go/pkg/tool |
50 | cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/ | 53 | cp --preserve=mode,timestamps -R ${B}/pkg/tool/${HOST_GOTUPLE} ${D}${libdir}/go/pkg/tool/ |
51 | install -d ${D}${libdir}/go/src | ||
52 | (cd ${S}/src; for d in *; do \ | ||
53 | [ -d $d ] && cp --preserve=mode,timestamps -R ${S}/src/$d ${D}${libdir}/go/src/; \ | ||
54 | done) | ||
55 | rm -rf ${D}${libdir}/go/src/runtime/pprof/testdata | ||
56 | install -d ${D}${bindir} ${D}${libdir}/go/bin | 54 | install -d ${D}${bindir} ${D}${libdir}/go/bin |
57 | for f in ${B}/bin/* | 55 | for f in ${B}/${GO_BUILD_BINDIR}/* |
58 | do | 56 | do |
59 | base=`basename $f` | 57 | base=`basename $f` |
60 | install -m755 $f ${D}${libdir}/go/bin | 58 | install -m755 $f ${D}${libdir}/go/bin |
61 | make_wrapper $base ${TARGET_PREFIX}$base | 59 | make_wrapper $base ${TARGET_PREFIX}$base |
62 | done | 60 | done |
63 | } | 61 | } |
64 | |||
65 | FILES_${PN}-staticdev = "${libdir}/go/pkg" | ||