diff options
4 files changed, 89 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-1.8.inc b/meta/recipes-devtools/go/go-1.8.inc index 2920d06f60..141c0994c3 100644 --- a/meta/recipes-devtools/go/go-1.8.inc +++ b/meta/recipes-devtools/go/go-1.8.inc | |||
| @@ -15,6 +15,7 @@ SRC_URI += "\ | |||
| 15 | file://split-host-and-target-build.patch \ | 15 | file://split-host-and-target-build.patch \ |
| 16 | file://gotooldir.patch \ | 16 | file://gotooldir.patch \ |
| 17 | file://make-goroot-precious.patch \ | 17 | file://make-goroot-precious.patch \ |
| 18 | file://set-gotooldir-during-bootstrap.patch \ | ||
| 18 | " | 19 | " |
| 19 | SRC_URI[main.md5sum] = "64e9380e07bba907e26a00cf5fcbe77e" | 20 | SRC_URI[main.md5sum] = "64e9380e07bba907e26a00cf5fcbe77e" |
| 20 | SRC_URI[main.sha256sum] = "5f5dea2447e7dcfdc50fa6b94c512e58bfba5673c039259fd843f68829d99fa6" | 21 | SRC_URI[main.sha256sum] = "5f5dea2447e7dcfdc50fa6b94c512e58bfba5673c039259fd843f68829d99fa6" |
diff --git a/meta/recipes-devtools/go/go-1.8/set-gotooldir-during-bootstrap.patch b/meta/recipes-devtools/go/go-1.8/set-gotooldir-during-bootstrap.patch new file mode 100644 index 0000000000..4b5e424d96 --- /dev/null +++ b/meta/recipes-devtools/go/go-1.8/set-gotooldir-during-bootstrap.patch | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | Set GOTOOLDIR during bootstrap | ||
| 2 | |||
| 3 | Signed-off-by: Matt Madison <matt@madison.systems> | ||
| 4 | Upstream-Status: Pending | ||
| 5 | |||
| 6 | Index: go/src/make.bash | ||
| 7 | =================================================================== | ||
| 8 | --- go.orig/src/make.bash | ||
| 9 | +++ go/src/make.bash | ||
| 10 | @@ -172,10 +172,11 @@ if [ "$do_host_build" = "yes" ]; then | ||
| 11 | mv cmd/dist/dist "$GOTOOLDIR"/dist | ||
| 12 | echo | ||
| 13 | |||
| 14 | + GOTOOLDIR_BOOTSTRAP="${GOTOOLDIR_BOOTSTRAP:-$GOTOOLDIR}" | ||
| 15 | echo "##### Building packages and commands for host, $GOHOSTOS/$GOHOSTARCH." | ||
| 16 | # CC_FOR_TARGET is recorded as the default compiler for the go tool. When building for the host, however, | ||
| 17 | # use the host compiler, CC, from `cmd/dist/dist env` instead. | ||
| 18 | - CC=$CC GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH \ | ||
| 19 | + CC=$CC GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH GOTOOLDIR="$GOTOOLDIR_BOOTSTRAP" \ | ||
| 20 | "$GOTOOLDIR"/go_bootstrap install -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd | ||
| 21 | echo | ||
| 22 | fi | ||
diff --git a/meta/recipes-devtools/go/go-cross-canadian.inc b/meta/recipes-devtools/go/go-cross-canadian.inc new file mode 100644 index 0000000000..f0315d558a --- /dev/null +++ b/meta/recipes-devtools/go/go-cross-canadian.inc | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | inherit cross-canadian | ||
| 2 | |||
| 3 | DEPENDS = "go-native virtual/${HOST_PREFIX}gcc-crosssdk virtual/nativesdk-${HOST_PREFIX}libc-for-gcc virtual/nativesdk-${HOST_PREFIX}compilerlibs" | ||
| 4 | PN = "go-cross-canadian-${TRANSLATED_TARGET_ARCH}" | ||
| 5 | |||
| 6 | export GOHOSTOS = "${BUILD_GOOS}" | ||
| 7 | export GOHOSTARCH = "${BUILD_GOARCH}" | ||
| 8 | export GOOS = "${HOST_GOOS}" | ||
| 9 | export GOARCH = "${HOST_GOARCH}" | ||
| 10 | export GOARM = "${HOST_GOARM}" | ||
| 11 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" | ||
| 12 | export GOTOOLDIR_BOOTSTRAP = "${GOROOT_BOOTSTRAP}/pkg/tool/${BUILD_GOTUPLE}" | ||
| 13 | export GOROOT_FINAL = "${libdir}/go" | ||
| 14 | export CGO_ENABLED = "1" | ||
| 15 | export CC_FOR_TARGET = "${HOST_CC}" | ||
| 16 | export CXX_FOR_TARGET = "${HOST_CXX}" | ||
| 17 | CC = "${@d.getVar('BUILD_CC', True).strip()}" | ||
| 18 | export GO_LDFLAGS = '-linkmode external -extld ${HOST_PREFIX}gcc -extldflags "${TOOLCHAIN_OPTIONS} ${LDFLAGS}"' | ||
| 19 | |||
| 20 | do_configure[noexec] = "1" | ||
| 21 | |||
| 22 | do_compile() { | ||
| 23 | export GOBIN="${B}/bin" | ||
| 24 | rm -rf ${GOBIN} ${B}/pkg | ||
| 25 | mkdir ${GOBIN} | ||
| 26 | cd src | ||
| 27 | ./make.bash --host-only --no-banner | ||
| 28 | cd ${B} | ||
| 29 | } | ||
| 30 | |||
| 31 | |||
| 32 | make_wrapper() { | ||
| 33 | rm -f ${D}${bindir}/$2 | ||
| 34 | cat <<END >${D}${bindir}/$2 | ||
| 35 | #!/bin/bash | ||
| 36 | here=\`dirname \$0\` | ||
| 37 | native_goroot=\`readlink -f \$here/../../lib/${TARGET_SYS}/go\` | ||
| 38 | export GOARCH="${TARGET_GOARCH}" | ||
| 39 | export GOOS="${TARGET_GOOS}" | ||
| 40 | export GOARM="\${GOARM:-${TARGET_GOARM}}" | ||
| 41 | export GOTOOLDIR="\$native_goroot/pkg/tool/${HOST_GOTUPLE}" | ||
| 42 | export GOROOT="\${GOROOT:-\$OECORE_TARGET_SYSROOT/${target_libdir}/go}" | ||
| 43 | \$here/../../lib/${TARGET_SYS}/go/bin/$1 "\$@" | ||
| 44 | END | ||
| 45 | chmod +x ${D}${bindir}/$2 | ||
| 46 | } | ||
| 47 | |||
| 48 | do_install() { | ||
| 49 | install -d ${D}${libdir}/go | ||
| 50 | cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/ | ||
| 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 | install -d ${D}${bindir} ${D}${libdir}/go/bin | ||
| 56 | for f in ${B}/bin/* | ||
| 57 | do | ||
| 58 | base=`basename $f` | ||
| 59 | install -m755 $f ${D}${libdir}/go/bin | ||
| 60 | make_wrapper $base ${TARGET_PREFIX}$base | ||
| 61 | done | ||
| 62 | } | ||
| 63 | |||
| 64 | FILES_${PN}-staticdev = "${libdir}/go/pkg" | ||
diff --git a/meta/recipes-devtools/go/go-cross-canadian_1.8.bb b/meta/recipes-devtools/go/go-cross-canadian_1.8.bb new file mode 100644 index 0000000000..7ac9449e47 --- /dev/null +++ b/meta/recipes-devtools/go/go-cross-canadian_1.8.bb | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | require go-cross-canadian.inc | ||
| 2 | require go-${PV}.inc | ||
