summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/go/go-native_1.16.10.bb
diff options
context:
space:
mode:
authorPavel Zhukov <pavel.zhukov@huawei.com>2021-11-23 16:38:42 +0100
committerAnuj Mittal <anuj.mittal@intel.com>2021-12-07 14:50:53 +0800
commite3dcea6b05a9ef64a4d28f250e53eadc6981dec9 (patch)
tree430572327e7b3c88868a04327942e2cec2a60a47 /meta/recipes-devtools/go/go-native_1.16.10.bb
parent50f9105410b662062765b6ec9a68ae30805d3b40 (diff)
downloadopenembedded-core-contrib-e3dcea6b05a9ef64a4d28f250e53eadc6981dec9.tar.gz
go: upgrade 1.16.8 -> 1.16.10
The release includes fixes for CVE-2021-41771 and CVE-2021-41772 Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 69c68f470e8e12456a4d9abf2d1c33b857e4ea37) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Diffstat (limited to 'meta/recipes-devtools/go/go-native_1.16.10.bb')
-rw-r--r--meta/recipes-devtools/go/go-native_1.16.10.bb59
1 files changed, 59 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-native_1.16.10.bb b/meta/recipes-devtools/go/go-native_1.16.10.bb
new file mode 100644
index 0000000000..ffe4ef3523
--- /dev/null
+++ b/meta/recipes-devtools/go/go-native_1.16.10.bb
@@ -0,0 +1,59 @@
+# This recipe builds a native Go (written in Go) by first building an old Go 1.4
+# (written in C). However this old Go does not support all hosts platforms.
+
+require go-${PV}.inc
+
+inherit native
+
+SRC_URI:append = " https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz;name=bootstrap;subdir=go1.4"
+SRC_URI[bootstrap.sha256sum] = "f4ff5b5eb3a3cae1c993723f3eab519c5bae18866b5e5f96fe1102f0cb5c3e52"
+
+export GOOS = "${BUILD_GOOS}"
+export GOARCH = "${BUILD_GOARCH}"
+CC = "${@d.getVar('BUILD_CC').strip()}"
+
+GOMAKEARGS ?= "--no-banner"
+
+do_configure() {
+ cd ${WORKDIR}/go1.4/go/src
+ CGO_ENABLED=0 GOROOT=${WORKDIR}/go1.4/go ./make.bash
+}
+
+do_compile() {
+ export GOROOT_FINAL="${libdir_native}/go"
+ export GOROOT_BOOTSTRAP="${WORKDIR}/go1.4/go"
+
+ cd src
+ ./make.bash ${GOMAKEARGS}
+ cd ${B}
+}
+do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin"
+do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin"
+
+make_wrapper() {
+ rm -f ${D}${bindir}/$2$3
+ cat <<END >${D}${bindir}/$2$3
+#!/bin/bash
+here=\`dirname \$0\`
+export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}"
+\$here/../lib/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 -a ${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 $base
+ done
+}