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:03:33 +0100 |
commit | e2171f14a2dbf630a926a6792f6e6355f80e18b1 (patch) | |
tree | 08142d0a2f61dc9e07f2bcfafe40cb8a26165e2a /meta/recipes-devtools/go/go-cross-canadian.inc | |
parent | f76779f7ef6636355a5aa5741a736f5234a67fdb (diff) | |
download | openembedded-core-e2171f14a2dbf630a926a6792f6e6355f80e18b1.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
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>
Diffstat (limited to 'meta/recipes-devtools/go/go-cross-canadian.inc')
-rw-r--r-- | meta/recipes-devtools/go/go-cross-canadian.inc | 40 |
1 files changed, 18 insertions, 22 deletions
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 @@ inherit cross-canadian -DEPENDS = "go-native virtual/${HOST_PREFIX}gcc-crosssdk virtual/nativesdk-${HOST_PREFIX}libc-for-gcc virtual/nativesdk-${HOST_PREFIX}compilerlibs" +DEPENDS = "go-native virtual/${HOST_PREFIX}go-crosssdk virtual/nativesdk-${HOST_PREFIX}go-runtime \ + virtual/${HOST_PREFIX}gcc-crosssdk virtual/nativesdk-${HOST_PREFIX}libc-for-gcc \ + virtual/nativesdk-${HOST_PREFIX}compilerlibs" PN = "go-cross-canadian-${TRANSLATED_TARGET_ARCH}" export GOHOSTOS = "${BUILD_GOOS}" export GOHOSTARCH = "${BUILD_GOARCH}" -export GOOS = "${HOST_GOOS}" -export GOARCH = "${HOST_GOARCH}" -export GOARM = "${HOST_GOARM}" +export GOHOSTOS_CROSS = "${HOST_GOOS}" +export GOHOSTARCH_CROSS = "${HOST_GOARCH}" export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" -export GOTOOLDIR_BOOTSTRAP = "${GOROOT_BOOTSTRAP}/pkg/tool/${BUILD_GOTUPLE}" +export GOTOOLDIR_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/${HOST_SYS}/go/pkg/tool/${BUILD_GOTUPLE}" export GOROOT_FINAL = "${libdir}/go" export CGO_ENABLED = "1" -export CC_FOR_TARGET = "${HOST_CC}" -export CXX_FOR_TARGET = "${HOST_CXX}" -CC = "${@d.getVar('BUILD_CC', True).strip()}" -export GO_LDFLAGS = '-linkmode external -extld ${HOST_PREFIX}gcc -extldflags "${TOOLCHAIN_OPTIONS} ${LDFLAGS}"' +export CC_FOR_TARGET = "${TARGET_PREFIX}gcc" +export CXX_FOR_TARGET = "${TARGET_PREFIX}g++" +CC = "${HOST_PREFIX}gcc" +export CGO_CFLAGS = "--sysroot=${STAGING_DIR_TARGET} ${HOST_CC_ARCH} ${CFLAGS}" +export CGO_LDFLAGS = "--sysroot=${STAGING_DIR_TARGET} ${HOST_CC_ARCH} ${LDFLAGS}" +export GO_LDFLAGS = '-linkmode external -extld ${HOST_PREFIX}gcc -extldflags "--sysroot=${STAGING_DIR_TARGET} ${HOST_CC_ARCH} ${LDFLAGS}"' do_configure[noexec] = "1" @@ -32,34 +35,27 @@ do_compile() { make_wrapper() { rm -f ${D}${bindir}/$2 cat <<END >${D}${bindir}/$2 -#!/bin/bash +#!/bin/sh here=\`dirname \$0\` native_goroot=\`readlink -f \$here/../../lib/${TARGET_SYS}/go\` export GOARCH="${TARGET_GOARCH}" export GOOS="${TARGET_GOOS}" -export GOARM="\${GOARM:-${TARGET_GOARM}}" +test -n "\$GOARM" || export GOARM="${TARGET_GOARM}" export GOTOOLDIR="\$native_goroot/pkg/tool/${HOST_GOTUPLE}" -export GOROOT="\${GOROOT:-\$OECORE_TARGET_SYSROOT/${target_libdir}/go}" +test -n "\$GOROOT" || export GOROOT="\$OECORE_TARGET_SYSROOT/${target_libdir}/go" \$here/../../lib/${TARGET_SYS}/go/bin/$1 "\$@" END chmod +x ${D}${bindir}/$2 } do_install() { - install -d ${D}${libdir}/go - cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/ - install -d ${D}${libdir}/go/src - (cd ${S}/src; for d in *; do \ - [ -d $d ] && cp --preserve=mode,timestamps -R ${S}/src/$d ${D}${libdir}/go/src/; \ - done) - rm -rf ${D}${libdir}/go/src/runtime/pprof/testdata + install -d ${D}${libdir}/go/pkg/tool + cp --preserve=mode,timestamps -R ${B}/pkg/tool/${HOST_GOTUPLE} ${D}${libdir}/go/pkg/tool/ install -d ${D}${bindir} ${D}${libdir}/go/bin - for f in ${B}/bin/* + for f in ${B}/${GO_BUILD_BINDIR}/* do base=`basename $f` install -m755 $f ${D}${libdir}/go/bin make_wrapper $base ${TARGET_PREFIX}$base done } - -FILES_${PN}-staticdev = "${libdir}/go/pkg" |