mirror of
git://git.yoctoproject.org/poky
synced 2026-10-02 16:42:04 +00:00
* Patches and recipes reworked for go 1.10's significant changes to its bootstrap and build steps. * Update go1.4 source tarball used for go-native bootstrapping to the version recommended in the current go documentation * Remove test data from installed sources to eliminate some packaging QA warnings * Set GOCACHE to 'off' to disable 1.10's build caching in the go recipes and bbclass * Update go_do_compile to compile both static and dynamic objects dynamic linking is in use, since go1.10's build tool is pickier about this (From OE-Core rev: 4fd749ca6450a4870be1c1e13802f084b6eb0db6) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
64 lines
1.8 KiB
PHP
64 lines
1.8 KiB
PHP
inherit cross
|
|
|
|
PROVIDES = "virtual/${TARGET_PREFIX}go"
|
|
DEPENDS = "go-native"
|
|
|
|
PN = "go-cross-${TARGET_ARCH}"
|
|
|
|
export GOHOSTOS = "${BUILD_GOOS}"
|
|
export GOHOSTARCH = "${BUILD_GOARCH}"
|
|
export GOOS = "${TARGET_GOOS}"
|
|
export GOARCH = "${TARGET_GOARCH}"
|
|
export GOARM = "${TARGET_GOARM}"
|
|
export GO386 = "${TARGET_GO386}"
|
|
export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go"
|
|
export GOROOT_FINAL = "${libdir}/go"
|
|
export GOCACHE = "off"
|
|
export GOTMPDIR ?= "${WORKDIR}/go-tmp"
|
|
GOTMPDIR[vardepvalue] = ""
|
|
export CGO_ENABLED = "1"
|
|
CC = "${@d.getVar('BUILD_CC').strip()}"
|
|
|
|
do_configure[noexec] = "1"
|
|
|
|
do_compile() {
|
|
export CC_FOR_${GOOS}_${GOARCH}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
|
|
export CXX_FOR_${GOOS}_${GOARCh}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
|
|
cd src
|
|
./make.bash --host-only --no-banner
|
|
cd ${B}
|
|
}
|
|
do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg"
|
|
do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
|
|
|
|
make_wrapper() {
|
|
rm -f ${D}${bindir}/$2
|
|
cat <<END >${D}${bindir}/$2
|
|
#!/bin/bash
|
|
here=\`dirname \$0\`
|
|
export GOARCH="${TARGET_GOARCH}"
|
|
export GOOS="${TARGET_GOOS}"
|
|
export GOARM="\${GOARM:-${TARGET_GOARM}}"
|
|
export GO386="\${GO386:-${TARGET_GO386}}"
|
|
\$here/../../lib/${CROSS_TARGET_SYS_DIR}/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)
|
|
find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \;
|
|
install -d ${D}${bindir} ${D}${libdir}/go/bin
|
|
for f in ${B}/bin/*
|
|
do
|
|
base=`basename $f`
|
|
install -m755 $f ${D}${libdir}/go/bin
|
|
make_wrapper $base ${TARGET_PREFIX}$base
|
|
done
|
|
}
|