Date   

Re: [meta-lts-mixins][dunfell/go PATCH 1/4] Initial commit: add license, readme and layer config.

Konrad Weihmann <kweihmann@...>
 

On 27.01.22 15:43, Alexander Kanavin wrote:
Reviewed-by: Martin Kaistra <martin.kaistra@...>
Signed-off-by: Alexander Kanavin <alex@...>
---
COPYING.MIT | 17 +++++++++++++++++
README | 23 +++++++++++++++++++++++
conf/layer.conf | 19 +++++++++++++++++++
3 files changed, 59 insertions(+)
create mode 100644 COPYING.MIT
create mode 100644 README
create mode 100644 conf/layer.conf
diff --git a/COPYING.MIT b/COPYING.MIT
new file mode 100644
index 0000000..fb950dc
--- /dev/null
+++ b/COPYING.MIT
@@ -0,0 +1,17 @@
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/README b/README
new file mode 100644
index 0000000..5b22b72
--- /dev/null
+++ b/README
@@ -0,0 +1,23 @@
+"Mixin" layer for adding latest Go toolchain versions into the Yocto Project LTS.
+
+At the time Dunfell was released in April 2020, Go 1.14 was the latest version
+and officially Dunfell supports only that. This thin special-purpose mixin
+layer is meant to address this issue by backporting Go recipes from the master
+branch of openembedded-core.
+
+You can see what Go versions are provided by listing recipes-devtools/ content.
+
+Including the layer automatically picks up the latest Go version; different versions
+need to be set explicitly by adding the following line to your distro config
+or local.conf:
+
+GOVERSION = "1.16%"
+
+Please note: enabling these newer Go versions makes docker from dunfell branch
+of meta-virtualization unbuildable as it is too old. If you need a working docker
+recipe, you can use the supplementary 'dunfell/docker' layer from this meta-lts-mixin
+repository.
+
+
+Maintainers:
+Alexander Kanavin <alex@...>
diff --git a/conf/layer.conf b/conf/layer.conf
new file mode 100644
index 0000000..5f74224
--- /dev/null
+++ b/conf/layer.conf
@@ -0,0 +1,19 @@
+# We have a conf and classes directory, append to BBPATH
+BBPATH .= ":${LAYERDIR}"
+
+# We have a recipes directory, add to BBFILES
+BBFILES += "${LAYERDIR}/recipes*/*/*.bb ${LAYERDIR}/recipes*/*/*.bbappend"
+
+BBFILE_COLLECTIONS += "lts-go-mixin"
+BBFILE_PATTERN_lts-go-mixin := "^${LAYERDIR}/"
+BBFILE_PRIORITY_lts-go-mixin = "6"
+
+LAYERSERIES_COMPAT_lts-go-mixin = "dunfell"
+
+LAYERDEPENDS_lts-go-mixin = " \
+ core \
+"
+
+GOVERSION ?= "1.17%"
+PREFERRED_PROVIDER_go-native = "go-binary-native"
Just out of curiosity: I thought the agreement was that neither PREFERRED_PROVIDER_* nor recipe/provider specific settings should be part of a layer.conf
PREFERRED_PROVIDER_go-native as a hard assignment might be troublesome in some setups (mainly depending on what order bblayers.conf actually has)

+


[meta-lts-mixins][dunfell/docker PATCH 2/2] docker-ce: add the recipes and its dependencies from meta-virtualization

Alexander Kanavin
 

These recipes are copied verbatim from:
https://git.yoctoproject.org/meta-virtualization/tree/?id=dbd37caa6d48772b87426450fb6b816c11acc68a

(copy from external source:
git: https://git.yoctoproject.org/meta-virtualization
archive: dbd37caa6d48772b87426450fb6b816c11acc68a
copy: recipes-containers/ --> recipes-containers/
copy: recipes-devtools/go/ --> recipes-devtools/go/
)

Acked-by: Martin Kaistra <martin.kaistra@...>
Signed-off-by: Alexander Kanavin <alex@...>
---
.../cgroup-lite/cgroup-lite_1.15.bb | 34 ++++
.../cgroup-lite/files/cgroups-init | 27 +++
recipes-containers/containerd/README.md | 30 +++
.../0001-Add-build-option-GODEBUG-1.patch | 32 ++++
...O_BUILD_FLAGS-to-be-externally-speci.patch | 38 ++++
.../containerd-opencontainers_git.bb | 127 +++++++++++++
...1-build-use-oe-provided-GO-and-flags.patch | 64 +++++++
recipes-containers/docker/docker-ce_git.bb | 57 ++++++
recipes-containers/docker/docker.inc | 179 ++++++++++++++++++
...ernal-GO111MODULE-and-cross-compiler.patch | 27 +++
...0001-dynbinary-use-go-cross-compiler.patch | 23 +++
...0001-libnetwork-use-GO-instead-of-go.patch | 59 ++++++
recipes-containers/docker/files/docker.init | 131 +++++++++++++
...-GOBUILDFLAGS-for-runc-and-remove-re.patch | 37 ++++
...001-runc-Add-console-socket-dev-null.patch | 30 +++
.../0001-runc-docker-SIGUSR1-daemonize.patch | 131 +++++++++++++
recipes-containers/runc/runc-docker_git.bb | 14 ++
.../runc/runc-opencontainers_git.bb | 10 +
recipes-containers/runc/runc.inc | 83 ++++++++
...-output-binary-allow-yocto-to-do-thi.patch | 28 +++
recipes-containers/tini/tini_0.19.0.bb | 32 ++++
recipes-devtools/go/compose-file_git.bb | 41 ++++
.../0001-build-use-instead-of-go.patch | 30 +++
recipes-devtools/go/go-build_git.bb | 58 ++++++
recipes-devtools/go/go-capability_git.bb | 29 +++
recipes-devtools/go/go-cli_git.bb | 29 +++
recipes-devtools/go/go-connections_git.bb | 39 ++++
recipes-devtools/go/go-context_git.bb | 28 +++
recipes-devtools/go/go-dbus_git.bb | 29 +++
recipes-devtools/go/go-distribution_git.bb | 39 ++++
recipes-devtools/go/go-fsnotify_git.bb | 29 +++
recipes-devtools/go/go-libtrust_git.bb | 29 +++
recipes-devtools/go/go-logrus_git.bb | 29 +++
recipes-devtools/go/go-md2man_git.bb | 23 +++
recipes-devtools/go/go-metalinter_git.bb | 24 +++
recipes-devtools/go/go-mux_git.bb | 28 +++
recipes-devtools/go/go-patricia_git.bb | 29 +++
recipes-devtools/go/go-pty_git.bb | 28 +++
recipes-devtools/go/go-systemd_git.bb | 31 +++
recipes-devtools/go/grpc-go_git.bb | 41 ++++
recipes-devtools/go/notary_git.bb | 39 ++++
41 files changed, 1845 insertions(+)
create mode 100644 recipes-containers/cgroup-lite/cgroup-lite_1.15.bb
create mode 100755 recipes-containers/cgroup-lite/files/cgroups-init
create mode 100644 recipes-containers/containerd/README.md
create mode 100644 recipes-containers/containerd/containerd-opencontainers/0001-Add-build-option-GODEBUG-1.patch
create mode 100644 recipes-containers/containerd/containerd-opencontainers/0001-Makefile-allow-GO_BUILD_FLAGS-to-be-externally-speci.patch
create mode 100644 recipes-containers/containerd/containerd-opencontainers_git.bb
create mode 100644 recipes-containers/containerd/files/0001-build-use-oe-provided-GO-and-flags.patch
create mode 100644 recipes-containers/docker/docker-ce_git.bb
create mode 100644 recipes-containers/docker/docker.inc
create mode 100644 recipes-containers/docker/files/0001-cli-use-external-GO111MODULE-and-cross-compiler.patch
create mode 100644 recipes-containers/docker/files/0001-dynbinary-use-go-cross-compiler.patch
create mode 100644 recipes-containers/docker/files/0001-libnetwork-use-GO-instead-of-go.patch
create mode 100644 recipes-containers/docker/files/docker.init
create mode 100644 recipes-containers/runc/files/0001-Makefile-respect-GOBUILDFLAGS-for-runc-and-remove-re.patch
create mode 100644 recipes-containers/runc/runc-docker/0001-runc-Add-console-socket-dev-null.patch
create mode 100644 recipes-containers/runc/runc-docker/0001-runc-docker-SIGUSR1-daemonize.patch
create mode 100644 recipes-containers/runc/runc-docker_git.bb
create mode 100644 recipes-containers/runc/runc-opencontainers_git.bb
create mode 100644 recipes-containers/runc/runc.inc
create mode 100644 recipes-containers/tini/tini/0001-Do-not-strip-the-output-binary-allow-yocto-to-do-thi.patch
create mode 100644 recipes-containers/tini/tini_0.19.0.bb
create mode 100644 recipes-devtools/go/compose-file_git.bb
create mode 100644 recipes-devtools/go/go-build/0001-build-use-instead-of-go.patch
create mode 100644 recipes-devtools/go/go-build_git.bb
create mode 100644 recipes-devtools/go/go-capability_git.bb
create mode 100644 recipes-devtools/go/go-cli_git.bb
create mode 100644 recipes-devtools/go/go-connections_git.bb
create mode 100644 recipes-devtools/go/go-context_git.bb
create mode 100644 recipes-devtools/go/go-dbus_git.bb
create mode 100644 recipes-devtools/go/go-distribution_git.bb
create mode 100644 recipes-devtools/go/go-fsnotify_git.bb
create mode 100644 recipes-devtools/go/go-libtrust_git.bb
create mode 100644 recipes-devtools/go/go-logrus_git.bb
create mode 100644 recipes-devtools/go/go-md2man_git.bb
create mode 100644 recipes-devtools/go/go-metalinter_git.bb
create mode 100644 recipes-devtools/go/go-mux_git.bb
create mode 100644 recipes-devtools/go/go-patricia_git.bb
create mode 100644 recipes-devtools/go/go-pty_git.bb
create mode 100644 recipes-devtools/go/go-systemd_git.bb
create mode 100644 recipes-devtools/go/grpc-go_git.bb
create mode 100644 recipes-devtools/go/notary_git.bb

diff --git a/recipes-containers/cgroup-lite/cgroup-lite_1.15.bb b/recipes-containers/cgroup-lite/cgroup-lite_1.15.bb
new file mode 100644
index 0000000..8bed040
--- /dev/null
+++ b/recipes-containers/cgroup-lite/cgroup-lite_1.15.bb
@@ -0,0 +1,34 @@
+SECTION = "devel"
+SUMMARY = "Light-weight package to set up cgroups at system boot."
+DESCRIPTION = "Light-weight package to set up cgroups at system boot."
+HOMEPAGE = "http://packages.ubuntu.com/source/artful/cgroup-lite"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://debian/copyright;md5=5d5da4e0867cf06014f87102154d0102"
+SRC_URI = "https://launchpad.net/ubuntu/+archive/primary/+files/cgroup-lite_1.15.tar.xz"
+SRC_URI += "file://cgroups-init"
+SRC_URI[md5sum] = "1438c1f4a7227c0dedfce5f86f02591d"
+SRC_URI[sha256sum] = "02f44c70ed3cf27b9e89e5266492fddf4b455336ab4e03abc85e92297537201f"
+
+inherit allarch update-rc.d systemd
+
+INITSCRIPT_NAME = "cgroups-init"
+INITSCRIPT_PARAMS = "start 8 2 3 4 5 . stop 20 0 1 6 ."
+
+# Keeps the sysvinit scripts out of the image if building
+# where systemd is in use.
+SYSTEMD_PACKAGES = "${PN}"
+SYSTEMD_SERVICE:${PN} = "cgroups-init.service"
+SYSTEMD_AUTO_ENABLE:${PN} = "mask"
+
+
+do_install() {
+ install -d ${D}/${base_bindir}
+ install -m 0755 ${S}/scripts/cgroups-mount ${D}/${base_bindir}
+ install -m 0755 ${S}/scripts/cgroups-umount ${D}/${base_bindir}
+
+ install -d ${D}${sysconfdir}/init.d
+ install -m 0755 ${WORKDIR}/cgroups-init ${D}${sysconfdir}/init.d/cgroups-init
+
+ install -d ${D}${systemd_unitdir}/system
+ ln -sf /dev/null ${D}${systemd_unitdir}/system/cgroups-init.service
+}
diff --git a/recipes-containers/cgroup-lite/files/cgroups-init b/recipes-containers/cgroup-lite/files/cgroups-init
new file mode 100755
index 0000000..e504024
--- /dev/null
+++ b/recipes-containers/cgroup-lite/files/cgroups-init
@@ -0,0 +1,27 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: cgroups mount
+# Required-Start: $network $remote_fs
+# Required-Stop: $network $remote_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: mount/unmount cgroups
+### END INIT INFO
+
+# must start before libvirtd is run
+case "$1" in
+ start)
+ echo -n "Mounting cgroups..."
+ /bin/cgroups-mount
+ echo "Done"
+ ;;
+ stop)
+ echo -n "Unmounting cgroups..."
+ /bin/cgroups-umount
+ echo "Done"
+ ;;
+ *)
+ echo "Usage: /etc/init.d/cgroups-init {start|stop}"
+ exit 1
+ ;;
+esac
diff --git a/recipes-containers/containerd/README.md b/recipes-containers/containerd/README.md
new file mode 100644
index 0000000..f773079
--- /dev/null
+++ b/recipes-containers/containerd/README.md
@@ -0,0 +1,30 @@
+# containerd: sample image fetch and exec commands
+
+```shell
+root@qemux86-64:~# ctr images list
+REF TYPE DIGEST SIZE PLATFORMS
+docker.io/calico/node:v3.11.2 application/vnd.docker.distribution.manifest.list.v2+json sha256:887bcd551668cccae1fbfd6d2eb0f635ec37bb4cf599e1169989aa49dfac5b57 84.8 MiB linux/amd64,linux/arm64,linux/ppc64le
+docker.io/library/alpine:latest application/vnd.docker.distribution.manifest.list.v2+json sha256:c0e9560cda118f9ec63ddefb4a173a2b2a0347082d7dff7dc14272e7841a5b5a 2.7 MiB linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,l
+
+root@qemux86-64:~# ctr image pull docker.io/library/alpine:latest
+docker.io/library/alpine:latest: resolved |++++++++++++++++++++++++++++++++++++++|
+index-sha256:c0e9560cda118f9ec63ddefb4a173a2b2a0347082d7dff7dc14272e7841a5b5a: exists |++++++++++++++++++++++++++++++++++++++|
+manifest-sha256:d7342993700f8cd7aba8496c2d0e57be0666e80b4c441925fc6f9361fa81d10e: exists |++++++++++++++++++++++++++++++++++++++|
+layer-sha256:188c0c94c7c576fff0792aca7ec73d67a2f7f4cb3a6e53a84559337260b36964: exists |++++++++++++++++++++++++++++++++++++++|
+config-sha256:d6e46aa2470df1d32034c6707c8041158b652f38d2a9ae3d7ad7e7532d22ebe0: exists |++++++++++++++++++++++++++++++++++++++|
+elapsed: 6.5 s total: 0.0 B (0.0 B/s)
+unpacking linux/amd64 sha256:c0e9560cda118f9ec63ddefb4a173a2b2a0347082d7dff7dc14272e7841a5b5a...
+
+
+root@qemux86-64:~# ctr run -t docker.io/library/alpine:latest dtest /bin/sh
+/ # uname -a
+Linux qemux86-64 5.8.13-yocto-standard #1 SMP PREEMPT Tue Oct 6 12:23:29 UTC 2020 x86_64 Linux
+/ #
+
+
+ # root@qemux86-64:~# ctr c list
+CONTAINER IMAGE RUNTIME
+dtest docker.io/library/alpine:latest io.containerd.runc.v2
+
+root@qemux86-64:~# ctr c delete dtest
+```
\ No newline at end of file
diff --git a/recipes-containers/containerd/containerd-opencontainers/0001-Add-build-option-GODEBUG-1.patch b/recipes-containers/containerd/containerd-opencontainers/0001-Add-build-option-GODEBUG-1.patch
new file mode 100644
index 0000000..8b43c8a
--- /dev/null
+++ b/recipes-containers/containerd/containerd-opencontainers/0001-Add-build-option-GODEBUG-1.patch
@@ -0,0 +1,32 @@
+From 84874e47aa2025b8e73df0286c44f3b8a1d9fdb2 Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@...>
+Date: Mon, 2 Sep 2019 16:20:07 +0800
+Subject: [PATCH] Add build option "GODEBUG=1"
+
+Make will generate GDB friendly binary with this build option.
+
+Signed-off-by: Hui Zhu <teawater@...>
+
+Upstream-Status: Backport [c5a0c7f491b435e4eb45972903b00e2d8ed46495]
+
+Partly backport and refresh to v1.2.7
+Signed-off-by: Hongxu Jia <hongxu.jia@...>
+---
+ src/import/Makefile | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+Index: git/src/import/Makefile
+===================================================================
+--- git.orig/src/import/Makefile 2020-10-12 08:09:41.638977052 -0700
++++ git/src/import/Makefile 2020-10-12 08:10:49.783074373 -0700
+@@ -72,6 +72,10 @@
+ COMMANDS=ctr containerd containerd-stress
+ MANPAGES=ctr.8 containerd.8 containerd-config.8 containerd-config.toml.5
+
++ifndef GODEBUG
++ EXTRA_LDFLAGS += -s -w
++endif
++
+ ifdef BUILDTAGS
+ GO_BUILDTAGS = ${BUILDTAGS}
+ endif
diff --git a/recipes-containers/containerd/containerd-opencontainers/0001-Makefile-allow-GO_BUILD_FLAGS-to-be-externally-speci.patch b/recipes-containers/containerd/containerd-opencontainers/0001-Makefile-allow-GO_BUILD_FLAGS-to-be-externally-speci.patch
new file mode 100644
index 0000000..7f4d751
--- /dev/null
+++ b/recipes-containers/containerd/containerd-opencontainers/0001-Makefile-allow-GO_BUILD_FLAGS-to-be-externally-speci.patch
@@ -0,0 +1,38 @@
+From 474b93f8f643651144304a6971ef476add7f06f8 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@...>
+Date: Tue, 25 May 2021 12:49:41 -0400
+Subject: [PATCH] Makefile: allow GO_BUILD_FLAGS to be externally specified
+
+Since our oe-core go infrastructure insists on both -pie and static
+builds (for the most part), and that is not recommended by many
+packages, we end up with errors like:
+
+ cannot find package runtime/cgo (using -importcfg)
+ ...
+ recipe-sysroot-native/usr/lib/aarch64-poky-linux/go/pkg/tool/linux_amd64/link:
+ cannot open file : open : no such file or directory
+
+Upstream-Status: Inappropriate: specific to OE go configuration and build
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@...>
+---
+ Makefile | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git git.orig/src/import/Makefile git.orig/src/import/Makefile
+index c61418e60..54a10eb42 100644
+--- git.orig/src/import/Makefile
++++ git.orig/src/import/Makefile
+@@ -112,7 +112,8 @@ endif
+ GOPATHS=$(shell echo ${GOPATH} | tr ":" "\n" | tr ";" "\n")
+
+ TESTFLAGS_RACE=
+-GO_BUILD_FLAGS=
++# allow flags to be exported and picked up.
++# GO_BUILD_FLAGS=
+ # See Golang issue re: '-trimpath': https://github.com/golang/go/issues/13809
+ GO_GCFLAGS=$(shell \
+ set -- ${GOPATHS}; \
+--
+2.19.1
+
diff --git a/recipes-containers/containerd/containerd-opencontainers_git.bb b/recipes-containers/containerd/containerd-opencontainers_git.bb
new file mode 100644
index 0000000..361ed25
--- /dev/null
+++ b/recipes-containers/containerd/containerd-opencontainers_git.bb
@@ -0,0 +1,127 @@
+HOMEPAGE = "https://github.com/docker/containerd"
+SUMMARY = "containerd is a daemon to control runC"
+DESCRIPTION = "containerd is a daemon to control runC, built for performance and density. \
+ containerd leverages runC's advanced features such as seccomp and user namespace \
+ support as well as checkpoint and restore for cloning and live migration of containers."
+
+
+SRCREV = "1e5ef943eb76627a6d3b6de8cd1ef6537f393a71"
+SRC_URI = "git://github.com/containerd/containerd;branch=release/1.5;protocol=https \
+ file://0001-Add-build-option-GODEBUG-1.patch \
+ file://0001-Makefile-allow-GO_BUILD_FLAGS-to-be-externally-speci.patch \
+ "
+
+# Apache-2.0 for containerd
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=1269f40c0d099c21a871163984590d89"
+
+CONTAINERD_VERSION = "v1.5.8"
+
+EXTRA_OEMAKE += "GODEBUG=1"
+
+PROVIDES += "virtual/containerd"
+RPROVIDES:${PN} = "virtual-containerd"
+
+S = "${WORKDIR}/git"
+
+PV = "${CONTAINERD_VERSION}+git${SRCPV}"
+
+inherit go
+inherit goarch
+
+GO_IMPORT = "import"
+
+CONTAINERD_PKG="github.com/containerd/containerd"
+
+INSANE_SKIP:${PN} += "ldflags"
+
+do_configure[noexec] = "1"
+
+do_compile() {
+ export GOARCH="${TARGET_GOARCH}"
+
+ # link fixups for compilation
+ rm -f ${S}/src/import/vendor/src
+ ln -sf ./ ${S}/src/import/vendor/src
+
+ mkdir -p ${S}/src/import/vendor/src/github.com/containerd/containerd/
+ mkdir -p ${S}/src/import/vendor/src/github.com/containerd/containerd/pkg/
+ mkdir -p ${S}/src/import/vendor/src/github.com/containerd/containerd/contrib/
+ # without this, the stress test parts of the build fail
+ cp ${S}/src/import/*.go ${S}/src/import/vendor/src/github.com/containerd/containerd
+
+ for c in content timeout ttrpcutil oom stdio process errdefs fs images mount snapshots linux api runtimes defaults progress \
+ protobuf reference diff platforms runtime remotes version archive dialer gc metadata \
+ metrics filters identifiers labels leases plugin server services \
+ cmd cio containers namespaces oci events log reaper sys rootfs nvidia seed apparmor seccomp \
+ cap cri userns atomic ioutil os registrar seutil runtimeoptions netns; do
+ if [ -d ${S}/src/import/${c} ]; then
+ ln -sfn ${S}/src/import/${c} ${S}/src/import/vendor/github.com/containerd/containerd/${c}
+ fi
+ if [ -d ${S}/src/import/pkg/${c} ]; then
+ ln -sfn ${S}/src/import/pkg/${c} ${S}/src/import/vendor/github.com/containerd/containerd/pkg/${c}
+ fi
+ if [ -d ${S}/src/import/contrib/${c} ]; then
+ ln -sfn ${S}/src/import/contrib/${c} ${S}/src/import/vendor/github.com/containerd/containerd/contrib/${c}
+ fi
+ done
+
+ export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
+ export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go"
+
+ # Pass the needed cflags/ldflags so that cgo
+ # can find the needed headers files and libraries
+ export CGO_ENABLED="1"
+ export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
+ export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
+ export BUILDTAGS="no_btrfs static_build netgo"
+ export CFLAGS="${CFLAGS}"
+ export LDFLAGS="${LDFLAGS}"
+ export SHIM_CGO_ENABLED="${CGO_ENABLED}"
+ # fixes:
+ # cannot find package runtime/cgo (using -importcfg)
+ # ... recipe-sysroot-native/usr/lib/aarch64-poky-linux/go/pkg/tool/linux_amd64/link:
+ # cannot open file : open : no such file or directory
+ export GO_BUILD_FLAGS="-a -pkgdir dontusecurrentpkgs"
+ export GO111MODULE=off
+
+ cd ${S}/src/import
+ oe_runmake binaries
+}
+
+inherit systemd
+SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}"
+SYSTEMD_SERVICE:${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','containerd.service','',d)}"
+
+do_install() {
+ mkdir -p ${D}/${bindir}
+
+ cp ${S}/src/import/bin/containerd ${D}/${bindir}/containerd
+ cp ${S}/src/import/bin/containerd-shim ${D}/${bindir}/containerd-shim
+ cp ${S}/src/import/bin/containerd-shim-runc-v1 ${D}/${bindir}/containerd-shim-runc-v1
+ cp ${S}/src/import/bin/containerd-shim-runc-v2 ${D}/${bindir}/containerd-shim-runc-v2
+ cp ${S}/src/import/bin/ctr ${D}/${bindir}/containerd-ctr
+
+ ln -sf containerd ${D}/${bindir}/docker-containerd
+ ln -sf containerd-shim ${D}/${bindir}/docker-containerd-shim
+ ln -sf containerd-ctr ${D}/${bindir}/docker-containerd-ctr
+
+ ln -sf containerd-ctr ${D}/${bindir}/ctr
+
+ if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+ install -d ${D}${systemd_unitdir}/system
+ install -m 644 ${S}/src/import/containerd.service ${D}/${systemd_unitdir}/system
+ # adjust from /usr/local/bin to /usr/bin/
+ sed -e "s:/usr/local/bin/containerd:${bindir}/containerd:g" -i ${D}/${systemd_unitdir}/system/containerd.service
+ fi
+}
+
+FILES:${PN} += "${systemd_system_unitdir}/*"
+
+INSANE_SKIP:${PN} += "ldflags already-stripped"
+
+COMPATIBLE_HOST = "^(?!(qemu)?mips).*"
+
+RDEPENDS:${BPN} += " virtual-runc"
+
+CVE_PRODUCT = "containerd"
diff --git a/recipes-containers/containerd/files/0001-build-use-oe-provided-GO-and-flags.patch b/recipes-containers/containerd/files/0001-build-use-oe-provided-GO-and-flags.patch
new file mode 100644
index 0000000..544881e
--- /dev/null
+++ b/recipes-containers/containerd/files/0001-build-use-oe-provided-GO-and-flags.patch
@@ -0,0 +1,64 @@
+From 408e8b526d490af817a64b7220e8e2c3789de58f Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@...>
+Date: Sun, 10 Feb 2019 23:46:06 +0000
+Subject: [PATCH] build: use oe provided GO and flags
+
+We want to use the go compiler as defined in the oe-enviroment, not the
+generic call to 'go'. Without changing this, we'll get things like cgo
+errors and invalid flag combos.
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@...>
+---
+ Makefile | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+Index: git/src/import/Makefile
+===================================================================
+--- git.orig/src/import/Makefile
++++ git/src/import/Makefile
+@@ -121,7 +121,7 @@
+ TESTFLAGS_PARALLEL ?= 8
+
+ # Use this to replace `go test` with, for instance, `gotestsum`
+-GOTEST ?= go test
++GOTEST ?= $(GO) test
+
+ OUTPUTDIR = $(join $(ROOTDIR), _output)
+ CRIDIR=$(OUTPUTDIR)/cri
+@@ -169,7 +169,7 @@
+
+ build: ## build the go packages
+ @echo "$(WHALE) $@"
+- @go build ${DEBUG_GO_GCFLAGS} ${GO_GCFLAGS} ${GO_BUILD_FLAGS} ${EXTRA_FLAGS} ${GO_LDFLAGS} ${PACKAGES}
++ @$(GO) build ${DEBUG_GO_GCFLAGS} ${GO_GCFLAGS} ${GO_BUILD_FLAGS} ${EXTRA_FLAGS} ${GO_LDFLAGS} ${PACKAGES}
+
+ test: ## run tests, except integration tests and tests that require root
+ @echo "$(WHALE) $@"
+@@ -201,7 +201,7 @@
+
+ define BUILD_BINARY
+ @echo "$(WHALE) $@"
+-@go build ${DEBUG_GO_GCFLAGS} ${GO_GCFLAGS} ${GO_BUILD_FLAGS} -o $@ ${GO_LDFLAGS} ${GO_TAGS} ./$<
++@$(GO) build ${DEBUG_GO_GCFLAGS} ${GO_GCFLAGS} ${GO_BUILD_FLAGS} -o $@ ${GO_LDFLAGS} ${GO_TAGS} ./$<
+ endef
+
+ # Build a binary from a cmd.
+@@ -210,15 +210,15 @@
+
+ bin/containerd-shim: cmd/containerd-shim FORCE # set !cgo and omit pie for a static shim build: https://github.com/golang/go/issues/17789#issuecomment-258542220
+ @echo "$(WHALE) bin/containerd-shim"
+- @CGO_ENABLED=${SHIM_CGO_ENABLED} go build ${GO_BUILD_FLAGS} -o bin/containerd-shim ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim
++ @CGO_ENABLED=${SHIM_CGO_ENABLED} $(GO) build -a -pkgdir dontusecurrentpkgs ${GO_BUILD_FLAGS} -o bin/containerd-shim ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim
+
+ bin/containerd-shim-runc-v1: cmd/containerd-shim-runc-v1 FORCE # set !cgo and omit pie for a static shim build: https://github.com/golang/go/issues/17789#issuecomment-258542220
+ @echo "$(WHALE) bin/containerd-shim-runc-v1"
+- @CGO_ENABLED=${SHIM_CGO_ENABLED} go build ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v1 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v1
++ @CGO_ENABLED=${SHIM_CGO_ENABLED} $(GO) build -a -pkgdir dontusecurrentpkgs ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v1 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v1
+
+ bin/containerd-shim-runc-v2: cmd/containerd-shim-runc-v2 FORCE # set !cgo and omit pie for a static shim build: https://github.com/golang/go/issues/17789#issuecomment-258542220
+ @echo "$(WHALE) bin/containerd-shim-runc-v2"
+- @CGO_ENABLED=${SHIM_CGO_ENABLED} go build ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v2 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v2
++ @CGO_ENABLED=${SHIM_CGO_ENABLED} $(GO) build -a -pkgdir dontusecurrentpkgs ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v2 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v2
+
+ binaries: $(BINARIES) ## build binaries
+ @echo "$(WHALE) $@"
diff --git a/recipes-containers/docker/docker-ce_git.bb b/recipes-containers/docker/docker-ce_git.bb
new file mode 100644
index 0000000..5fe8fbd
--- /dev/null
+++ b/recipes-containers/docker/docker-ce_git.bb
@@ -0,0 +1,57 @@
+HOMEPAGE = "http://www.docker.com"
+SUMMARY = "Linux container runtime"
+DESCRIPTION = "Linux container runtime \
+ Docker complements kernel namespacing with a high-level API which \
+ operates at the process level. It runs unix processes with strong \
+ guarantees of isolation and repeatability across servers. \
+ . \
+ Docker is a great building block for automating distributed systems: \
+ large-scale web deployments, database clusters, continuous deployment \
+ systems, private PaaS, service-oriented architectures, etc. \
+ . \
+ This package contains the daemon and client, which are \
+ officially supported on x86_64 and arm hosts. \
+ Other architectures are considered experimental. \
+ . \
+ Also, note that kernel version 3.10 or above is required for proper \
+ operation of the daemon process, and that any lower versions may have \
+ subtle and/or glaring issues. \
+ "
+
+#
+# https://github.com/docker/docker-ce-packaging.git
+# common.mk:
+# DOCKER_CLI_REPO ?= https://github.com/docker/cli.git
+# DOCKER_ENGINE_REPO ?= https://github.com/docker/docker.git
+# REF ?= HEAD
+# DOCKER_CLI_REF ?= $(REF)
+# DOCKER_ENGINE_REF ?= $(REF)
+#
+# These follow the tags for our releases in the listed repositories
+# so we get that tag, and make it our SRCREVS:
+#
+
+SRCREV_docker = "d24c6dc5cf5e68dfb30027b2db454099566a9b9e"
+SRCREV_libnetwork = "64b7a4574d1426139437d20e81c0b6d391130ec8"
+SRCREV_cli = "62eae52c2a76f4c1dcf79dfc7b5ea3bf5eebab8b"
+SRCREV_FORMAT = "docker_libnetwork"
+SRC_URI = "\
+ git://github.com/docker/docker.git;branch=20.10;name=docker;protocol=https \
+ git://github.com/docker/libnetwork.git;branch=master;name=libnetwork;destsuffix=git/libnetwork;protocol=https \
+ git://github.com/docker/cli;branch=20.10;name=cli;destsuffix=git/cli;protocol=https \
+ file://0001-libnetwork-use-GO-instead-of-go.patch \
+ file://docker.init \
+ file://0001-dynbinary-use-go-cross-compiler.patch \
+ file://0001-cli-use-external-GO111MODULE-and-cross-compiler.patch \
+ "
+
+require docker.inc
+
+# Apache-2.0 for docker
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=4859e97a9c7780e77972d989f0823f28"
+
+DOCKER_VERSION = "20.10.8-ce"
+PV = "${DOCKER_VERSION}+git${SRCREV_docker}"
+
+CVE_PRODUCT = "docker"
diff --git a/recipes-containers/docker/docker.inc b/recipes-containers/docker/docker.inc
new file mode 100644
index 0000000..40a3642
--- /dev/null
+++ b/recipes-containers/docker/docker.inc
@@ -0,0 +1,179 @@
+DEPENDS = " \
+ go-cli \
+ go-pty \
+ go-context \
+ go-mux \
+ go-patricia \
+ go-logrus \
+ go-fsnotify \
+ go-dbus \
+ go-capability \
+ go-systemd \
+ btrfs-tools \
+ sqlite3 \
+ go-distribution \
+ compose-file \
+ go-connections \
+ notary \
+ grpc-go \
+ libtool-native \
+ libtool \
+ "
+
+DEPENDS:append:class-target = " lvm2"
+RDEPENDS:${PN} = "util-linux util-linux-unshare iptables \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'aufs', 'aufs-util', '', d)} \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'cgroup-lite', d)} \
+ bridge-utils \
+ ca-certificates \
+ "
+RDEPENDS:${PN} += "virtual-containerd virtual-runc"
+
+RRECOMMENDS:${PN} = "kernel-module-dm-thin-pool kernel-module-nf-nat kernel-module-nf-conntrack-netlink kernel-module-xt-addrtype kernel-module-xt-masquerade"
+
+PROVIDES += "virtual/docker"
+
+# we want all the docker variant recpes to be installable via "docker"
+PACKAGE_NAME = "docker"
+RPROVIDES:${PN} += "docker"
+RPROVIDES:${PN}-dbg += "docker-dbg"
+RPROVIDES:${PN}-dev += "docker-dev"
+RPROVIDES:${PN}-contrip += "docker-dev"
+
+inherit pkgconfig
+PACKAGECONFIG ??= "docker-init"
+PACKAGECONFIG[seccomp] = "seccomp,,libseccomp"
+PACKAGECONFIG[docker-init] = ",,,docker-init"
+PACKAGECONFIG[transient-config] = "transient-config"
+
+
+GO_IMPORT = "import"
+S = "${WORKDIR}/git"
+
+
+inherit systemd update-rc.d
+inherit go
+inherit goarch
+inherit pkgconfig
+
+do_configure[noexec] = "1"
+
+DOCKER_PKG="github.com/docker/docker"
+# in order to exclude devicemapper and btrfs - https://github.com/docker/docker/issues/14056
+BUILD_TAGS ?= "exclude_graphdriver_btrfs exclude_graphdriver_devicemapper"
+
+do_compile() {
+ # Set GOPATH. See 'PACKAGERS.md'. Don't rely on
+ # docker to download its dependencies but rather
+ # use dependencies packaged independently.
+ cd ${S}/src/import
+ rm -rf .gopath
+ mkdir -p .gopath/src/"$(dirname "${DOCKER_PKG}")"
+ ln -sf ../../../.. .gopath/src/"${DOCKER_PKG}"
+
+ mkdir -p .gopath/src/github.com/docker
+ ln -sf ${WORKDIR}/git/libnetwork .gopath/src/github.com/docker/libnetwork
+ ln -sf ${WORKDIR}/git/cli .gopath/src/github.com/docker/cli
+
+ export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
+ export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go"
+
+ # Pass the needed cflags/ldflags so that cgo
+ # can find the needed headers files and libraries
+ export GOARCH=${TARGET_GOARCH}
+ export CGO_ENABLED="1"
+ export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
+ export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
+ export DOCKER_BUILDTAGS='${BUILD_TAGS} ${PACKAGECONFIG_CONFARGS}'
+ export GO111MODULE=off
+
+ export DISABLE_WARN_OUTSIDE_CONTAINER=1
+
+ cd ${S}/src/import/
+
+ # this is the unsupported built structure
+ # that doesn't rely on an existing docker
+ # to build this:
+ VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_moby}" ./hack/make.sh dynbinary
+
+ # build the cli
+ cd ${S}/src/import/.gopath/src/github.com/docker/cli
+ export CFLAGS=""
+ export LDFLAGS=""
+ export DOCKER_VERSION=${DOCKER_VERSION}
+ VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_moby}" make dynbinary
+
+ # build the proxy
+ cd ${S}/src/import/.gopath/src/github.com/docker/libnetwork
+ oe_runmake cross-local
+}
+
+do_install() {
+ mkdir -p ${D}/${bindir}
+ cp ${WORKDIR}/git/cli/build/docker ${D}/${bindir}/docker
+ cp ${S}/src/import/bundles/dynbinary-daemon/dockerd ${D}/${bindir}/dockerd
+ cp ${WORKDIR}/git/libnetwork/bin/docker-proxy* ${D}/${bindir}/docker-proxy
+
+ if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+ install -d ${D}${systemd_unitdir}/system
+ install -m 644 ${S}/src/import/contrib/init/systemd/docker.* ${D}/${systemd_unitdir}/system
+ # replaces one copied from above with one that uses the local registry for a mirror
+ install -m 644 ${S}/src/import/contrib/init/systemd/docker.service ${D}/${systemd_unitdir}/system
+ rm -f ${D}/${systemd_unitdir}/system/docker.service.rpm
+ fi
+ if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
+ install -d ${D}${sysconfdir}/init.d
+ install -m 0755 ${WORKDIR}/docker.init ${D}${sysconfdir}/init.d/docker.init
+ fi
+ # TLS key that docker creates at run-time if not found is what resides here
+ if ${@bb.utils.contains('PACKAGECONFIG','transient-config','true','false',d)}; then
+ install -d ${D}${sysconfdir}
+ ln -s ..${localstatedir}/run/docker ${D}${sysconfdir}/docker
+ else
+ install -d ${D}${sysconfdir}/docker
+ fi
+
+ mkdir -p ${D}${datadir}/docker/
+ install -m 0755 ${S}/src/import/contrib/check-config.sh ${D}${datadir}/docker/
+}
+
+
+SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}"
+SYSTEMD_SERVICE:${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','docker.socket','',d)}"
+SYSTEMD_AUTO_ENABLE:${PN} = "enable"
+
+INITSCRIPT_PACKAGES += "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','${PN}','',d)}"
+INITSCRIPT_NAME:${PN} = "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','docker.init','',d)}"
+INITSCRIPT_PARAMS:${PN} = "defaults"
+
+inherit useradd
+USERADD_PACKAGES = "${PN}"
+GROUPADD_PARAM:${PN} = "-r docker"
+
+COMPATIBLE_HOST = "^(?!(qemu)?mips).*"
+
+INSANE_SKIP:${PN} += "ldflags textrel"
+
+FILES:${PN} += "${systemd_unitdir}/system/* ${sysconfdir}/docker"
+
+PACKAGES =+ "${PN}-contrib"
+FILES:${PN}-contrib += "${datadir}/docker/check-config.sh"
+RDEPENDS:${PN}-contrib += "bash"
+
+# By the docker-packaging repository and https://docs.docker.com/engine/install/centos/#installation-methods
+# docker is packaged by most distros with a split between the engine and the CLI.
+#
+# We do the same here, by introducing the -cli package
+#
+# But to keep existing use cases working, we also create a RDEPENDS between the main
+# docker package (the engine) and the cli, so existing "docker" package installs will
+# continue to work the same way. To have separate and non-redepending packages created
+# set the DOCKER_UNIFIED_PACKAGE variable to False
+#
+PACKAGES =+ "${PN}-cli"
+FILES:${PN}-cli += "${bindir}/docker"
+
+# set to "False" if packages should be generated for the cli and engine, and
+# NOT rdepend to get a classic one-package install
+DOCKER_UNIFIED_PACKAGE ?= "True"
+RDEPENDS:${PN} += "${@bb.utils.contains("DOCKER_UNIFIED_PACKAGE", "True", "${PN}-cli", "", d)}"
diff --git a/recipes-containers/docker/files/0001-cli-use-external-GO111MODULE-and-cross-compiler.patch b/recipes-containers/docker/files/0001-cli-use-external-GO111MODULE-and-cross-compiler.patch
new file mode 100644
index 0000000..dc32261
--- /dev/null
+++ b/recipes-containers/docker/files/0001-cli-use-external-GO111MODULE-and-cross-compiler.patch
@@ -0,0 +1,27 @@
+From 650c882d3c53db118b01dd5e15fa1bc0ddaa36f1 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@...>
+Date: Thu, 15 Apr 2021 11:28:05 -0400
+Subject: [PATCH] cli: use external GO111MODULE and cross compiler
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@...>
+---
+ git/cli/scripts/build/binary | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git git/cli/scripts/build/binary git/cli/scripts/build/binary
+index e4c5e12a6b..7c47b75c2f 100755
+--- git/cli/scripts/build/binary
++++ git/cli/scripts/build/binary
+@@ -73,8 +73,7 @@ fi
+
+ echo "Building $GO_LINKMODE $(basename "${TARGET}")"
+
+-export GO111MODULE=auto
+
+-go build -o "${TARGET}" -tags "${GO_BUILDTAGS}" --ldflags "${LDFLAGS}" ${GO_BUILDMODE} "${SOURCE}"
++${GO} build -o "${TARGET}" -tags "${GO_BUILDTAGS}" --ldflags "${LDFLAGS}" ${GO_BUILDMODE} "${SOURCE}"
+
+ ln -sf "$(basename "${TARGET}")" "$(dirname "${TARGET}")/docker"
+--
+2.19.1
+
diff --git a/recipes-containers/docker/files/0001-dynbinary-use-go-cross-compiler.patch b/recipes-containers/docker/files/0001-dynbinary-use-go-cross-compiler.patch
new file mode 100644
index 0000000..971c60d
--- /dev/null
+++ b/recipes-containers/docker/files/0001-dynbinary-use-go-cross-compiler.patch
@@ -0,0 +1,23 @@
+From bbf600cc4d46c3f7ec0c1b486790a2402d41f550 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@...>
+Date: Tue, 30 Jun 2020 22:23:33 -0400
+Subject: [PATCH] dynbinary: use go cross compiler
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@...>
+---
+ hack/make/.binary | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: git/src/import/hack/make/.binary
+===================================================================
+--- git.orig/src/import/hack/make/.binary
++++ git/src/import/hack/make/.binary
+@@ -81,7 +81,7 @@
+
+ echo "Building: $DEST/$BINARY_FULLNAME"
+ echo "GOOS=\"${GOOS}\" GOARCH=\"${GOARCH}\" GOARM=\"${GOARM}\""
+- go build \
++ ${GO} build \
+ -o "$DEST/$BINARY_FULLNAME" \
+ "${BUILDFLAGS[@]}" \
+ -ldflags "
diff --git a/recipes-containers/docker/files/0001-libnetwork-use-GO-instead-of-go.patch b/recipes-containers/docker/files/0001-libnetwork-use-GO-instead-of-go.patch
new file mode 100644
index 0000000..c623b26
--- /dev/null
+++ b/recipes-containers/docker/files/0001-libnetwork-use-GO-instead-of-go.patch
@@ -0,0 +1,59 @@
+From 04c07804930faad708218a3134c81de06a9c742a Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@...>
+Date: Fri, 6 Apr 2018 23:58:22 -0400
+Subject: [PATCH] libnetwork: use $(GO) instead of go
+
+Ensure that the libnetwork makefile uses the go cross flags and
+utilities.
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@...>
+---
+ Makefile | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+Index: git/libnetwork/Makefile
+===================================================================
+--- git.orig/libnetwork/Makefile
++++ git/libnetwork/Makefile
+@@ -45,9 +45,9 @@
+ build-local:
+ @echo "šŸ³ $@"
+ @mkdir -p "bin"
+- go build -tags experimental -o "bin/dnet" ./cmd/dnet
+- go build -o "bin/docker-proxy" ./cmd/proxy
+- CGO_ENABLED=0 go build -o "bin/diagnosticClient" ./cmd/diagnostic
++ $(GO) build -tags experimental -o "bin/dnet" ./cmd/dnet
++ $(GO) build -o "bin/proxy" ./cmd/proxy
++ CGO_ENABLED=0 $(GO) build -o "bin/diagnosticClient" ./cmd/diagnostic
+ CGO_ENABLED=0 go build -o "bin/testMain" ./cmd/networkdb-test/testMain.go
+
+ build-images:
+@@ -82,8 +82,8 @@
+
+ cross-local:
+ @echo "šŸ³ $@"
+- go build -o "bin/dnet-$$GOOS-$$GOARCH" ./cmd/dnet
+- go build -o "bin/docker-proxy-$$GOOS-$$GOARCH" ./cmd/proxy
++ @$(GO) build -linkshared $(GOBUILDFLAGS) -o "bin/docker-proxy-$$GOOS-$$GOARCH" ./cmd/proxy
++ @$(GO) build -linkshared $(GOBUILDFLAGS) -o "bin/dnet-$$GOOS-$$GOARCH" ./cmd/dnet
+
+ # Rebuild protocol buffers.
+ # These may need to be rebuilt after vendoring updates, so .proto files are declared .PHONY so they are always rebuilt.
+@@ -130,7 +130,7 @@
+ if ls $$dir/*.go &> /dev/null; then \
+ pushd . &> /dev/null ; \
+ cd $$dir ; \
+- go test ${INSIDECONTAINER} -test.parallel 5 -test.v -covermode=count -coverprofile=./profile.tmp ; \
++ $(GO) test ${INSIDECONTAINER} -test.parallel 5 -test.v -covermode=count -coverprofile=./profile.tmp ; \
+ ret=$$? ;\
+ if [ $$ret -ne 0 ]; then exit $$ret; fi ;\
+ popd &> /dev/null; \
+@@ -145,7 +145,7 @@
+ # Depends on binaries because vet will silently fail if it can not load compiled imports
+ vet: ## run go vet
+ @echo "šŸ³ $@"
+- @test -z "$$(go vet ${PACKAGES} 2>&1 | grep -v 'constant [0-9]* not a string in call to Errorf' | egrep -v '(timestamp_test.go|duration_test.go|exit status 1)' | tee /dev/stderr)"
++ @test -z "$$($(GO) vet ${PACKAGES} 2>&1 | grep -v 'constant [0-9]* not a string in call to Errorf' | egrep -v '(timestamp_test.go|duration_test.go|exit status 1)' | tee /dev/stderr)"
+
+ misspell:
+ @echo "šŸ³ $@"
diff --git a/recipes-containers/docker/files/docker.init b/recipes-containers/docker/files/docker.init
new file mode 100644
index 0000000..24f8fea
--- /dev/null
+++ b/recipes-containers/docker/files/docker.init
@@ -0,0 +1,131 @@
+#!/bin/sh
+#
+# /etc/rc.d/init.d/docker
+#
+# Daemon for docker.com
+#
+# chkconfig: 2345 95 95
+# description: Daemon for docker.com
+
+### BEGIN INIT INFO
+# Provides: docker
+# Required-Start: $network cgconfig
+# Required-Stop:
+# Should-Start:
+# Should-Stop:
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: start and stop docker
+# Description: Daemon for docker.com
+### END INIT INFO
+
+# Source function library.
+. /etc/init.d/functions
+
+prog="dockerd"
+unshare=/usr/bin/unshare
+exec="/usr/bin/$prog"
+pidfile="/var/run/$prog.pid"
+lockfile="/var/lock/subsys/$prog"
+logfile="/var/log/$prog"
+other_args="--pidfile $pidfile --registry-mirror=http://localhost:5000 --insecure-registry=http://localhost:5000 --raw-logs"
+
+[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
+
+start() {
+ [ -x $exec ] || exit 5
+
+ check_for_cleanup
+
+ if ! [ -f $pidfile ]; then
+ printf "Starting $prog:\t"
+ echo -e "\n$(date)\n" >> $logfile
+ "$unshare" -m -- $exec $other_args >> $logfile 2>&1 &
+ pid=$!
+ touch $lockfile
+ # wait up to 10 seconds for the pidfile to exist. see
+ # https://github.com/docker/docker/issues/5359
+ tries=0
+ while [ ! -f $pidfile -a $tries -lt 10 ]; do
+ sleep 1
+ tries=$((tries + 1))
+ done
+ success
+ echo
+ else
+ failure
+ echo
+ printf "$pidfile still exists...\n"
+ exit 7
+ fi
+}
+
+stop() {
+ echo -n $"Stopping $prog: "
+ killproc $prog
+ retval=$?
+ echo
+ [ $retval -eq 0 ] && rm -f $lockfile
+ return $retval
+}
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ restart
+}
+
+force_reload() {
+ restart
+}
+
+rh_status() {
+ status $prog
+}
+
+rh_status_q() {
+ rh_status >/dev/null 2>&1
+}
+
+
+check_for_cleanup() {
+ if [ -f ${pidfile} ]; then
+ /bin/ps -fp $(cat ${pidfile}) > /dev/null || rm ${pidfile}
+ fi
+}
+
+case "$1" in
+ start)
+ rh_status_q && exit 0
+ $1
+ ;;
+ stop)
+ rh_status_q || exit 0
+ $1
+ ;;
+ restart)
+ $1
+ ;;
+ reload)
+ rh_status_q || exit 7
+ $1
+ ;;
+ force-reload)
+ force_reload
+ ;;
+ status)
+ rh_status
+ ;;
+ condrestart|try-restart)
+ rh_status_q || exit 0
+ restart
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
+ exit 2
+esac
+
+exit $?
diff --git a/recipes-containers/runc/files/0001-Makefile-respect-GOBUILDFLAGS-for-runc-and-remove-re.patch b/recipes-containers/runc/files/0001-Makefile-respect-GOBUILDFLAGS-for-runc-and-remove-re.patch
new file mode 100644
index 0000000..c855d7b
--- /dev/null
+++ b/recipes-containers/runc/files/0001-Makefile-respect-GOBUILDFLAGS-for-runc-and-remove-re.patch
@@ -0,0 +1,37 @@
+From 0fe50d2ca4517f5e3070585040f35ace413acd44 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@...>
+Date: Tue, 24 Aug 2021 11:38:23 -0400
+Subject: [PATCH] Makefile: respect GOBUILDFLAGS for runc and remove recvtty
+ from static
+
+Signed-off-by: Chen Qi <Qi.Chen@...>
+[bva: refreshed for release 1.0.2]
+Signed-off-by: Bruce Ashfield <bruce.ashfield@...>
+---
+ Makefile | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/src/import/Makefile b/src/import/Makefile
+index efbddf0d..4b174c80 100644
+--- a/src/import/Makefile
++++ b/src/import/Makefile
+@@ -24,7 +24,7 @@ ifeq ($(shell $(GO) env GOOS),linux)
+ endif
+ endif
+ endif
+-GO_BUILD := $(GO) build -trimpath $(MOD_VENDOR) $(GO_BUILDMODE) $(EXTRA_FLAGS) -tags "$(BUILDTAGS)" \
++GO_BUILD := $(GO) build $(GOBUILDFLAGS) -trimpath $(MOD_VENDOR) $(GO_BUILDMODE) $(EXTRA_FLAGS) -tags "$(BUILDTAGS)" \
+ -ldflags "-X main.gitCommit=$(COMMIT) -X main.version=$(VERSION) $(EXTRA_LDFLAGS)"
+ GO_BUILD_STATIC := CGO_ENABLED=1 $(GO) build -trimpath $(MOD_VENDOR) $(EXTRA_FLAGS) -tags "$(BUILDTAGS) netgo osusergo" \
+ -ldflags "-extldflags -static -X main.gitCommit=$(COMMIT) -X main.version=$(VERSION) $(EXTRA_LDFLAGS)"
+@@ -41,7 +41,6 @@ recvtty:
+
+ static:
+ $(GO_BUILD_STATIC) -o runc .
+- $(GO_BUILD_STATIC) -o contrib/cmd/recvtty/recvtty ./contrib/cmd/recvtty
+
+ release:
+ script/release.sh -r release/$(VERSION) -v $(VERSION)
+--
+2.19.1
+
diff --git a/recipes-containers/runc/runc-docker/0001-runc-Add-console-socket-dev-null.patch b/recipes-containers/runc/runc-docker/0001-runc-Add-console-socket-dev-null.patch
new file mode 100644
index 0000000..bcf4c10
--- /dev/null
+++ b/recipes-containers/runc/runc-docker/0001-runc-Add-console-socket-dev-null.patch
@@ -0,0 +1,30 @@
+From 3fff2a3505fba1d1ff0074edff15708a77f6cfa9 Mon Sep 17 00:00:00 2001
+From: Jason Wessel <jason.wessel@...>
+Date: Wed, 12 Jul 2017 13:35:03 -0700
+Subject: [PATCH] runc: Add --console-socket=/dev/null
+
+This allows for setting up a detached session where you do not want to
+set the terminal to false in the config.json. More or less this is a
+runtime override.
+
+Signed-off-by: Jason Wessel <jason.wessel@...>
+---
+ utils_linux.go | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+Index: git/src/import/utils_linux.go
+===================================================================
+--- git.orig/src/import/utils_linux.go
++++ git/src/import/utils_linux.go
+@@ -267,6 +267,11 @@
+ }
+
+ func (r *runner) run(config *specs.Process) (int, error) {
++ if (r.consoleSocket == "/dev/null") {
++ r.detach = false
++ r.consoleSocket = ""
++ config.Terminal = false
++ }
+ var err error
+ defer func() {
+ if err != nil {
diff --git a/recipes-containers/runc/runc-docker/0001-runc-docker-SIGUSR1-daemonize.patch b/recipes-containers/runc/runc-docker/0001-runc-docker-SIGUSR1-daemonize.patch
new file mode 100644
index 0000000..4350c40
--- /dev/null
+++ b/recipes-containers/runc/runc-docker/0001-runc-docker-SIGUSR1-daemonize.patch
@@ -0,0 +1,131 @@
+From cd7d76a6d1ecb1856f6ed666fb5c30dc105aa94e Mon Sep 17 00:00:00 2001
+From: Jason Wessel <jason.wessel@...>
+Date: Tue, 5 Dec 2017 18:28:28 -0800
+Subject: [PATCH] runc-docker: Allow "run start ..." to daemonize with $SIGUSR1_PARENT_PID
+
+The runc-docker has all the code in it to properly run a stop hook if
+you use it in the foreground. It doesn't work in the back ground
+because there is no way for a golang application to fork a child exit
+out of the parent process because all the golang threads stay with the
+parent.
+
+This patch has three parts that happen ONLY when $SIGUSR1_PARENT_PID
+is set.
+
+1) The code was copied which performs the normal the signal handling
+ block which is used for the foreground operation of runc.
+
+2) At the point where runc start would normally exit, it closes
+ stdin/stdout/stderr so it would be possible to daemonize "runc start ...".
+
+3) The code to send a SIGUSR1 to the parent process was added. The
+ idea being that a parent process would simply exit at that point
+ because it was blocking until runc performed everything it was
+ required to perform.
+
+Signed-off-by: Jason Wessel <jason.wessel@...>
+---
+ signals.go | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++----
+ utils_linux.go | 2 +-
+ 2 files changed, 51 insertions(+), 5 deletions(-)
+
+Index: git/src/import/signals.go
+===================================================================
+--- git.orig/src/import/signals.go
++++ git/src/import/signals.go
+@@ -5,7 +5,9 @@
+ import (
+ "os"
+ "os/signal"
++ "syscall" // only for Signal
+
++ "strconv"
+ "github.com/opencontainers/runc/libcontainer"
+ "github.com/opencontainers/runc/libcontainer/system"
+ "github.com/opencontainers/runc/libcontainer/utils"
+@@ -55,9 +57,6 @@
+ func (h *signalHandler) forward(process *libcontainer.Process, tty *tty, detach bool) (int, error) {
+ // make sure we know the pid of our main process so that we can return
+ // after it dies.
+- if detach && h.notifySocket == nil {
+- return 0, nil
+- }
+
+ pid1, err := process.Pid()
+ if err != nil {
+@@ -67,12 +66,61 @@
+ if h.notifySocket != nil {
+ if detach {
+ _ = h.notifySocket.run(pid1)
+- return 0, nil
+ }
+ _ = h.notifySocket.run(os.Getpid())
+ go func() { _ = h.notifySocket.run(0) }()
+ }
+
++ if (detach) {
++ // This allows the parent process to daemonize this process
++ // so long as stdin/stderr/stdout are closed
++ if envVal := os.Getenv("SIGUSR1_PARENT_PID"); envVal != "" {
++ // Close stdin/stdout/stderr
++ os.Stdin.Close()
++ os.Stdout.Close()
++ os.Stderr.Close()
++ // Notify parent to detach
++ i, err := strconv.Atoi(envVal)
++ if (err != nil) {
++ return 0, nil
++ }
++ unix.Kill(i, unix.SIGUSR1)
++ // Loop waiting on the child to signal or exit,
++ // after which all stop hooks will be run
++ for s := range h.signals {
++ switch s {
++ case unix.SIGCHLD:
++ exits, err := h.reap()
++ if err != nil {
++ logrus.Error(err)
++ }
++ for _, e := range exits {
++ logrus.WithFields(logrus.Fields{
++ "pid": e.pid,
++ "status": e.status,
++ }).Debug("process exited")
++ if e.pid == pid1 {
++ // call Wait() on the process even though we already have the exit
++ // status because we must ensure that any of the go specific process
++ // fun such as flushing pipes are complete before we return.
++ process.Wait()
++ if h.notifySocket != nil {
++ h.notifySocket.Close()
++ }
++ return e.status, nil
++ }
++ }
++ default:
++ logrus.Debugf("sending signal to process %s", s)
++ if err := unix.Kill(pid1, s.(syscall.Signal)); err != nil {
++ logrus.Error(err)
++ }
++ }
++ }
++ }
++ return 0, nil
++ }
++
+ // Perform the initial tty resize. Always ignore errors resizing because
+ // stdout might have disappeared (due to races with when SIGHUP is sent).
+ _ = tty.resize()
+Index: git/src/import/utils_linux.go
+===================================================================
+--- git.orig/src/import/utils_linux.go
++++ git/src/import/utils_linux.go
+@@ -345,7 +345,7 @@
+ if err != nil {
+ r.terminate(process)
+ }
+- if detach {
++ if (detach && os.Getenv("SIGUSR1_PARENT_PID") == "") {
+ return 0, nil
+ }
+ if err == nil {
diff --git a/recipes-containers/runc/runc-docker_git.bb b/recipes-containers/runc/runc-docker_git.bb
new file mode 100644
index 0000000..4a46fd2
--- /dev/null
+++ b/recipes-containers/runc/runc-docker_git.bb
@@ -0,0 +1,14 @@
+include runc.inc
+
+# Note: this rev is before the required protocol field, update when all components
+# have been updated to match.
+SRCREV_runc-docker = "04bcb7c71550a0212bfb876db7bac723ae13296a"
+SRC_URI = "git://github.com/opencontainers/runc;branch=release-1.0;name=runc-docker;protocol=https \
+ file://0001-runc-Add-console-socket-dev-null.patch \
+ file://0001-Makefile-respect-GOBUILDFLAGS-for-runc-and-remove-re.patch \
+ file://0001-runc-docker-SIGUSR1-daemonize.patch \
+ "
+
+RUNC_VERSION = "1.0.2"
+
+CVE_PRODUCT = "runc"
diff --git a/recipes-containers/runc/runc-opencontainers_git.bb b/recipes-containers/runc/runc-opencontainers_git.bb
new file mode 100644
index 0000000..16ef509
--- /dev/null
+++ b/recipes-containers/runc/runc-opencontainers_git.bb
@@ -0,0 +1,10 @@
+include runc.inc
+
+SRCREV = "86d83333d765f4535e4898d6778388dab715eb7c"
+SRC_URI = " \
+ git://github.com/opencontainers/runc;branch=release-1.0;protocol=https \
+ file://0001-Makefile-respect-GOBUILDFLAGS-for-runc-and-remove-re.patch \
+ "
+RUNC_VERSION = "1.0.2"
+
+CVE_PRODUCT = "runc"
diff --git a/recipes-containers/runc/runc.inc b/recipes-containers/runc/runc.inc
new file mode 100644
index 0000000..c8e7427
--- /dev/null
+++ b/recipes-containers/runc/runc.inc
@@ -0,0 +1,83 @@
+HOMEPAGE = "https://github.com/opencontainers/runc"
+SUMMARY = "runc container cli tools"
+DESCRIPTION = "runc is a CLI tool for spawning and running containers according to the OCI specification."
+
+# Apache-2.0 for containerd
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=435b266b3899aa8a959f17d41c56def8"
+
+S = "${WORKDIR}/git"
+
+PV = "${RUNC_VERSION}+git${SRCPV}"
+
+inherit go
+inherit goarch
+inherit pkgconfig
+
+PACKAGECONFIG[seccomp] = "seccomp,,libseccomp"
+PACKAGECONFIG[selinux] = "selinux,,libselinux"
+# This PACKAGECONFIG serves the purpose of whether building runc as static or not
+PACKAGECONFIG[static] = ""
+
+PACKAGECONFIG ??= "static \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'seccomp', 'seccomp', '', d)} \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)} \
+ "
+
+
+PROVIDES += "virtual/runc"
+RPROVIDES:${PN} = "virtual-runc"
+
+GO_IMPORT = "import"
+
+LIBCONTAINER_PACKAGE="github.com/opencontainers/runc/libcontainer"
+
+do_configure[noexec] = "1"
+
+
+DISTRO_BUILDTAGS ?= "${@bb.utils.contains('DISTRO_FEATURES', 'seccomp', 'seccomp', '', d)} \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)}"
+
+EXTRA_OEMAKE="BUILDTAGS='${PACKAGECONFIG_CONFARGS} ${DISTRO_BUILDTAGS}' GO=${GO}"
+
+do_compile() {
+ # Set GOPATH. See 'PACKAGERS.md'. Don't rely on
+ # docker to download its dependencies but rather
+ # use dependencies packaged independently.
+ cd ${S}/src/import
+ rm -rf .gopath
+ dname=`dirname "${LIBCONTAINER_PACKAGE}"`
+ bname=`basename "${LIBCONTAINER_PACKAGE}"`
+ mkdir -p .gopath/src/${dname}
+
+ (cd .gopath/src/${dname}; ln -sf ../../../../../${bname} ${bname})
+ export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
+
+ # Fix up symlink for go-cross compiler
+ rm -f ${S}/src/import/vendor/src
+ ln -sf ./ ${S}/src/import/vendor/src
+
+ # Pass the needed cflags/ldflags so that cgo
+ # can find the needed headers files and libraries
+ export CGO_ENABLED="1"
+ export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
+ export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
+ export GO=${GO}
+
+ export CFLAGS=""
+ export LDFLAGS=""
+
+ if ${@bb.utils.contains('PACKAGECONFIG', 'static', 'true', 'false', d)}; then
+ oe_runmake static
+ else
+ oe_runmake runc
+ fi
+}
+
+do_install() {
+ mkdir -p ${D}/${bindir}
+
+ cp ${S}/src/import/runc ${D}/${bindir}/runc
+ ln -sf runc ${D}/${bindir}/docker-runc
+}
+
diff --git a/recipes-containers/tini/tini/0001-Do-not-strip-the-output-binary-allow-yocto-to-do-thi.patch b/recipes-containers/tini/tini/0001-Do-not-strip-the-output-binary-allow-yocto-to-do-thi.patch
new file mode 100644
index 0000000..6797720
--- /dev/null
+++ b/recipes-containers/tini/tini/0001-Do-not-strip-the-output-binary-allow-yocto-to-do-thi.patch
@@ -0,0 +1,28 @@
+From b99ef9954a34cffd85a5cc09922b201ae11b494d Mon Sep 17 00:00:00 2001
+From: Theodor Gherzan <theodor@...>
+Date: Mon, 5 Jun 2017 18:16:56 +0200
+Subject: [PATCH] Do not strip the output binary, allow yocto to do this
+
+Upstream-Status: Inappropriate [configuration specific]
+
+Signed-off-by: Theodor Gherzan <theodor@...>
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b5b93ba..c2907e2 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -54,7 +54,7 @@ if(NOT HAS_BUILTIN_FORTIFY)
+ endif()
+
+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Werror -Wextra -Wall -pedantic-errors -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat")
+-set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-s")
++set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Bsymbolic-functions -Wl,-z,relro")
+
+ # Build
+
+--
+2.7.4
+
diff --git a/recipes-containers/tini/tini_0.19.0.bb b/recipes-containers/tini/tini_0.19.0.bb
new file mode 100644
index 0000000..914cffb
--- /dev/null
+++ b/recipes-containers/tini/tini_0.19.0.bb
@@ -0,0 +1,32 @@
+HOMEPAGE = "http://github.com/krallin/tini"
+SUMMARY = "Minimal init for containers"
+DESCRIPTION = "Tini is the simplest init you could think of. All Tini does is \
+spawn a single child (Tini is meant to be run in a container), and wait for \
+it to exit all the while reaping zombies and performing signal forwarding. "
+
+SRCREV = "b9f42a0e7bb46efea0c9e3d8610c96ab53b467f8"
+SRC_URI = " \
+ git://github.com/krallin/tini.git;branch=master;protocol=https \
+ file://0001-Do-not-strip-the-output-binary-allow-yocto-to-do-thi.patch \
+ "
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=ffc9091894702bc5dcf4cc0085561ef5"
+
+S = "${WORKDIR}/git"
+
+BBCLASSEXTEND = "native"
+
+# tini links with -static, so no PIE for us
+SECURITY_CFLAGS:pn-${PN} = "${SECURITY_NO_PIE_CFLAGS}"
+
+inherit cmake
+
+do_install() {
+ mkdir -p ${D}/${bindir}
+ install -m 0755 ${B}/tini-static ${D}/${bindir}/docker-init
+}
+
+# Tini is the currently the provider for docker-init
+PROVIDES += "docker-init"
+RPROVIDES:${PN} = "docker-init"
diff --git a/recipes-devtools/go/compose-file_git.bb b/recipes-devtools/go/compose-file_git.bb
new file mode 100644
index 0000000..c33a7ac
--- /dev/null
+++ b/recipes-devtools/go/compose-file_git.bb
@@ -0,0 +1,41 @@
+DESCRIPTION = "Parser for the Compose file format (version 3)"
+HOMEPAGE = "https://github.com/aanand/compose-file"
+SECTION = "devel/go"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://src/${PKG_NAME}/LICENSE;md5=9cd86830b557232ce55e2a6b47387471"
+
+SRCNAME = "compose-file"
+
+PKG_NAME = "github.com/aanand/${SRCNAME}"
+SRC_URI = "git://${PKG_NAME}.git;destsuffix=git/src/${PKG_NAME};branch=master;protocol=https"
+
+SRCREV = "a3e58764f50597b6217fec07e9bff7225c4a1719"
+PV = "3.0+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+# NO-OP the do compile rule because this recipe is source only.
+do_compile() {
+}
+
+do_install() {
+ install -d ${D}${prefix}/local/go/src/${PKG_NAME}
+ for j in $(cd ${S} && find src/${PKG_NAME} -name "*.go"); do
+ if [ ! -d ${D}${prefix}/local/go/$(dirname $j) ]; then
+ mkdir -p ${D}${prefix}/local/go/$(dirname $j)
+ fi
+ cp $j ${D}${prefix}/local/go/$j
+ done
+ cp -r ${S}/src/${PKG_NAME}/LICENSE ${D}${prefix}/local/go/src/${PKG_NAME}/
+}
+
+SYSROOT_PREPROCESS_FUNCS += "go_compose_file_sysroot_preprocess"
+
+go_compose_file_sysroot_preprocess () {
+ install -d ${SYSROOT_DESTDIR}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${D}${prefix}/local/go/src/${PKG_NAME} ${SYSROOT_DESTDIR}${prefix}/local/go/src/$(dirname ${PKG_NAME})
+}
+
+FILES:${PN} += "${prefix}/local/go/src/${PKG_NAME}/*"
+
+CLEANBROKEN = "1"
diff --git a/recipes-devtools/go/go-build/0001-build-use-instead-of-go.patch b/recipes-devtools/go/go-build/0001-build-use-instead-of-go.patch
new file mode 100644
index 0000000..873d7ab
--- /dev/null
+++ b/recipes-devtools/go/go-build/0001-build-use-instead-of-go.patch
@@ -0,0 +1,30 @@
+From 4db28c98481056c41097f808335c37e8517fe485 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@...>
+Date: Fri, 7 Aug 2020 23:39:18 -0400
+Subject: [PATCH] build: use instead of 'go'
+
+While we can get away with 'go' if the host/target arch match, the
+new go-binary toolchain blows up in a cross compile situation.
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@...>
+---
+ gobuild/Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+Index: git/src/import/gobuild/Makefile
+===================================================================
+--- git.orig/src/import/gobuild/Makefile
++++ git/src/import/gobuild/Makefile
+@@ -19,10 +19,10 @@
+
+ ${GODEPPATHS}:
+ mkdir -p ${GOSRC}
+- GOPATH=${GOPATH} go get -d $(subst ${GOSRC}/,,$@)
++ GOPATH=${GOPATH} ${GO} get -d $(subst ${GOSRC}/,,$@)
+
+ ${BIN}: ${GODEPPATHS} $(filter %/$@.go, ${MAIN})
+- GOPATH=${GOPATH} ${ARCH} go build $(filter %/$@.go, ${MAIN})
++ GOPATH=${GOPATH} ${ARCH} ${GO} build $(filter %/$@.go, ${MAIN})
+
+ clean:
+ rm -f ${BIN}
diff --git a/recipes-devtools/go/go-build_git.bb b/recipes-devtools/go/go-build_git.bb
new file mode 100644
index 0000000..831b3c0
--- /dev/null
+++ b/recipes-devtools/go/go-build_git.bb
@@ -0,0 +1,58 @@
+HOMEPAGE = "https://github.com/lf-edge/runx"
+SUMMARY = "console for runx"
+DESCRIPTION = "Xen Runtime for OCI"
+
+SRCREV_runx = "f24efd33fb18469e9cfe4d1bfe8e2c90ec8c4e93"
+
+SRC_URI = "\
+ git://github.com/lf-edge/runx;nobranch=1;name=runx;protocol=https \
+ file://0001-build-use-instead-of-go.patch \
+ "
+SRC_URI[md5sum] = "0d701ac1e2a67d47ce7127432df2c32b"
+SRC_URI[sha256sum] = "5a26478906d5005f4f809402e981518d2b8844949199f60c4b6e1f986ca2a769"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=945fc9aa694796a6337395cc291ddd8c"
+
+S = "${WORKDIR}/git"
+PV = "0.1-git${SRCREV_runx}"
+
+inherit features_check
+REQUIRED_DISTRO_FEATURES = "vmsep"
+GO_PARALLEL_BUILD ?= "${@oe.utils.parallel_make_argument(d, '-p %d')}"
+
+inherit pkgconfig
+
+GO_IMPORT = "import"
+inherit go
+
+RDEPENDS:${PN}-dev = "bash"
+
+do_compile() {
+
+ export GOARCH="${TARGET_GOARCH}"
+ cd ${S}/src/import/gobuild
+
+ # Build the target binaries
+ export GOARCH="${TARGET_GOARCH}"
+ # Pass the needed cflags/ldflags so that cgo can find the needed headers files and libraries
+ export CGO_ENABLED="1"
+ export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
+ export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
+ export CFLAGS=""
+ export LDFLAGS=""
+ export CC="${CC}"
+ export LD="${LD}"
+ export GOBIN=""
+ export GO111MODULE=off
+
+ oe_runmake GO=${GO}
+}
+
+do_install() {
+
+ install -d ${D}${datadir}/runX
+ install -m 755 ${B}/src/import/gobuild/serial_fd_handler ${D}${datadir}/runX/
+}
+
+FILES:${PN} += "${datadir}/runX/*"
diff --git a/recipes-devtools/go/go-capability_git.bb b/recipes-devtools/go/go-capability_git.bb
new file mode 100644
index 0000000..7e5ab11
--- /dev/null
+++ b/recipes-devtools/go/go-capability_git.bb
@@ -0,0 +1,29 @@
+DESCRIPTION = "Utilities for manipulating POSIX capabilities in Go."
+HOMEPAGE = "https://github.com/syndtr/gocapability"
+SECTION = "devel/go"
+LICENSE = "BSD-2-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=a7304f5073e7be4ba7bffabbf9f2bbca"
+
+SRCNAME = "gocapability"
+
+PKG_NAME = "github.com/syndtr/${SRCNAME}"
+SRC_URI = "git://${PKG_NAME}.git;branch=master;protocol=https"
+
+SRCREV = "2c00daeb6c3b45114c80ac44119e7b8801fdd852"
+PV = "0.0+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+do_install() {
+ install -d ${D}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${S}/* ${D}${prefix}/local/go/src/${PKG_NAME}/
+}
+
+SYSROOT_PREPROCESS_FUNCS += "go_capability_sysroot_preprocess"
+
+go_capability_sysroot_preprocess () {
+ install -d ${SYSROOT_DESTDIR}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${D}${prefix}/local/go/src/${PKG_NAME} ${SYSROOT_DESTDIR}${prefix}/local/go/src/$(dirname ${PKG_NAME})
+}
+
+FILES:${PN} += "${prefix}/local/go/src/${PKG_NAME}/*"
diff --git a/recipes-devtools/go/go-cli_git.bb b/recipes-devtools/go/go-cli_git.bb
new file mode 100644
index 0000000..ae67f8e
--- /dev/null
+++ b/recipes-devtools/go/go-cli_git.bb
@@ -0,0 +1,29 @@
+DESCRIPTION = "A small package for building command line apps in Go"
+HOMEPAGE = "https://github.com/codegangsta/cli"
+SECTION = "devel/go"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=ed9b539ed65d73926f30ff1f1587dc44"
+
+SRCNAME = "cli"
+
+PKG_NAME = "github.com/codegangsta/${SRCNAME}"
+SRC_URI = "git://${PKG_NAME}.git;branch=master;protocol=https"
+
+SRCREV = "27ecc97192df1bf053a22b04463f2b51b8b8373e"
+PV = "1.1.0+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+do_install() {
+ install -d ${D}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${S}/* ${D}${prefix}/local/go/src/${PKG_NAME}/
+}
+
+SYSROOT_PREPROCESS_FUNCS += "go_cli_sysroot_preprocess"
+
+go_cli_sysroot_preprocess () {
+ install -d ${SYSROOT_DESTDIR}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${D}${prefix}/local/go/src/${PKG_NAME} ${SYSROOT_DESTDIR}${prefix}/local/go/src/$(dirname ${PKG_NAME})
+}
+
+FILES:${PN} += "${prefix}/local/go/src/${PKG_NAME}/*"
diff --git a/recipes-devtools/go/go-connections_git.bb b/recipes-devtools/go/go-connections_git.bb
new file mode 100644
index 0000000..ebfdb9f
--- /dev/null
+++ b/recipes-devtools/go/go-connections_git.bb
@@ -0,0 +1,39 @@
+DESCRIPTION = "Utility package to work with network connections"
+HOMEPAGE = "https://github.com/docker/connections"
+SECTION = "devel/go"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://src/${PKG_NAME}/LICENSE;md5=04424bc6f5a5be60691b9824d65c2ad8"
+
+SRCNAME = "go-connections"
+
+PKG_NAME = "github.com/docker/${SRCNAME}"
+SRC_URI = "git://${PKG_NAME}.git;destsuffix=git/src/${PKG_NAME};branch=master;protocol=https"
+
+SRCREV = "4ccf312bf1d35e5dbda654e57a9be4c3f3cd0366"
+PV = "0.2.1+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+# NO-OP the do compile rule because this recipe is source only.
+do_compile() {
+}
+
+do_install() {
+ install -d ${D}${prefix}/local/go/src/${PKG_NAME}
+ for j in $(cd ${S} && find src/${PKG_NAME} -name "*.go"); do
+ if [ ! -d ${D}${prefix}/local/go/$(dirname $j) ]; then
+ mkdir -p ${D}${prefix}/local/go/$(dirname $j)
+ fi
+ cp $j ${D}${prefix}/local/go/$j
+ done
+ cp -r ${S}/src/${PKG_NAME}/LICENSE ${D}${prefix}/local/go/src/${PKG_NAME}/
+}
+
+SYSROOT_PREPROCESS_FUNCS += "go_connections_sysroot_preprocess"
+
+go_connections_sysroot_preprocess () {
+ install -d ${SYSROOT_DESTDIR}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${D}${prefix}/local/go/src/${PKG_NAME} ${SYSROOT_DESTDIR}${prefix}/local/go/src/$(dirname ${PKG_NAME})
+}
+
+FILES:${PN} += "${prefix}/local/go/src/${PKG_NAME}/*"
diff --git a/recipes-devtools/go/go-context_git.bb b/recipes-devtools/go/go-context_git.bb
new file mode 100644
index 0000000..37f39b3
--- /dev/null
+++ b/recipes-devtools/go/go-context_git.bb
@@ -0,0 +1,28 @@
+DESCRIPTION = "A golang registry for global request variables."
+HOMEPAGE = "https://github.com/gorilla/context"
+SECTION = "devel/go"
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=c50f6bd9c1e15ed0bad3bea18e3c1b7f"
+
+SRCNAME = "context"
+
+PKG_NAME = "github.com/gorilla/${SRCNAME}"
+SRC_URI = "git://${PKG_NAME}.git;branch=master;protocol=https"
+
+SRCREV = "14f550f51af52180c2eefed15e5fd18d63c0a64a"
+
+S = "${WORKDIR}/git"
+
+do_install() {
+ install -d ${D}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${S}/* ${D}${prefix}/local/go/src/${PKG_NAME}/
+}
+
+SYSROOT_PREPROCESS_FUNCS += "go_context_sysroot_preprocess"
+
+go_context_sysroot_preprocess () {
+ install -d ${SYSROOT_DESTDIR}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${D}${prefix}/local/go/src/${PKG_NAME} ${SYSROOT_DESTDIR}${prefix}/local/go/src/$(dirname ${PKG_NAME})
+}
+
+FILES:${PN} += "${prefix}/local/go/src/${PKG_NAME}/*"
diff --git a/recipes-devtools/go/go-dbus_git.bb b/recipes-devtools/go/go-dbus_git.bb
new file mode 100644
index 0000000..4bf44d6
--- /dev/null
+++ b/recipes-devtools/go/go-dbus_git.bb
@@ -0,0 +1,29 @@
+DESCRIPTION = "Native Go bindings for D-Bus"
+HOMEPAGE = "https://github.com/godbus/dbus"
+SECTION = "devel/go"
+LICENSE = "BSD-2-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=09042bd5c6c96a2b9e45ddf1bc517eed"
+
+SRCNAME = "dbus"
+
+PKG_NAME = "github.com/godbus/${SRCNAME}"
+SRC_URI = "git://${PKG_NAME}.git;branch=master;protocol=https"
+
+SRCREV = "5f6efc7ef2759c81b7ba876593971bfce311eab3"
+PV = "4.0.0+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+do_install() {
+ install -d ${D}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${S}/* ${D}${prefix}/local/go/src/${PKG_NAME}/
+}
+
+SYSROOT_PREPROCESS_FUNCS += "go_dbus_sysroot_preprocess"
+
+go_dbus_sysroot_preprocess () {
+ install -d ${SYSROOT_DESTDIR}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${D}${prefix}/local/go/src/${PKG_NAME} ${SYSROOT_DESTDIR}${prefix}/local/go/src/$(dirname ${PKG_NAME})
+}
+
+FILES:${PN} += "${prefix}/local/go/src/${PKG_NAME}/*"
diff --git a/recipes-devtools/go/go-distribution_git.bb b/recipes-devtools/go/go-distribution_git.bb
new file mode 100644
index 0000000..948831b
--- /dev/null
+++ b/recipes-devtools/go/go-distribution_git.bb
@@ -0,0 +1,39 @@
+DESCRIPTION = "The Docker toolset to pack, ship, store, and deliver content"
+HOMEPAGE = "https://github.com/docker/distribution"
+SECTION = "devel/go"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://src/${PKG_NAME}/LICENSE;md5=d2794c0df5b907fdace235a619d80314"
+
+SRCNAME = "distribution"
+
+PKG_NAME = "github.com/docker/${SRCNAME}"
+SRC_URI = "git://${PKG_NAME}.git;branch=docker/1.13;destsuffix=git/src/${PKG_NAME};protocol=https"
+
+SRCREV = "28602af35aceda2f8d571bad7ca37a54cf0250bc"
+PV = "2.6.0+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+# NO-OP the do compile rule because this recipe is source only.
+do_compile() {
+}
+
+do_install() {
+ install -d ${D}${prefix}/local/go/src/${PKG_NAME}
+ for j in $(cd ${S} && find src/${PKG_NAME} -name "*.go"); do
+ if [ ! -d ${D}${prefix}/local/go/$(dirname $j) ]; then
+ mkdir -p ${D}${prefix}/local/go/$(dirname $j)
+ fi
+ cp $j ${D}${prefix}/local/go/$j
+ done
+ cp -r ${S}/src/${PKG_NAME}/LICENSE ${D}${prefix}/local/go/src/${PKG_NAME}/
+}
+
+SYSROOT_PREPROCESS_FUNCS += "go_distribution_digeset_sysroot_preprocess"
+
+go_distribution_digeset_sysroot_preprocess () {
+ install -d ${SYSROOT_DESTDIR}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${D}${prefix}/local/go/src/${PKG_NAME} ${SYSROOT_DESTDIR}${prefix}/local/go/src/$(dirname ${PKG_NAME})
+}
+
+FILES:${PN} += "${prefix}/local/go/src/${PKG_NAME}/*"
diff --git a/recipes-devtools/go/go-fsnotify_git.bb b/recipes-devtools/go/go-fsnotify_git.bb
new file mode 100644
index 0000000..8aa1c76
--- /dev/null
+++ b/recipes-devtools/go/go-fsnotify_git.bb
@@ -0,0 +1,29 @@
+DESCRIPTION = "A golang registry for global request variables."
+HOMEPAGE = "https://github.com/go-fsnotify/fsnotify"
+SECTION = "devel/go"
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=c38914c9a7ab03bb2b96d4baaee10769"
+
+SRCNAME = "fsnotify"
+
+PKG_NAME = "github.com/fsnotify/${SRCNAME}"
+SRC_URI = "git://${PKG_NAME}.git;branch=master;protocol=https"
+
+SRCREV = "836bfd95fecc0f1511dd66bdbf2b5b61ab8b00b6"
+PV = "1.2.11+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+do_install() {
+ install -d ${D}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${S}/* ${D}${prefix}/local/go/src/${PKG_NAME}/
+}
+
+SYSROOT_PREPROCESS_FUNCS += "go_fsnotify_sysroot_preprocess"
+
+go_fsnotify_sysroot_preprocess () {
+ install -d ${SYSROOT_DESTDIR}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${D}${prefix}/local/go/src/${PKG_NAME} ${SYSROOT_DESTDIR}${prefix}/local/go/src/$(dirname ${PKG_NAME})
+}
+
+FILES:${PN} += "${prefix}/local/go/src/${PKG_NAME}/*"
diff --git a/recipes-devtools/go/go-libtrust_git.bb b/recipes-devtools/go/go-libtrust_git.bb
new file mode 100644
index 0000000..e2a28ec
--- /dev/null
+++ b/recipes-devtools/go/go-libtrust_git.bb
@@ -0,0 +1,29 @@
+DESCRIPTION = "Primitives for identity and authorization"
+HOMEPAGE = "https://github.com/docker/libtrust"
+SECTION = "devel/go"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=435b266b3899aa8a959f17d41c56def8"
+
+SRCNAME = "libtrust"
+
+PKG_NAME = "github.com/docker/${SRCNAME}"
+SRC_URI = "git://${PKG_NAME}.git;branch=master;protocol=https"
+
+SRCREV = "9cbd2a1374f46905c68a4eb3694a130610adc62a"
+PV = "0.0+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+do_install() {
+ install -d ${D}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${S}/* ${D}${prefix}/local/go/src/${PKG_NAME}/
+}
+
+SYSROOT_PREPROCESS_FUNCS += "go_libtrust_sysroot_preprocess"
+
+go_libtrust_sysroot_preprocess () {
+ install -d ${SYSROOT_DESTDIR}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${D}${prefix}/local/go/src/${PKG_NAME} ${SYSROOT_DESTDIR}${prefix}/local/go/src/$(dirname ${PKG_NAME})
+}
+
+FILES:${PN} += "${prefix}/local/go/src/${PKG_NAME}/*"
diff --git a/recipes-devtools/go/go-logrus_git.bb b/recipes-devtools/go/go-logrus_git.bb
new file mode 100644
index 0000000..2c59d34
--- /dev/null
+++ b/recipes-devtools/go/go-logrus_git.bb
@@ -0,0 +1,29 @@
+DESCRIPTION = "A golang registry for global request variables."
+HOMEPAGE = "https://github.com/Sirupsen/logrus"
+SECTION = "devel/go"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=8dadfef729c08ec4e631c4f6fc5d43a0"
+
+SRCNAME = "logrus"
+
+PKG_NAME = "github.com/Sirupsen/${SRCNAME}"
+SRC_URI = "git://${PKG_NAME}.git;branch=master;protocol=https"
+
+SRCREV = "d26492970760ca5d33129d2d799e34be5c4782eb"
+PV = "0.11.0+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+do_install() {
+ install -d ${D}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${S}/* ${D}${prefix}/local/go/src/${PKG_NAME}/
+}
+
+SYSROOT_PREPROCESS_FUNCS += "go_logrus_sysroot_preprocess"
+
+go_logrus_sysroot_preprocess () {
+ install -d ${SYSROOT_DESTDIR}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${D}${prefix}/local/go/src/${PKG_NAME} ${SYSROOT_DESTDIR}${prefix}/local/go/src/$(dirname ${PKG_NAME})
+}
+
+FILES:${PN} += "${prefix}/local/go/src/${PKG_NAME}/*"
diff --git a/recipes-devtools/go/go-md2man_git.bb b/recipes-devtools/go/go-md2man_git.bb
new file mode 100644
index 0000000..aa05899
--- /dev/null
+++ b/recipes-devtools/go/go-md2man_git.bb
@@ -0,0 +1,23 @@
+DESCRIPTION = "A markdown to manpage generator."
+HOMEPAGE = "https://github.com/cpuguy83/go-md2man"
+SECTION = "devel/go"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE.md;md5=80794f9009df723bbc6fe19234c9f517"
+
+BBCLASSEXTEND = "native"
+
+GO_IMPORT = "github.com/cpuguy83/go-md2man"
+#GO_INSTALL = "${GO_IMPORT}/bin/go-md2man"
+
+SRC_URI = "git://${GO_IMPORT}.git;branch=master;protocol=https"
+
+SRCREV = "f79a8a8ca69da163eee19ab442bedad7a35bba5a"
+PV = "1.0.10+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+inherit go
+
+do_compile:prepend() {
+ export GO111MODULE=off
+}
diff --git a/recipes-devtools/go/go-metalinter_git.bb b/recipes-devtools/go/go-metalinter_git.bb
new file mode 100644
index 0000000..3dda45c
--- /dev/null
+++ b/recipes-devtools/go/go-metalinter_git.bb
@@ -0,0 +1,24 @@
+DESCRIPTION = "Go Meta Linter."
+HOMEPAGE = "https://github.com/alecthomas/gometalinter"
+SECTION = "devel/go"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://COPYING;md5=dee20b35647295553d32faef05846a7b"
+
+BBCLASSEXTEND = "native"
+
+SRCNAME = "gometalinter"
+
+PKG_NAME = "github.com/alecthomas/${SRCNAME}"
+SRC_URI = "git://${PKG_NAME}.git;branch=master;protocol=https"
+
+SRCREV = "e8d801238da6f0dfd14078d68f9b53fa50a7eeb5"
+PV = "0.0+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+do_install() {
+ install -d ${D}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${S}/* ${D}${prefix}/local/go/src/${PKG_NAME}/
+}
+
+FILES:${PN} += "${prefix}/local/go/src/${PKG_NAME}/*"
diff --git a/recipes-devtools/go/go-mux_git.bb b/recipes-devtools/go/go-mux_git.bb
new file mode 100644
index 0000000..3f939f4
--- /dev/null
+++ b/recipes-devtools/go/go-mux_git.bb
@@ -0,0 +1,28 @@
+DESCRIPTION = "A powerful URL router and dispatcher for golang."
+HOMEPAGE = "https://github.com/gorilla/mux"
+SECTION = "devel/go"
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=c50f6bd9c1e15ed0bad3bea18e3c1b7f"
+
+SRCNAME = "mux"
+
+PKG_NAME = "github.com/gorilla/${SRCNAME}"
+SRC_URI = "git://${PKG_NAME}.git;branch=master;protocol=https"
+
+SRCREV = "136d54f81f00414c45c3c68dd47e98cc97519c5e"
+
+S = "${WORKDIR}/git"
+
+do_install() {
+ install -d ${D}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${S}/* ${D}${prefix}/local/go/src/${PKG_NAME}/
+}
+
+SYSROOT_PREPROCESS_FUNCS += "go_mux_sysroot_preprocess"
+
+go_mux_sysroot_preprocess () {
+ install -d ${SYSROOT_DESTDIR}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${D}${prefix}/local/go/src/${PKG_NAME} ${SYSROOT_DESTDIR}${prefix}/local/go/src/$(dirname ${PKG_NAME})
+}
+
+FILES:${PN} += "${prefix}/local/go/src/${PKG_NAME}/*"
diff --git a/recipes-devtools/go/go-patricia_git.bb b/recipes-devtools/go/go-patricia_git.bb
new file mode 100644
index 0000000..4c29b57
--- /dev/null
+++ b/recipes-devtools/go/go-patricia_git.bb
@@ -0,0 +1,29 @@
+DESCRIPTION = "A generic patricia trie (also called radix tree) implemented in Go (Golang)"
+HOMEPAGE = "https://github.com/gorilla/context"
+SECTION = "devel/go"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=9949b99212edd6b1e24ce702376c3baf"
+
+SRCNAME = "go-patricia"
+
+PKG_NAME = "github.com/tchap/${SRCNAME}"
+SRC_URI = "git://${PKG_NAME}.git;branch=master;protocol=https"
+
+SRCREV = "666120de432aea38ab06bd5c818f04f4129882c9"
+PV = "2.2.6+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+do_install() {
+ install -d ${D}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${S}/* ${D}${prefix}/local/go/src/${PKG_NAME}/
+}
+
+SYSROOT_PREPROCESS_FUNCS += "go_patricia_sysroot_preprocess"
+
+go_patricia_sysroot_preprocess () {
+ install -d ${SYSROOT_DESTDIR}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${D}${prefix}/local/go/src/${PKG_NAME} ${SYSROOT_DESTDIR}${prefix}/local/go/src/$(dirname ${PKG_NAME})
+}
+
+FILES:${PN} += "${prefix}/local/go/src/${PKG_NAME}/*"
diff --git a/recipes-devtools/go/go-pty_git.bb b/recipes-devtools/go/go-pty_git.bb
new file mode 100644
index 0000000..132e82d
--- /dev/null
+++ b/recipes-devtools/go/go-pty_git.bb
@@ -0,0 +1,28 @@
+DESCRIPTION = "PTY interface for Go"
+HOMEPAGE = "https://github.com/creack/pty"
+SECTION = "devel/go"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://License;md5=93958070863d769117fa33b129020050"
+
+SRCNAME = "pty"
+
+PKG_NAME = "github.com/creack/${SRCNAME}"
+SRC_URI = "git://${PKG_NAME}.git;branch=master;protocol=https"
+
+SRCREV = "05017fcccf23c823bfdea560dcc958a136e54fb7"
+
+S = "${WORKDIR}/git"
+
+do_install() {
+ install -d ${D}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${S}/* ${D}${prefix}/local/go/src/${PKG_NAME}/
+}
+
+SYSROOT_PREPROCESS_FUNCS += "go_pty_sysroot_preprocess"
+
+go_pty_sysroot_preprocess () {
+ install -d ${SYSROOT_DESTDIR}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${D}${prefix}/local/go/src/${PKG_NAME} ${SYSROOT_DESTDIR}${prefix}/local/go/src/$(dirname ${PKG_NAME})
+}
+
+FILES:${PN} += "${prefix}/local/go/src/${PKG_NAME}/*"
diff --git a/recipes-devtools/go/go-systemd_git.bb b/recipes-devtools/go/go-systemd_git.bb
new file mode 100644
index 0000000..91f67da
--- /dev/null
+++ b/recipes-devtools/go/go-systemd_git.bb
@@ -0,0 +1,31 @@
+DESCRIPTION = "Go bindings to systemd socket activation, journal, D-Bus, and unit files"
+HOMEPAGE = "https://github.com/coreos/go-systemd"
+SECTION = "devel/go"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=19cbd64715b51267a47bf3750cc6a8a5"
+
+SRCNAME = "systemd"
+
+PKG_NAME = "github.com/coreos/go-${SRCNAME}"
+SRC_URI = "git://${PKG_NAME}.git;branch=main;protocol=https"
+
+SRCREV = "b4a58d95188dd092ae20072bac14cece0e67c388"
+PV = "4+git${SRCPV}"
+
+RDEPENDS:${PN} += "bash"
+
+S = "${WORKDIR}/git"
+
+do_install() {
+ install -d ${D}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${S}/* ${D}${prefix}/local/go/src/${PKG_NAME}/
+}
+
+SYSROOT_PREPROCESS_FUNCS += "go_systemd_sysroot_preprocess"
+
+go_systemd_sysroot_preprocess () {
+ install -d ${SYSROOT_DESTDIR}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${D}${prefix}/local/go/src/${PKG_NAME} ${SYSROOT_DESTDIR}${prefix}/local/go/src/$(dirname ${PKG_NAME})
+}
+
+FILES:${PN} += "${prefix}/local/go/src/${PKG_NAME}/*"
diff --git a/recipes-devtools/go/grpc-go_git.bb b/recipes-devtools/go/grpc-go_git.bb
new file mode 100644
index 0000000..b516e21
--- /dev/null
+++ b/recipes-devtools/go/grpc-go_git.bb
@@ -0,0 +1,41 @@
+DESCRIPTION = "The Go language implementation of gRPC. HTTP/2 based RPC"
+HOMEPAGE = "https://github.com/grpc/grpc-go"
+SECTION = "devel/go"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://src/${PKG_NAME}/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
+
+SRCNAME = "grpc-go"
+
+PKG_NAME = "google.golang.org/grpc"
+SRC_URI = "git://github.com/grpc/${SRCNAME}.git;destsuffix=git/src/${PKG_NAME};branch=master;protocol=https"
+
+SRCREV = "5d8e5aad40bedb696205b96b786f1d0e1326b3f8"
+PV = "1.41.0+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+# NO-OP the do compile rule because this recipe is source only.
+do_compile() {
+}
+
+do_install() {
+ install -d ${D}${prefix}/local/go/src/${PKG_NAME}
+ for j in $(cd ${S} && find src/${PKG_NAME} -name "*.go"); do
+ if [ ! -d ${D}${prefix}/local/go/$(dirname $j) ]; then
+ mkdir -p ${D}${prefix}/local/go/$(dirname $j)
+ fi
+ cp $j ${D}${prefix}/local/go/$j
+ done
+ cp -r ${S}/src/${PKG_NAME}/LICENSE ${D}${prefix}/local/go/src/${PKG_NAME}/
+}
+
+SYSROOT_PREPROCESS_FUNCS += "go_grpc_sysroot_preprocess"
+
+go_grpc_sysroot_preprocess () {
+ install -d ${SYSROOT_DESTDIR}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${D}${prefix}/local/go/src/${PKG_NAME} ${SYSROOT_DESTDIR}${prefix}/local/go/src/$(dirname ${PKG_NAME})
+}
+
+FILES:${PN} += " \
+ ${prefix}/local/go/src/${PKG_NAME}/* \
+"
diff --git a/recipes-devtools/go/notary_git.bb b/recipes-devtools/go/notary_git.bb
new file mode 100644
index 0000000..972da5e
--- /dev/null
+++ b/recipes-devtools/go/notary_git.bb
@@ -0,0 +1,39 @@
+DESCRIPTION = "Notary is a Docker project that allows anyone to have trust over arbitrary collections of data"
+HOMEPAGE = "https://github.com/docker/notary"
+SECTION = "devel/go"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://src/${PKG_NAME}/LICENSE;md5=3596b980bb036e0875174ed15e4b982a"
+
+SRCNAME = "notary"
+
+PKG_NAME = "github.com/docker/${SRCNAME}"
+SRC_URI = "git://${PKG_NAME}.git;destsuffix=git/src/${PKG_NAME};branch=master;protocol=https"
+
+SRCREV = "d6e1431feb32348e0650bf7551ac5cffd01d857b"
+PV = "0.6.1+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+# NO-OP the do compile rule because this recipe is source only.
+do_compile() {
+}
+
+do_install() {
+ install -d ${D}${prefix}/local/go/src/${PKG_NAME}
+ for j in $(cd ${S} && find src/${PKG_NAME} -name "*.go"); do
+ if [ ! -d ${D}${prefix}/local/go/$(dirname $j) ]; then
+ mkdir -p ${D}${prefix}/local/go/$(dirname $j)
+ fi
+ cp $j ${D}${prefix}/local/go/$j
+ done
+ cp -r ${S}/src/${PKG_NAME}/LICENSE ${D}${prefix}/local/go/src/${PKG_NAME}/
+}
+
+SYSROOT_PREPROCESS_FUNCS += "go_notary_sysroot_preprocess"
+
+go_notary_sysroot_preprocess () {
+ install -d ${SYSROOT_DESTDIR}${prefix}/local/go/src/${PKG_NAME}
+ cp -r ${D}${prefix}/local/go/src/${PKG_NAME} ${SYSROOT_DESTDIR}${prefix}/local/go/src/$(dirname ${PKG_NAME})
+}
+
+FILES:${PN} += "${prefix}/local/go/src/${PKG_NAME}/*"
--
2.20.1


[meta-lts-mixins][dunfell/docker PATCH 1/2] Initial commit: add license, readme, layer configuration.

Alexander Kanavin
 

Reviewed-by: Martin Kaistra <martin.kaistra@...>
Signed-off-by: Alexander Kanavin <alex@...>
---
COPYING.MIT | 17 +++++++++++++++++
README | 10 ++++++++++
conf/layer.conf | 23 +++++++++++++++++++++++
3 files changed, 50 insertions(+)
create mode 100644 COPYING.MIT
create mode 100644 README
create mode 100644 conf/layer.conf

diff --git a/COPYING.MIT b/COPYING.MIT
new file mode 100644
index 0000000..fb950dc
--- /dev/null
+++ b/COPYING.MIT
@@ -0,0 +1,17 @@
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/README b/README
new file mode 100644
index 0000000..417038e
--- /dev/null
+++ b/README
@@ -0,0 +1,10 @@
+"Mixin" layer for adding latest Docker versions into the Yocto Project LTS.
+
+This is a supplementary layer to dunfell/go branch of meta-lts-mixins. As that
+layer updates go toolchain to newer versions, this renders the docker recipes
+from dunfell branch of meta-virtualization unbuildable. The purpose of this layer
+is to backport latest, compatible docker from meta-virtualization master to
+dunfell.
+
+Maintainers:
+Alexander Kanavin <alex@...>
diff --git a/conf/layer.conf b/conf/layer.conf
new file mode 100644
index 0000000..9918c46
--- /dev/null
+++ b/conf/layer.conf
@@ -0,0 +1,23 @@
+# We have a conf and classes directory, append to BBPATH
+BBPATH .= ":${LAYERDIR}"
+
+# We have a recipes directory, add to BBFILES
+BBFILES += "${LAYERDIR}/recipes*/*/*.bb ${LAYERDIR}/recipes*/*/*.bbappend"
+
+BBFILE_COLLECTIONS += "lts-docker-mixin"
+BBFILE_PATTERN_lts-docker-mixin := "^${LAYERDIR}/"
+BBFILE_PRIORITY_lts-docker-mixin = "6"
+
+LAYERSERIES_COMPAT_lts-docker-mixin = "dunfell"
+
+LAYERDEPENDS_lts-docker-mixin = " \
+ core \
+ openembedded-layer \
+ networking-layer \
+ meta-python \
+"
+
+PREFERRED_PROVIDER_virtual/runc ?= "runc-opencontainers"
+PREFERRED_PROVIDER_virtual/containerd ?= "containerd-opencontainers"
+PREFERRED_PROVIDER_virtual/docker ?= "docker-ce"
+
--
2.20.1


[meta-lts-mixins][dunfell/go PATCH 4/4] go-helloworld: add from openembedded-core master

Alexander Kanavin
 

This allows a quick smoke test for whether go toolchain produces
working executables.

Link: https://git.yoctoproject.org/poky/tree/meta/recipes-extended/go-examples?id=278cb0fc0725fbfdcafd3b3afcfb7c7c6a4eee14

(copy from external source:
git: https://git.yoctoproject.org/poky/
archive: 278cb0fc0725fbfdcafd3b3afcfb7c7c6a4eee14
copy: meta/recipes-extended/go-examples --> recipes-devtools/go-examples/)

Acked-by: Martin Kaistra <martin.kaistra@...>
Signed-off-by: Alexander Kanavin <alex@...>
---
.../go-examples/go-helloworld_0.1.bb | 22 +++++++++++++++++++
1 file changed, 22 insertions(+)
create mode 100644 recipes-devtools/go-examples/go-helloworld_0.1.bb

diff --git a/recipes-devtools/go-examples/go-helloworld_0.1.bb b/recipes-devtools/go-examples/go-helloworld_0.1.bb
new file mode 100644
index 0000000..b3a8631
--- /dev/null
+++ b/recipes-devtools/go-examples/go-helloworld_0.1.bb
@@ -0,0 +1,22 @@
+DESCRIPTION = "This is a simple example recipe that cross-compiles a Go program."
+SECTION = "examples"
+HOMEPAGE = "https://golang.org/"
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+SRC_URI = "git://go.googlesource.com/example;branch=master;protocol=https"
+SRCREV = "787a929d5a0dfb8bbfcdd2c4a62e0fd89466113f"
+UPSTREAM_CHECK_COMMITS = "1"
+
+GO_IMPORT = "golang.org/x/example"
+GO_INSTALL = "${GO_IMPORT}/hello"
+GO_WORKDIR = "${GO_INSTALL}"
+export GO111MODULE="off"
+
+inherit go
+
+# This is just to make clear where this example is
+do_install:append() {
+ mv ${D}${bindir}/hello ${D}${bindir}/${BPN}
+}
--
2.20.1


[meta-lts-mixins][dunfell/go PATCH 3/4] go-1.17: import recipes from openembedded-core

Alexander Kanavin
 

Link: https://git.yoctoproject.org/poky/tree/meta/recipes-devtools/go?id=20846102156418f187e977ab0bbd557525bbc4e1

(copy from external source:
git: https://git.yoctoproject.org/poky/
archive: 20846102156418f187e977ab0bbd557525bbc4e1
copy: meta/recipes-devtools/go --> recipes-devtools/go-1.17)

Acked-by: Martin Kaistra <martin.kaistra@...>
Signed-off-by: Alexander Kanavin <alex@...>
---
recipes-devtools/go-1.17/go-1.17.4.inc | 23 ++
...ow-CC-and-CXX-to-have-multiple-words.patch | 33 ++
...ent-based-hash-generation-less-pedan.patch | 237 +++++++++++++++
...-to-be-overridden-in-the-environment.patch | 52 ++++
...4-ld-add-soname-to-shareable-objects.patch | 45 +++
...de-CC-when-building-dist-and-go_boot.patch | 41 +++
...dist-separate-host-and-target-builds.patch | 283 ++++++++++++++++++
...d-go-make-GOROOT-precious-by-default.patch | 104 +++++++
...008-use-GOBUILDMODE-to-set-buildmode.patch | 42 +++
...go-make-sure-CC-and-CXX-are-absolute.patch | 94 ++++++
.../go-1.17/go-binary-native_1.17.4.bb | 46 +++
recipes-devtools/go-1.17/go-common.inc | 42 +++
.../go-1.17/go-cross-canadian.inc | 62 ++++
.../go-1.17/go-cross-canadian_1.17.4.bb | 2 +
recipes-devtools/go-1.17/go-cross.inc | 53 ++++
recipes-devtools/go-1.17/go-cross_1.17.4.bb | 2 +
recipes-devtools/go-1.17/go-crosssdk.inc | 43 +++
.../go-1.17/go-crosssdk_1.17.4.bb | 2 +
recipes-devtools/go-1.17/go-native_1.17.4.bb | 59 ++++
recipes-devtools/go-1.17/go-runtime.inc | 87 ++++++
recipes-devtools/go-1.17/go-runtime_1.17.4.bb | 3 +
recipes-devtools/go-1.17/go-target.inc | 45 +++
recipes-devtools/go-1.17/go_1.17.4.bb | 17 ++
23 files changed, 1417 insertions(+)
create mode 100644 recipes-devtools/go-1.17/go-1.17.4.inc
create mode 100644 recipes-devtools/go-1.17/go-1.17/0001-allow-CC-and-CXX-to-have-multiple-words.patch
create mode 100644 recipes-devtools/go-1.17/go-1.17/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch
create mode 100644 recipes-devtools/go-1.17/go-1.17/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch
create mode 100644 recipes-devtools/go-1.17/go-1.17/0004-ld-add-soname-to-shareable-objects.patch
create mode 100644 recipes-devtools/go-1.17/go-1.17/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch
create mode 100644 recipes-devtools/go-1.17/go-1.17/0006-cmd-dist-separate-host-and-target-builds.patch
create mode 100644 recipes-devtools/go-1.17/go-1.17/0007-cmd-go-make-GOROOT-precious-by-default.patch
create mode 100644 recipes-devtools/go-1.17/go-1.17/0008-use-GOBUILDMODE-to-set-buildmode.patch
create mode 100644 recipes-devtools/go-1.17/go-1.17/0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch
create mode 100644 recipes-devtools/go-1.17/go-binary-native_1.17.4.bb
create mode 100644 recipes-devtools/go-1.17/go-common.inc
create mode 100644 recipes-devtools/go-1.17/go-cross-canadian.inc
create mode 100644 recipes-devtools/go-1.17/go-cross-canadian_1.17.4.bb
create mode 100644 recipes-devtools/go-1.17/go-cross.inc
create mode 100644 recipes-devtools/go-1.17/go-cross_1.17.4.bb
create mode 100644 recipes-devtools/go-1.17/go-crosssdk.inc
create mode 100644 recipes-devtools/go-1.17/go-crosssdk_1.17.4.bb
create mode 100644 recipes-devtools/go-1.17/go-native_1.17.4.bb
create mode 100644 recipes-devtools/go-1.17/go-runtime.inc
create mode 100644 recipes-devtools/go-1.17/go-runtime_1.17.4.bb
create mode 100644 recipes-devtools/go-1.17/go-target.inc
create mode 100644 recipes-devtools/go-1.17/go_1.17.4.bb

diff --git a/recipes-devtools/go-1.17/go-1.17.4.inc b/recipes-devtools/go-1.17/go-1.17.4.inc
new file mode 100644
index 0000000..5c4423a
--- /dev/null
+++ b/recipes-devtools/go-1.17/go-1.17.4.inc
@@ -0,0 +1,23 @@
+require go-common.inc
+
+FILESEXTRAPATHS:prepend := "${FILE_DIRNAME}/go-1.17:"
+
+LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"
+
+SRC_URI += "\
+ file://0001-allow-CC-and-CXX-to-have-multiple-words.patch \
+ file://0002-cmd-go-make-content-based-hash-generation-less-pedan.patch \
+ file://0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch \
+ file://0004-ld-add-soname-to-shareable-objects.patch \
+ file://0005-make.bash-override-CC-when-building-dist-and-go_boot.patch \
+ file://0006-cmd-dist-separate-host-and-target-builds.patch \
+ file://0007-cmd-go-make-GOROOT-precious-by-default.patch \
+ file://0008-use-GOBUILDMODE-to-set-buildmode.patch \
+ file://0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch \
+"
+SRC_URI[main.sha256sum] = "4bef3699381ef09e075628504187416565d710660fec65b057edf1ceb187fc4b"
+
+# Upstream don't believe it is a signifiant real world issue and will only
+# fix in 1.17 onwards where we can drop this.
+# https://github.com/golang/go/issues/30999#issuecomment-910470358
+CVE_CHECK_WHITELIST += "CVE-2021-29923"
diff --git a/recipes-devtools/go-1.17/go-1.17/0001-allow-CC-and-CXX-to-have-multiple-words.patch b/recipes-devtools/go-1.17/go-1.17/0001-allow-CC-and-CXX-to-have-multiple-words.patch
new file mode 100644
index 0000000..5f4823b
--- /dev/null
+++ b/recipes-devtools/go-1.17/go-1.17/0001-allow-CC-and-CXX-to-have-multiple-words.patch
@@ -0,0 +1,33 @@
+From 9e3dc44cdfa58d96504d0a789dc82617dd5bef55 Mon Sep 17 00:00:00 2001
+From: Alex Kube <alexander.j.kube@...>
+Date: Wed, 23 Oct 2019 21:01:13 +0430
+Subject: [PATCH 1/9] cmd/go: Allow CC and CXX to have multiple words
+
+Upstream-Status: Inappropriate [OE specific]
+
+Adapted to Go 1.13 from patches originally submitted to
+the meta/recipes-devtools/go tree by
+Matt Madison <matt@...>.
+
+Signed-off-by: Alexander J Kube <alexander.j.kube@...>
+
+---
+ src/cmd/go/internal/envcmd/env.go | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/src/cmd/go/internal/envcmd/env.go
++++ b/src/cmd/go/internal/envcmd/env.go
+@@ -103,11 +103,11 @@ func MkEnv() []cfg.EnvVar {
+
+ cc := cfg.DefaultCC(cfg.Goos, cfg.Goarch)
+ if env := strings.Fields(cfg.Getenv("CC")); len(env) > 0 {
+- cc = env[0]
++ cc = strings.Join(env, " ")
+ }
+ cxx := cfg.DefaultCXX(cfg.Goos, cfg.Goarch)
+ if env := strings.Fields(cfg.Getenv("CXX")); len(env) > 0 {
+- cxx = env[0]
++ cxx = strings.Join(env, " ")
+ }
+ env = append(env, cfg.EnvVar{Name: "AR", Value: envOr("AR", "ar")})
+ env = append(env, cfg.EnvVar{Name: "CC", Value: cc})
diff --git a/recipes-devtools/go-1.17/go-1.17/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch b/recipes-devtools/go-1.17/go-1.17/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch
new file mode 100644
index 0000000..42cd568
--- /dev/null
+++ b/recipes-devtools/go-1.17/go-1.17/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch
@@ -0,0 +1,237 @@
+From c403b45995c5daa6747ac4d95b39bc9a6feb2cda Mon Sep 17 00:00:00 2001
+From: Alex Kube <alexander.j.kube@...>
+Date: Wed, 23 Oct 2019 21:14:22 +0430
+Subject: [PATCH] cmd/go: make content-based hash generation less pedantic
+
+Upstream-Status: Inappropriate [OE specific]
+
+Go 1.10's build tool now uses content-based hashes to
+determine when something should be built or re-built.
+This same mechanism is used to maintain a built-artifact
+cache for speeding up builds.
+
+However, the hashes it generates include information that
+doesn't work well with OE, nor with using a shared runtime
+library.
+
+First, it embeds path names to source files, unless
+building within GOROOT. This prevents the building
+of a package in GOPATH for later staging into GOROOT.
+
+This patch adds support for the environment variable
+GOPATH_OMIT_IN_ACTIONID. If present, path name
+embedding is disabled.
+
+Second, if cgo is enabled, the build ID for cgo-related
+packages will include the current value of the environment
+variables for invoking the compiler (CC, CXX, FC) and
+any CGO_xxFLAGS variables. Only if the settings used
+during a compilation exactly match, character for character,
+the values used for compiling runtime/cgo or any other
+cgo-enabled package being imported, will the tool
+decide that the imported package is up-to-date.
+
+This is done to help ensure correctness, but is overly
+simplistic and effectively prevents the reuse of built
+artifacts that use cgo (or shared runtime, which includes
+runtime/cgo).
+
+This patch filters out all compiler flags except those
+beginning with '-m'. The default behavior can be restored
+by setting the CGO_PEDANTIC environment variable.
+
+Adapted to Go 1.13 from patches originally submitted to
+the meta/recipes-devtools/go tree by
+Matt Madison <matt@...>.
+
+Signed-off-by: Alexander J Kube <alexander.j.kube@...>
+---
+ src/cmd/go/internal/envcmd/env.go | 2 +-
+ src/cmd/go/internal/work/exec.go | 66 ++++++++++++++++++++++---------
+ 2 files changed, 49 insertions(+), 19 deletions(-)
+
+diff --git a/src/cmd/go/internal/envcmd/env.go b/src/cmd/go/internal/envcmd/env.go
+index 20d0587..ff6f0d8 100644
+--- a/src/cmd/go/internal/envcmd/env.go
++++ b/src/cmd/go/internal/envcmd/env.go
+@@ -160,7 +160,7 @@ func ExtraEnvVars() []cfg.EnvVar {
+ func ExtraEnvVarsCostly() []cfg.EnvVar {
+ var b work.Builder
+ b.Init()
+- cppflags, cflags, cxxflags, fflags, ldflags, err := b.CFlags(&load.Package{})
++ cppflags, cflags, cxxflags, fflags, ldflags, err := b.CFlags(&load.Package{}, false)
+ if err != nil {
+ // Should not happen - b.CFlags was given an empty package.
+ fmt.Fprintf(os.Stderr, "go: invalid cflags: %v\n", err)
+diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go
+index 5a225fb..a37872e 100644
+--- a/src/cmd/go/internal/work/exec.go
++++ b/src/cmd/go/internal/work/exec.go
+@@ -38,6 +38,8 @@ import (
+ "cmd/go/internal/trace"
+ )
+
++var omitGopath = os.Getenv("GOPATH_OMIT_IN_ACTIONID") != ""
++
+ // actionList returns the list of actions in the dag rooted at root
+ // as visited in a depth-first post-order traversal.
+ func actionList(root *Action) []*Action {
+@@ -229,7 +231,7 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID {
+ // Assume b.WorkDir is being trimmed properly.
+ // When -trimpath is used with a package built from the module cache,
+ // use the module path and version instead of the directory.
+- if !p.Goroot && !cfg.BuildTrimpath && !strings.HasPrefix(p.Dir, b.WorkDir) {
++ if !p.Goroot && !omitGopath && !cfg.BuildTrimpath && !strings.HasPrefix(p.Dir, b.WorkDir) {
+ fmt.Fprintf(h, "dir %s\n", p.Dir)
+ } else if cfg.BuildTrimpath && p.Module != nil {
+ fmt.Fprintf(h, "module %s@%s\n", p.Module.Path, p.Module.Version)
+@@ -248,9 +250,9 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID {
+ }
+ if len(p.CgoFiles)+len(p.SwigFiles)+len(p.SwigCXXFiles) > 0 {
+ fmt.Fprintf(h, "cgo %q\n", b.toolID("cgo"))
+- cppflags, cflags, cxxflags, fflags, ldflags, _ := b.CFlags(p)
++ cppflags, cflags, cxxflags, fflags, ldflags, _ := b.CFlags(p, true)
+
+- ccExe := b.ccExe()
++ ccExe := b.ccExe(true)
+ fmt.Fprintf(h, "CC=%q %q %q %q\n", ccExe, cppflags, cflags, ldflags)
+ // Include the C compiler tool ID so that if the C
+ // compiler changes we rebuild the package.
+@@ -263,14 +265,14 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID {
+ }
+ }
+ if len(p.CXXFiles)+len(p.SwigCXXFiles) > 0 {
+- cxxExe := b.cxxExe()
++ cxxExe := b.cxxExe(true)
+ fmt.Fprintf(h, "CXX=%q %q\n", cxxExe, cxxflags)
+ if cxxID, err := b.gccToolID(cxxExe[0], "c++"); err == nil {
+ fmt.Fprintf(h, "CXX ID=%q\n", cxxID)
+ }
+ }
+ if len(p.FFiles) > 0 {
+- fcExe := b.fcExe()
++ fcExe := b.fcExe(true)
+ fmt.Fprintf(h, "FC=%q %q\n", fcExe, fflags)
+ if fcID, err := b.gccToolID(fcExe[0], "f95"); err == nil {
+ fmt.Fprintf(h, "FC ID=%q\n", fcID)
+@@ -2438,33 +2440,48 @@ var (
+ // gccCmd returns a gcc command line prefix
+ // defaultCC is defined in zdefaultcc.go, written by cmd/dist.
+ func (b *Builder) GccCmd(incdir, workdir string) []string {
+- return b.compilerCmd(b.ccExe(), incdir, workdir)
++ return b.compilerCmd(b.ccExe(false), incdir, workdir)
+ }
+
+ // gxxCmd returns a g++ command line prefix
+ // defaultCXX is defined in zdefaultcc.go, written by cmd/dist.
+ func (b *Builder) GxxCmd(incdir, workdir string) []string {
+- return b.compilerCmd(b.cxxExe(), incdir, workdir)
++ return b.compilerCmd(b.cxxExe(false), incdir, workdir)
+ }
+
+ // gfortranCmd returns a gfortran command line prefix.
+ func (b *Builder) gfortranCmd(incdir, workdir string) []string {
+- return b.compilerCmd(b.fcExe(), incdir, workdir)
++ return b.compilerCmd(b.fcExe(false), incdir, workdir)
+ }
+
+ // ccExe returns the CC compiler setting without all the extra flags we add implicitly.
+-func (b *Builder) ccExe() []string {
+- return b.compilerExe(origCC, cfg.DefaultCC(cfg.Goos, cfg.Goarch))
++func (b *Builder) ccExe(filtered bool) []string {
++ return b.compilerExe(origCC, cfg.DefaultCC(cfg.Goos, cfg.Goarch), filtered)
+ }
+
+ // cxxExe returns the CXX compiler setting without all the extra flags we add implicitly.
+-func (b *Builder) cxxExe() []string {
+- return b.compilerExe(origCXX, cfg.DefaultCXX(cfg.Goos, cfg.Goarch))
++func (b *Builder) cxxExe(filtered bool) []string {
++ return b.compilerExe(origCXX, cfg.DefaultCXX(cfg.Goos, cfg.Goarch), filtered)
+ }
+
+ // fcExe returns the FC compiler setting without all the extra flags we add implicitly.
+-func (b *Builder) fcExe() []string {
+- return b.compilerExe(cfg.Getenv("FC"), "gfortran")
++func (b *Builder) fcExe(filtered bool) []string {
++ return b.compilerExe(os.Getenv("FC"), "gfortran", filtered)
++}
++
++var filterFlags = os.Getenv("CGO_PEDANTIC") == ""
++
++func filterCompilerFlags(flags []string) []string {
++ var newflags []string
++ if !filterFlags {
++ return flags
++ }
++ for _, flag := range flags {
++ if strings.HasPrefix(flag, "-m") {
++ newflags = append(newflags, flag)
++ }
++ }
++ return newflags
+ }
+
+ // compilerExe returns the compiler to use given an
+@@ -2473,11 +2490,16 @@ func (b *Builder) fcExe() []string {
+ // of the compiler but can have additional arguments if they
+ // were present in the environment value.
+ // For example if CC="gcc -DGOPHER" then the result is ["gcc", "-DGOPHER"].
+-func (b *Builder) compilerExe(envValue string, def string) []string {
++func (b *Builder) compilerExe(envValue string, def string, filtered bool) []string {
+ compiler := strings.Fields(envValue)
+ if len(compiler) == 0 {
+ compiler = strings.Fields(def)
+ }
++
++ if filtered {
++ return append(compiler[0:1], filterCompilerFlags(compiler[1:])...)
++ }
++
+ return compiler
+ }
+
+@@ -2667,7 +2689,7 @@ func envList(key, def string) []string {
+ }
+
+ // CFlags returns the flags to use when invoking the C, C++ or Fortran compilers, or cgo.
+-func (b *Builder) CFlags(p *load.Package) (cppflags, cflags, cxxflags, fflags, ldflags []string, err error) {
++func (b *Builder) CFlags(p *load.Package, filtered bool) (cppflags, cflags, cxxflags, fflags, ldflags []string, err error) {
+ defaults := "-g -O2"
+
+ if cppflags, err = buildFlags("CPPFLAGS", "", p.CgoCPPFLAGS, checkCompilerFlags); err != nil {
+@@ -2686,6 +2708,14 @@ func (b *Builder) CFlags(p *load.Package) (cppflags, cflags, cxxflags, fflags, l
+ return
+ }
+
++ if filtered {
++ cppflags = filterCompilerFlags(cppflags)
++ cflags = filterCompilerFlags(cflags)
++ cxxflags = filterCompilerFlags(cxxflags)
++ fflags = filterCompilerFlags(fflags)
++ ldflags = filterCompilerFlags(ldflags)
++ }
++
+ return
+ }
+
+@@ -2700,7 +2730,7 @@ var cgoRe = lazyregexp.New(`[/\\:]`)
+
+ func (b *Builder) cgo(a *Action, cgoExe, objdir string, pcCFLAGS, pcLDFLAGS, cgofiles, gccfiles, gxxfiles, mfiles, ffiles []string) (outGo, outObj []string, err error) {
+ p := a.Package
+- cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoFFLAGS, cgoLDFLAGS, err := b.CFlags(p)
++ cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoFFLAGS, cgoLDFLAGS, err := b.CFlags(p, false)
+ if err != nil {
+ return nil, nil, err
+ }
+@@ -3151,7 +3181,7 @@ func (b *Builder) swigIntSize(objdir string) (intsize string, err error) {
+
+ // Run SWIG on one SWIG input file.
+ func (b *Builder) swigOne(a *Action, p *load.Package, file, objdir string, pcCFLAGS []string, cxx bool, intgosize string) (outGo, outC string, err error) {
+- cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, _, _, err := b.CFlags(p)
++ cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, _, _, err := b.CFlags(p, false)
+ if err != nil {
+ return "", "", err
+ }
+--
+2.20.1
+
diff --git a/recipes-devtools/go-1.17/go-1.17/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch b/recipes-devtools/go-1.17/go-1.17/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch
new file mode 100644
index 0000000..2a86bdc
--- /dev/null
+++ b/recipes-devtools/go-1.17/go-1.17/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch
@@ -0,0 +1,52 @@
+From 8512964c0bfdfc3c9c3805743ea7de551a1d476a Mon Sep 17 00:00:00 2001
+From: Alex Kube <alexander.j.kube@...>
+Date: Wed, 23 Oct 2019 21:15:37 +0430
+Subject: [PATCH] cmd/go: Allow GOTOOLDIR to be overridden in the environment
+
+to allow for split host/target build roots
+
+Adapted to Go 1.13 from patches originally submitted to
+the meta/recipes-devtools/go tree by
+Matt Madison <matt@...>.
+
+Upstream-Status: Inappropriate [OE specific]
+
+Signed-off-by: Alexander J Kube <alexander.j.kube@...>
+
+---
+ src/cmd/dist/build.go | 4 +++-
+ src/cmd/go/internal/cfg/cfg.go | 6 +++++-
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
+index bec1769..d82f612 100644
+--- a/src/cmd/dist/build.go
++++ b/src/cmd/dist/build.go
+@@ -248,7 +248,9 @@ func xinit() {
+ }
+ xatexit(rmworkdir)
+
+- tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch)
++ if tooldir = os.Getenv("GOTOOLDIR"); tooldir == "" {
++ tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch)
++ }
+ }
+
+ // compilerEnv returns a map from "goos/goarch" to the
+diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go
+index 57a3c1f..825d8c7 100644
+--- a/src/cmd/go/internal/cfg/cfg.go
++++ b/src/cmd/go/internal/cfg/cfg.go
+@@ -67,7 +67,11 @@ func defaultContext() build.Context {
+ // variables. This matches the initialization of ToolDir in
+ // go/build, except for using ctxt.GOROOT rather than
+ // runtime.GOROOT.
+- build.ToolDir = filepath.Join(ctxt.GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
++ if s := os.Getenv("GOTOOLDIR"); s != "" {
++ build.ToolDir = filepath.Clean(s)
++ } else {
++ build.ToolDir = filepath.Join(ctxt.GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
++ }
+ }
+
+ ctxt.GOPATH = envOr("GOPATH", ctxt.GOPATH)
diff --git a/recipes-devtools/go-1.17/go-1.17/0004-ld-add-soname-to-shareable-objects.patch b/recipes-devtools/go-1.17/go-1.17/0004-ld-add-soname-to-shareable-objects.patch
new file mode 100644
index 0000000..cd875f1
--- /dev/null
+++ b/recipes-devtools/go-1.17/go-1.17/0004-ld-add-soname-to-shareable-objects.patch
@@ -0,0 +1,45 @@
+From bf5cf5301ae5914498454c87293d1df2e1d8489f Mon Sep 17 00:00:00 2001
+From: Alex Kube <alexander.j.kube@...>
+Date: Wed, 23 Oct 2019 21:16:32 +0430
+Subject: [PATCH 4/9] ld: add soname to shareable objects
+
+so that OE's shared library dependency handling
+can find them.
+
+Adapted to Go 1.13 from patches originally submitted to
+the meta/recipes-devtools/go tree by
+Matt Madison <matt@...>.
+
+Upstream-Status: Inappropriate [OE specific]
+
+Signed-off-by: Alexander J Kube <alexander.j.kube@...>
+---
+ src/cmd/link/internal/ld/lib.go | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/src/cmd/link/internal/ld/lib.go
++++ b/src/cmd/link/internal/ld/lib.go
+@@ -1343,6 +1343,7 @@ func (ctxt *Link) hostlink() {
+ argv = append(argv, "-Wl,-z,relro")
+ }
+ argv = append(argv, "-shared")
++ argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile)))
+ if ctxt.HeadType == objabi.Hwindows {
+ if *flagAslr {
+ argv = addASLRargs(argv)
+@@ -1358,6 +1359,7 @@ func (ctxt *Link) hostlink() {
+ argv = append(argv, "-Wl,-z,relro")
+ }
+ argv = append(argv, "-shared")
++ argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile)))
+ case BuildModePlugin:
+ if ctxt.HeadType == objabi.Hdarwin {
+ argv = append(argv, "-dynamiclib")
+@@ -1366,6 +1368,7 @@ func (ctxt *Link) hostlink() {
+ argv = append(argv, "-Wl,-z,relro")
+ }
+ argv = append(argv, "-shared")
++ argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile)))
+ }
+ }
+
diff --git a/recipes-devtools/go-1.17/go-1.17/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch b/recipes-devtools/go-1.17/go-1.17/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch
new file mode 100644
index 0000000..2845d21
--- /dev/null
+++ b/recipes-devtools/go-1.17/go-1.17/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch
@@ -0,0 +1,41 @@
+From 153e2dda6103fd9dd871be4bb495a8da5328301e Mon Sep 17 00:00:00 2001
+From: Alex Kube <alexander.j.kube@...>
+Date: Wed, 23 Oct 2019 21:17:16 +0430
+Subject: [PATCH] make.bash: override CC when building dist and go_bootstrap
+
+for handling OE cross-canadian builds.
+
+Adapted to Go 1.13 from patches originally submitted to
+the meta/recipes-devtools/go tree by
+Matt Madison <matt@...>.
+
+Upstream-Status: Inappropriate [OE specific]
+
+Signed-off-by: Alexander J Kube <alexander.j.kube@...>
+
+---
+ src/make.bash | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/make.bash b/src/make.bash
+index 7986125..dd67029 100755
+--- a/src/make.bash
++++ b/src/make.bash
+@@ -181,7 +181,7 @@ if [ "$GOROOT_BOOTSTRAP" = "$GOROOT" ]; then
+ exit 1
+ fi
+ rm -f cmd/dist/dist
+-GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" GO111MODULE=off "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
++CC="${BUILD_CC:-${CC}}" GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" GO111MODULE=off "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
+
+ # -e doesn't propagate out of eval, so check success by hand.
+ eval $(./cmd/dist/dist env -p || echo FAIL=true)
+@@ -206,7 +206,7 @@ fi
+ # Run dist bootstrap to complete make.bash.
+ # Bootstrap installs a proper cmd/dist, built with the new toolchain.
+ # Throw ours, built with Go 1.4, away after bootstrap.
+-./cmd/dist/dist bootstrap -a $vflag $GO_DISTFLAGS "$@"
++CC="${BUILD_CC:-${CC}}" ./cmd/dist/dist bootstrap -a $vflag $GO_DISTFLAGS "$@"
+ rm -f ./cmd/dist/dist
+
+ # DO NOT ADD ANY NEW CODE HERE.
diff --git a/recipes-devtools/go-1.17/go-1.17/0006-cmd-dist-separate-host-and-target-builds.patch b/recipes-devtools/go-1.17/go-1.17/0006-cmd-dist-separate-host-and-target-builds.patch
new file mode 100644
index 0000000..68e8efc
--- /dev/null
+++ b/recipes-devtools/go-1.17/go-1.17/0006-cmd-dist-separate-host-and-target-builds.patch
@@ -0,0 +1,283 @@
+From 7bc891e00be4263311d75aa2b2ee6a3b7b75355f Mon Sep 17 00:00:00 2001
+From: Alex Kube <alexander.j.kube@...>
+Date: Wed, 23 Oct 2019 21:18:12 +0430
+Subject: [PATCH] cmd/dist: separate host and target builds
+
+Upstream-Status: Inappropriate [OE specific]
+
+Change the dist tool to allow for OE-style cross-
+and cross-canadian builds:
+
+ - command flags --host-only and --target only are added;
+ if one is present, the other changes mentioned below
+ take effect, and arguments may also be specified on
+ the command line to enumerate the package(s) to be
+ built.
+
+ - for OE cross builds, go_bootstrap is always built for
+ the current build host, and is moved, along with the supporting
+ toolchain (asm, compile, etc.) to a separate 'native_native'
+ directory under GOROOT/pkg/tool.
+
+ - go_bootstrap is not automatically removed after the build,
+ so it can be reused later (e.g., building both static and
+ shared runtime).
+
+Note that for --host-only builds, it would be nice to specify
+just the "cmd" package to build only the go commands/tools,
+the staleness checks in the dist tool will fail if the "std"
+library has not also been built. So host-only builds have to
+build everything anyway.
+
+Adapted to Go 1.13 from patches originally submitted to
+the meta/recipes-devtools/go tree by
+Matt Madison <matt@...>.
+
+Signed-off-by: Alexander J Kube <alexander.j.kube@...>
+
+---
+ src/cmd/dist/build.go | 156 ++++++++++++++++++++++++++++++------------
+ 1 file changed, 113 insertions(+), 43 deletions(-)
+
+diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
+index d82f612..5c8459c 100644
+--- a/src/cmd/dist/build.go
++++ b/src/cmd/dist/build.go
+@@ -43,6 +43,7 @@ var (
+ goexperiment string
+ workdir string
+ tooldir string
++ build_tooldir string
+ oldgoos string
+ oldgoarch string
+ exe string
+@@ -55,6 +56,7 @@ var (
+
+ rebuildall bool
+ defaultclang bool
++ crossBuild bool
+
+ vflag int // verbosity
+ )
+@@ -251,6 +253,8 @@ func xinit() {
+ if tooldir = os.Getenv("GOTOOLDIR"); tooldir == "" {
+ tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch)
+ }
++
++ build_tooldir = pathf("%s/pkg/tool/native_native", goroot)
+ }
+
+ // compilerEnv returns a map from "goos/goarch" to the
+@@ -496,8 +500,10 @@ func setup() {
+ p := pathf("%s/pkg/%s_%s", goroot, gohostos, gohostarch)
+ if rebuildall {
+ xremoveall(p)
++ xremoveall(build_tooldir)
+ }
+ xmkdirall(p)
++ xmkdirall(build_tooldir)
+
+ if goos != gohostos || goarch != gohostarch {
+ p := pathf("%s/pkg/%s_%s", goroot, goos, goarch)
+@@ -1267,17 +1273,35 @@ func cmdbootstrap() {
+
+ var noBanner, noClean bool
+ var debug bool
++ var hostOnly bool
++ var targetOnly bool
++ var toBuild = []string{"std", "cmd"}
++
+ flag.BoolVar(&rebuildall, "a", rebuildall, "rebuild all")
+ flag.BoolVar(&debug, "d", debug, "enable debugging of bootstrap process")
+ flag.BoolVar(&noBanner, "no-banner", noBanner, "do not print banner")
+ flag.BoolVar(&noClean, "no-clean", noClean, "print deprecation warning")
++ flag.BoolVar(&hostOnly, "host-only", hostOnly, "build only host binaries, not target")
++ flag.BoolVar(&targetOnly, "target-only", targetOnly, "build only target binaries, not host")
+
+- xflagparse(0)
++ xflagparse(-1)
+
+ if noClean {
+ xprintf("warning: --no-clean is deprecated and has no effect; use 'go install std cmd' instead\n")
+ }
+
++ if hostOnly && targetOnly {
++ fatalf("specify only one of --host-only or --target-only\n")
++ }
++ crossBuild = hostOnly || targetOnly
++ if flag.NArg() > 0 {
++ if crossBuild {
++ toBuild = flag.Args()
++ } else {
++ fatalf("package names not permitted without --host-only or --target-only\n")
++ }
++ }
++
+ // Set GOPATH to an internal directory. We shouldn't actually
+ // need to store files here, since the toolchain won't
+ // depend on modules outside of vendor directories, but if
+@@ -1345,8 +1369,13 @@ func cmdbootstrap() {
+ xprintf("\n")
+ }
+
+- gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now
+- goldflags = os.Getenv("GO_LDFLAGS") // we were using $BOOT_GO_LDFLAGS until now
++ // For split host/target cross/cross-canadian builds, we don't
++ // want to be setting these flags until after we have compiled
++ // the toolchain that runs on the build host.
++ if !crossBuild {
++ gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now
++ goldflags = os.Getenv("GO_LDFLAGS") // we were using $BOOT_GO_LDFLAGS until now
++ }
+ goBootstrap := pathf("%s/go_bootstrap", tooldir)
+ cmdGo := pathf("%s/go", gobin)
+ if debug {
+@@ -1375,7 +1404,11 @@ func cmdbootstrap() {
+ xprintf("\n")
+ }
+ xprintf("Building Go toolchain2 using go_bootstrap and Go toolchain1.\n")
+- os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
++ if crossBuild {
++ os.Setenv("CC", defaultcc[""])
++ } else {
++ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
++ }
+ // Now that cmd/go is in charge of the build process, enable GOEXPERIMENT.
+ os.Setenv("GOEXPERIMENT", goexperiment)
+ goInstall(goBootstrap, append([]string{"-i"}, toolchain...)...)
+@@ -1414,50 +1447,84 @@ func cmdbootstrap() {
+ }
+ checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
+
+- if goos == oldgoos && goarch == oldgoarch {
+- // Common case - not setting up for cross-compilation.
+- timelog("build", "toolchain")
+- if vflag > 0 {
+- xprintf("\n")
++ if crossBuild {
++ gogcflags = os.Getenv("GO_GCFLAGS")
++ goldflags = os.Getenv("GO_LDFLAGS")
++ tool_files, _ := filepath.Glob(pathf("%s/*", tooldir))
++ for _, f := range tool_files {
++ copyfile(pathf("%s/%s", build_tooldir, filepath.Base(f)), f, writeExec)
++ xremove(f)
++ }
++ os.Setenv("GOTOOLDIR", build_tooldir)
++ goBootstrap = pathf("%s/go_bootstrap", build_tooldir)
++ if hostOnly {
++ timelog("build", "host toolchain")
++ if vflag > 0 {
++ xprintf("\n")
++ }
++ xprintf("Building %s for host, %s/%s.\n", strings.Join(toBuild, ","), goos, goarch)
++ goInstall(goBootstrap, toBuild...)
++ checkNotStale(goBootstrap, toBuild...)
++ // Skip cmdGo staleness checks here, since we can't necessarily run the cmdGo binary
++
++ timelog("build", "target toolchain")
++ if vflag > 0 {
++ xprintf("\n")
++ }
++ } else if targetOnly {
++ goos = oldgoos
++ goarch = oldgoarch
++ os.Setenv("GOOS", goos)
++ os.Setenv("GOARCH", goarch)
++ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
++ xprintf("Building %s for target, %s/%s.\n", strings.Join(toBuild, ","), goos, goarch)
++ goInstall(goBootstrap, toBuild...)
++ checkNotStale(goBootstrap, toBuild...)
++ // Skip cmdGo staleness checks here, since we can't run the target's cmdGo binary
+ }
+- xprintf("Building packages and commands for %s/%s.\n", goos, goarch)
+ } else {
+- // GOOS/GOARCH does not match GOHOSTOS/GOHOSTARCH.
+- // Finish GOHOSTOS/GOHOSTARCH installation and then
+- // run GOOS/GOARCH installation.
+- timelog("build", "host toolchain")
+- if vflag > 0 {
+- xprintf("\n")
+- }
+- xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch)
++
++ if goos == oldgoos && goarch == oldgoarch {
++ // Common case - not setting up for cross-compilation.
++ timelog("build", "toolchain")
++ if vflag > 0 {
++ xprintf("\n")
++ }
++ xprintf("Building packages and commands for %s/%s.\n", goos, goarch)
++ } else {
++ // GOOS/GOARCH does not match GOHOSTOS/GOHOSTARCH.
++ // Finish GOHOSTOS/GOHOSTARCH installation and then
++ // run GOOS/GOARCH installation.
++ timelog("build", "host toolchain")
++ if vflag > 0 {
++ xprintf("\n")
++ }
++ xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch)
++ goInstall(goBootstrap, "std", "cmd")
++ checkNotStale(goBootstrap, "std", "cmd")
++ checkNotStale(cmdGo, "std", "cmd")
++
++ timelog("build", "target toolchain")
++ if vflag > 0 {
++ xprintf("\n")
++ }
++ goos = oldgoos
++ goarch = oldgoarch
++ os.Setenv("GOOS", goos)
++ os.Setenv("GOARCH", goarch)
++ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
++ xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch)
++ }
+ goInstall(goBootstrap, "std", "cmd")
+ checkNotStale(goBootstrap, "std", "cmd")
+ checkNotStale(cmdGo, "std", "cmd")
+
+- timelog("build", "target toolchain")
+- if vflag > 0 {
+- xprintf("\n")
++ if debug {
++ run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
++ run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
++ checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
++ copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec)
+ }
+- goos = oldgoos
+- goarch = oldgoarch
+- os.Setenv("GOOS", goos)
+- os.Setenv("GOARCH", goarch)
+- os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
+- xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch)
+- }
+- targets := []string{"std", "cmd"}
+- if goos == "js" && goarch == "wasm" {
+- // Skip the cmd tools for js/wasm. They're not usable.
+- targets = targets[:1]
+- }
+- goInstall(goBootstrap, targets...)
+- checkNotStale(goBootstrap, targets...)
+- checkNotStale(cmdGo, targets...)
+- if debug {
+- run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
+- run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
+- checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
+- copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec)
+ }
+
+ // Check that there are no new files in $GOROOT/bin other than
+@@ -1474,8 +1541,11 @@ func cmdbootstrap() {
+ }
+ }
+
+- // Remove go_bootstrap now that we're done.
+- xremove(pathf("%s/go_bootstrap", tooldir))
++ // Except that for split host/target cross-builds, we need to
++ // keep it.
++ if !crossBuild {
++ xremove(pathf("%s/go_bootstrap", tooldir))
++ }
+
+ if goos == "android" {
+ // Make sure the exec wrapper will sync a fresh $GOROOT to the device.
diff --git a/recipes-devtools/go-1.17/go-1.17/0007-cmd-go-make-GOROOT-precious-by-default.patch b/recipes-devtools/go-1.17/go-1.17/0007-cmd-go-make-GOROOT-precious-by-default.patch
new file mode 100644
index 0000000..4b4d0d4
--- /dev/null
+++ b/recipes-devtools/go-1.17/go-1.17/0007-cmd-go-make-GOROOT-precious-by-default.patch
@@ -0,0 +1,104 @@
+From 9ba507e076c744f4d394418e4a849e68cd426a4a Mon Sep 17 00:00:00 2001
+From: Alex Kube <alexander.j.kube@...>
+Date: Wed, 23 Oct 2019 21:18:56 +0430
+Subject: [PATCH 7/9] cmd/go: make GOROOT precious by default
+
+Upstream-Status: Inappropriate [OE specific]
+
+The go build tool normally rebuilds whatever it detects is
+stale. This can be a problem when GOROOT is intended to
+be read-only and the go runtime has been built as a shared
+library, since we don't want every application to be rebuilding
+the shared runtime - particularly in cross-build/packaging
+setups, since that would lead to 'abi mismatch' runtime errors.
+
+This patch prevents the install and linkshared actions from
+installing to GOROOT unless overridden with the GOROOT_OVERRIDE
+environment variable.
+
+Adapted to Go 1.13 from patches originally submitted to
+the meta/recipes-devtools/go tree by
+Matt Madison <matt@...>.
+
+Signed-off-by: Alexander J Kube <alexander.j.kube@...>
+---
+ src/cmd/go/internal/work/action.go | 3 +++
+ src/cmd/go/internal/work/build.go | 6 ++++++
+ src/cmd/go/internal/work/exec.go | 25 +++++++++++++++++++++++++
+ 3 files changed, 34 insertions(+)
+
+--- a/src/cmd/go/internal/work/action.go
++++ b/src/cmd/go/internal/work/action.go
+@@ -670,6 +670,9 @@ func (b *Builder) addTransitiveLinkDeps(
+ if p1 == nil || p1.Shlib == "" || haveShlib[filepath.Base(p1.Shlib)] {
+ continue
+ }
++ if goRootPrecious && (p1.Standard || p1.Goroot) {
++ continue
++ }
+ haveShlib[filepath.Base(p1.Shlib)] = true
+ // TODO(rsc): The use of ModeInstall here is suspect, but if we only do ModeBuild,
+ // we'll end up building an overall library or executable that depends at runtime
+--- a/src/cmd/go/internal/work/build.go
++++ b/src/cmd/go/internal/work/build.go
+@@ -167,6 +167,8 @@ See also: go install, go get, go clean.
+
+ const concurrentGCBackendCompilationEnabledByDefault = true
+
++var goRootPrecious bool = true
++
+ func init() {
+ // break init cycle
+ CmdBuild.Run = runBuild
+@@ -179,6 +181,10 @@ func init() {
+
+ AddBuildFlags(CmdBuild, DefaultBuildFlags)
+ AddBuildFlags(CmdInstall, DefaultBuildFlags)
++
++ if x := os.Getenv("GOROOT_OVERRIDE"); x != "" {
++ goRootPrecious = false
++ }
+ }
+
+ // Note that flags consulted by other parts of the code
+--- a/src/cmd/go/internal/work/exec.go
++++ b/src/cmd/go/internal/work/exec.go
+@@ -468,6 +468,23 @@ func (b *Builder) build(a *Action) (err
+ return errors.New("binary-only packages are no longer supported")
+ }
+
++ if goRootPrecious && (a.Package.Standard || a.Package.Goroot) {
++ _, err := os.Stat(a.Package.Target)
++ if err == nil {
++ a.built = a.Package.Target
++ a.Target = a.Package.Target
++ a.buildID = b.fileHash(a.Package.Target)
++ a.Package.Stale = false
++ a.Package.StaleReason = "GOROOT-resident package"
++ return nil
++ }
++ a.Package.Stale = true
++ a.Package.StaleReason = "missing or invalid GOROOT-resident package"
++ if b.IsCmdList {
++ return nil
++ }
++ }
++
+ if err := b.Mkdir(a.Objdir); err != nil {
+ return err
+ }
+@@ -1520,6 +1537,14 @@ func BuildInstallFunc(b *Builder, a *Act
+ return err
+ }
+
++ if goRootPrecious && a.Package != nil {
++ p := a.Package
++ if p.Standard || p.Goroot {
++ err := fmt.Errorf("attempting to install package %s into read-only GOROOT", p.ImportPath)
++ return err
++ }
++ }
++
+ if err := b.Mkdir(a.Objdir); err != nil {
+ return err
+ }
diff --git a/recipes-devtools/go-1.17/go-1.17/0008-use-GOBUILDMODE-to-set-buildmode.patch b/recipes-devtools/go-1.17/go-1.17/0008-use-GOBUILDMODE-to-set-buildmode.patch
new file mode 100644
index 0000000..4e5d502
--- /dev/null
+++ b/recipes-devtools/go-1.17/go-1.17/0008-use-GOBUILDMODE-to-set-buildmode.patch
@@ -0,0 +1,42 @@
+From 971b5626339ce0c4d57f9721c9a81af566c5a044 Mon Sep 17 00:00:00 2001
+From: Alex Kube <alexander.j.kube@...>
+Date: Wed, 23 Oct 2019 21:19:26 +0430
+Subject: [PATCH 8/9] cmd/go: Use GOBUILDMODE to set buildmode
+
+Upstream-Status: Denied [upstream choose antoher solution: `17a256b
+cmd/go: -buildmode=pie for android/arm']
+
+While building go itself, the go build system does not support
+to set `-buildmode=pie' from environment.
+
+Add GOBUILDMODE to support it which make PIE executables the default
+build mode, as PIE executables are required as of Yocto
+
+Refers: https://groups.google.com/forum/#!topic/golang-dev/gRCe5URKewI
+
+Adapted to Go 1.13 from patches originally submitted to
+the meta/recipes-devtools/go tree by
+Hongxu Jia <hongxu.jia@...>
+
+Signed-off-by: Alexander J Kube <alexander.j.kube@...>
+---
+ src/cmd/go/internal/work/build.go | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+--- a/src/cmd/go/internal/work/build.go
++++ b/src/cmd/go/internal/work/build.go
+@@ -254,7 +254,13 @@ func AddBuildFlags(cmd *base.Command, ma
+
+ cmd.Flag.Var(&load.BuildAsmflags, "asmflags", "")
+ cmd.Flag.Var(buildCompiler{}, "compiler", "")
+- cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", "default", "")
++
++ if bm := os.Getenv("GOBUILDMODE"); bm != "" {
++ cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", bm, "")
++ } else {
++ cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", "default", "")
++ }
++
+ cmd.Flag.Var(&load.BuildGcflags, "gcflags", "")
+ cmd.Flag.Var(&load.BuildGccgoflags, "gccgoflags", "")
+ if mask&OmitModFlag == 0 {
diff --git a/recipes-devtools/go-1.17/go-1.17/0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch b/recipes-devtools/go-1.17/go-1.17/0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch
new file mode 100644
index 0000000..f857b72
--- /dev/null
+++ b/recipes-devtools/go-1.17/go-1.17/0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch
@@ -0,0 +1,94 @@
+From 66a45dae3af140662e17ef85c2e6fe40270a2553 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@...>
+Date: Mon, 22 Feb 2021 17:54:01 -0800
+Subject: [PATCH] Revert "cmd/go: make sure CC and CXX are absolute"
+
+OE uses CC/CXX values which consists of cmpiler and options together,
+secondly, the environment is canned so this check add little value to OE
+based builds
+
+Fixes go-runtime build issues
+
+go install: CXX environment variable is relative; must be absolute path: powerpc64le-yoe-linux-musl-g++ -mlittle-endian -mhard-float -m64 -mabi=elfv2 -mcpu=power9 -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/mnt/b/yoe/master/build/tmp/work/ppc64p9le-yoe-linux-musl/go/1.16-r0/recipe-sysroot
+
+This reverts commit aa161e799df7e1eba99d2be10271e76b6f758142.
+
+Upstream-Status: Inappropriate [OE-Specific]
+Signed-off-by: Khem Raj <raj.khem@...>
+---
+ src/cmd/go/internal/envcmd/env.go | 5 -----
+ src/cmd/go/internal/work/init.go | 6 ------
+ src/cmd/go/testdata/script/env_write.txt | 24 ------------------------
+ 3 files changed, 35 deletions(-)
+
+diff --git a/src/cmd/go/internal/envcmd/env.go b/src/cmd/go/internal/envcmd/env.go
+index ff6f0d8..43b94e7 100644
+--- a/src/cmd/go/internal/envcmd/env.go
++++ b/src/cmd/go/internal/envcmd/env.go
+@@ -457,11 +457,6 @@ func checkEnvWrite(key, val string) error {
+ if !filepath.IsAbs(val) && val != "" {
+ return fmt.Errorf("GOPATH entry is relative; must be absolute path: %q", val)
+ }
+- // Make sure CC and CXX are absolute paths
+- case "CC", "CXX", "GOMODCACHE":
+- if !filepath.IsAbs(val) && val != "" && val != filepath.Base(val) {
+- return fmt.Errorf("%s entry is relative; must be absolute path: %q", key, val)
+- }
+ }
+
+ if !utf8.ValidString(val) {
+diff --git a/src/cmd/go/internal/work/init.go b/src/cmd/go/internal/work/init.go
+index 37a3e2d..316b0cf 100644
+--- a/src/cmd/go/internal/work/init.go
++++ b/src/cmd/go/internal/work/init.go
+@@ -39,12 +39,6 @@ func BuildInit() {
+ cfg.BuildPkgdir = p
+ }
+
+- // Make sure CC and CXX are absolute paths
+- for _, key := range []string{"CC", "CXX"} {
+- if path := cfg.Getenv(key); !filepath.IsAbs(path) && path != "" && path != filepath.Base(path) {
+- base.Fatalf("go %s: %s environment variable is relative; must be absolute path: %s\n", flag.Args()[0], key, path)
+- }
+- }
+ }
+
+ func instrumentInit() {
+diff --git a/src/cmd/go/testdata/script/env_write.txt b/src/cmd/go/testdata/script/env_write.txt
+index b5e9739..566c876 100644
+--- a/src/cmd/go/testdata/script/env_write.txt
++++ b/src/cmd/go/testdata/script/env_write.txt
+@@ -129,30 +129,6 @@ go env -w GOTMPDIR=
+ go env GOTMPDIR
+ stdout ^$
+
+-# go env -w rejects relative CC values
+-[!windows] go env -w CC=/usr/bin/clang
+-go env -w CC=clang
+-[!windows] ! go env -w CC=./clang
+-[!windows] ! go env -w CC=bin/clang
+-[!windows] stderr 'go env -w: CC entry is relative; must be absolute path'
+-
+-[windows] go env -w CC=$WORK\bin\clang
+-[windows] ! go env -w CC=.\clang
+-[windows] ! go env -w CC=bin\clang
+-[windows] stderr 'go env -w: CC entry is relative; must be absolute path'
+-
+-# go env -w rejects relative CXX values
+-[!windows] go env -w CC=/usr/bin/cpp
+-go env -w CXX=cpp
+-[!windows] ! go env -w CXX=./cpp
+-[!windows] ! go env -w CXX=bin/cpp
+-[!windows] stderr 'go env -w: CXX entry is relative; must be absolute path'
+-
+-[windows] go env -w CXX=$WORK\bin\cpp
+-[windows] ! go env -w CXX=.\cpp
+-[windows] ! go env -w CXX=bin\cpp
+-[windows] stderr 'go env -w: CXX entry is relative; must be absolute path'
+-
+ # go env -w/-u checks validity of GOOS/ARCH combinations
+ env GOOS=
+ env GOARCH=
+--
+2.20.1
+
diff --git a/recipes-devtools/go-1.17/go-binary-native_1.17.4.bb b/recipes-devtools/go-1.17/go-binary-native_1.17.4.bb
new file mode 100644
index 0000000..8d8142c
--- /dev/null
+++ b/recipes-devtools/go-1.17/go-binary-native_1.17.4.bb
@@ -0,0 +1,46 @@
+# This recipe is for bootstrapping our go-cross from a prebuilt binary of Go from golang.org.
+
+SUMMARY = "Go programming language compiler (upstream binary for bootstrap)"
+HOMEPAGE = " http://golang.org/"
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"
+
+PROVIDES = "go-native"
+
+SRC_URI = "https://dl.google.com/go/go${PV}.${BUILD_GOOS}-${BUILD_GOARCH}.tar.gz;name=go_${BUILD_GOTUPLE}"
+SRC_URI[go_linux_amd64.sha256sum] = "adab2483f644e2f8a10ae93122f0018cef525ca48d0b8764dae87cb5f4fd4206"
+SRC_URI[go_linux_arm64.sha256sum] = "617a46bd083e59877bb5680998571b3ddd4f6dcdaf9f8bf65ad4edc8f3eafb13"
+
+UPSTREAM_CHECK_URI = "https://golang.org/dl/"
+UPSTREAM_CHECK_REGEX = "go(?P<pver>\d+(\.\d+)+)\.linux"
+
+S = "${WORKDIR}/go"
+
+inherit goarch native
+
+do_compile() {
+ :
+}
+
+make_wrapper() {
+ rm -f ${D}${bindir}/$1
+ cat <<END >${D}${bindir}/$1
+#!/bin/bash
+here=\`dirname \$0\`
+export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}"
+\$here/../lib/go/bin/$1 "\$@"
+END
+ chmod +x ${D}${bindir}/$1
+}
+
+do_install() {
+ find ${S} -depth -type d -name testdata -exec rm -rf {} +
+
+ install -d ${D}${bindir} ${D}${libdir}/go
+ cp --preserve=mode,timestamps -R ${S}/ ${D}${libdir}/
+
+ for f in ${S}/bin/*
+ do
+ make_wrapper `basename $f`
+ done
+}
diff --git a/recipes-devtools/go-1.17/go-common.inc b/recipes-devtools/go-1.17/go-common.inc
new file mode 100644
index 0000000..dfccebd
--- /dev/null
+++ b/recipes-devtools/go-1.17/go-common.inc
@@ -0,0 +1,42 @@
+SUMMARY = "Go programming language compiler"
+DESCRIPTION = " The Go programming language is an open source project to make \
+ programmers more productive. Go is expressive, concise, clean, and\
+ efficient. Its concurrency mechanisms make it easy to write programs\
+ that get the most out of multicore and networked machines, while its\
+ novel type system enables flexible and modular program construction.\
+ Go compiles quickly to machine code yet has the convenience of\
+ garbage collection and the power of run-time reflection. It's a\
+ fast, statically typed, compiled language that feels like a\
+ dynamically typed, interpreted language."
+
+HOMEPAGE = " http://golang.org/"
+LICENSE = "BSD-3-Clause"
+
+inherit goarch
+
+SRC_URI = "https://golang.org/dl/go${PV}.src.tar.gz;name=main"
+S = "${WORKDIR}/go"
+B = "${S}"
+UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)\.src\.tar"
+
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+SSTATE_SCAN_CMD = "true"
+
+export GOROOT_OVERRIDE = "1"
+export GOTMPDIR ?= "${WORKDIR}/go-tmp"
+GOTMPDIR[vardepvalue] = ""
+export CGO_ENABLED = "1"
+
+export GOHOSTOS ?= "${BUILD_GOOS}"
+export GOHOSTARCH ?= "${BUILD_GOARCH}"
+export GOROOT_BOOTSTRAP ?= "${STAGING_LIBDIR_NATIVE}/go"
+export GOOS ?= "${TARGET_GOOS}"
+export GOARCH ?= "${TARGET_GOARCH}"
+export GOARM ?= "${TARGET_GOARM}"
+export GO386 ?= "${TARGET_GO386}"
+export GOMIPS ?= "${TARGET_GOMIPS}"
+export GOROOT_FINAL ?= "${libdir}/go"
+
+do_compile:prepend() {
+ BUILD_CC=${BUILD_CC}
+}
diff --git a/recipes-devtools/go-1.17/go-cross-canadian.inc b/recipes-devtools/go-1.17/go-cross-canadian.inc
new file mode 100644
index 0000000..d49250a
--- /dev/null
+++ b/recipes-devtools/go-1.17/go-cross-canadian.inc
@@ -0,0 +1,62 @@
+inherit cross-canadian
+
+DEPENDS = "go-native virtual/${HOST_PREFIX}go-crosssdk virtual/nativesdk-${HOST_PREFIX}go-runtime \
+ virtual/${HOST_PREFIX}gcc-crosssdk virtual/nativesdk-libc \
+ virtual/nativesdk-${HOST_PREFIX}compilerlibs"
+PN = "go-cross-canadian-${TRANSLATED_TARGET_ARCH}"
+
+# it uses gcc on build machine during go-cross-canadian bootstrap, but
+# the gcc version may be old and not support option '-fmacro-prefix-map'
+# which is one of default values of DEBUG_PREFIX_MAP
+DEBUG_PREFIX_MAP = "-fdebug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
+ -fdebug-prefix-map=${STAGING_DIR_HOST}= \
+ -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
+ "
+
+export GOTOOLDIR_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/${HOST_SYS}/go/pkg/tool/${BUILD_GOTUPLE}"
+export CGO_CFLAGS = "${CFLAGS}"
+export CGO_LDFLAGS = "${LDFLAGS}"
+export GO_LDFLAGS = '-linkmode external -extld ${HOST_PREFIX}gcc -extldflags "--sysroot=${STAGING_DIR_HOST} ${SECURITY_NOPIE_CFLAGS} ${HOST_CC_ARCH} ${LDFLAGS}"'
+
+do_configure[noexec] = "1"
+
+do_compile() {
+ export CC_FOR_${HOST_GOTUPLE}="${HOST_PREFIX}gcc --sysroot=${STAGING_DIR_HOST}${SDKPATHNATIVE} ${SECURITY_NOPIE_CFLAGS}"
+ export CXX_FOR_${HOST_GOTUPLE}="${HOST_PREFIX}gxx --sysroot=${STAGING_DIR_HOST}${SDKPATHNATIVE} ${SECURITY_NOPIE_CFLAGS}"
+ 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/sh
+here=\`dirname \$0\`
+native_goroot=\`readlink -f \$here/../../lib/${TARGET_SYS}/go\`
+export GOARCH="${TARGET_GOARCH}"
+export GOOS="${TARGET_GOOS}"
+test -n "\$GOARM" || export GOARM="${TARGET_GOARM}"
+test -n "\$GO386" || export GO386="${TARGET_GO386}"
+test -n "\$GOMIPS" || export GOMIPS="${TARGET_GOMIPS}"
+export GOTOOLDIR="\$native_goroot/pkg/tool/${HOST_GOTUPLE}"
+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/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}/${GO_BUILD_BINDIR}/*
+ do
+ base=`basename $f`
+ install -m755 $f ${D}${libdir}/go/bin
+ make_wrapper $base ${TARGET_PREFIX}$base
+ done
+}
diff --git a/recipes-devtools/go-1.17/go-cross-canadian_1.17.4.bb b/recipes-devtools/go-1.17/go-cross-canadian_1.17.4.bb
new file mode 100644
index 0000000..7ac9449
--- /dev/null
+++ b/recipes-devtools/go-1.17/go-cross-canadian_1.17.4.bb
@@ -0,0 +1,2 @@
+require go-cross-canadian.inc
+require go-${PV}.inc
diff --git a/recipes-devtools/go-1.17/go-cross.inc b/recipes-devtools/go-1.17/go-cross.inc
new file mode 100644
index 0000000..3d5803b
--- /dev/null
+++ b/recipes-devtools/go-1.17/go-cross.inc
@@ -0,0 +1,53 @@
+inherit cross
+
+PROVIDES = "virtual/${TUNE_PKGARCH}-go"
+DEPENDS = "go-native"
+
+PN = "go-cross-${TUNE_PKGARCH}"
+
+export GOCACHE = "${B}/.cache"
+CC = "${@d.getVar('BUILD_CC').strip()}"
+
+do_configure[noexec] = "1"
+
+do_compile() {
+ export CC_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
+ export CXX_FOR_${TARGET_GOTUPLE}="${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}}"
+export GOMIPS="\${GOMIPS:-${TARGET_GOMIPS}}"
+\$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
+}
diff --git a/recipes-devtools/go-1.17/go-cross_1.17.4.bb b/recipes-devtools/go-1.17/go-cross_1.17.4.bb
new file mode 100644
index 0000000..80b5a03
--- /dev/null
+++ b/recipes-devtools/go-1.17/go-cross_1.17.4.bb
@@ -0,0 +1,2 @@
+require go-cross.inc
+require go-${PV}.inc
diff --git a/recipes-devtools/go-1.17/go-crosssdk.inc b/recipes-devtools/go-1.17/go-crosssdk.inc
new file mode 100644
index 0000000..f0bec79
--- /dev/null
+++ b/recipes-devtools/go-1.17/go-crosssdk.inc
@@ -0,0 +1,43 @@
+inherit crosssdk
+
+DEPENDS = "go-native virtual/${TARGET_PREFIX}gcc-crosssdk virtual/nativesdk-${TARGET_PREFIX}compilerlibs virtual/${TARGET_PREFIX}binutils-crosssdk"
+PN = "go-crosssdk-${SDK_SYS}"
+PROVIDES = "virtual/${TARGET_PREFIX}go-crosssdk"
+
+do_configure[noexec] = "1"
+
+do_compile() {
+ export CC_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}"
+ export CXX_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}"
+ 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}"
+\$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@"
+END
+ chmod +x ${D}${bindir}/$2
+}
+
+do_install() {
+ install -d ${D}${libdir}/go
+ install -d ${D}${libdir}/go/bin
+ install -d ${D}${libdir}/go/pkg/tool
+ install -d ${D}${bindir}
+ cp --preserve=mode,timestamps -R ${S}/pkg/tool/${BUILD_GOTUPLE} ${D}${libdir}/go/pkg/tool/
+ for f in ${B}/bin/*
+ do
+ base=`basename $f`
+ install -m755 $f ${D}${libdir}/go/bin
+ make_wrapper $base ${TARGET_PREFIX}$base
+ done
+}
diff --git a/recipes-devtools/go-1.17/go-crosssdk_1.17.4.bb b/recipes-devtools/go-1.17/go-crosssdk_1.17.4.bb
new file mode 100644
index 0000000..1857c8a
--- /dev/null
+++ b/recipes-devtools/go-1.17/go-crosssdk_1.17.4.bb
@@ -0,0 +1,2 @@
+require go-crosssdk.inc
+require go-${PV}.inc
diff --git a/recipes-devtools/go-1.17/go-native_1.17.4.bb b/recipes-devtools/go-1.17/go-native_1.17.4.bb
new file mode 100644
index 0000000..ffe4ef3
--- /dev/null
+++ b/recipes-devtools/go-1.17/go-native_1.17.4.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
+}
diff --git a/recipes-devtools/go-1.17/go-runtime.inc b/recipes-devtools/go-1.17/go-runtime.inc
new file mode 100644
index 0000000..617e6b5
--- /dev/null
+++ b/recipes-devtools/go-1.17/go-runtime.inc
@@ -0,0 +1,87 @@
+DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
+DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk"
+PROVIDES = "virtual/${TARGET_PREFIX}go-runtime"
+
+export CGO_CFLAGS = "${CFLAGS}"
+export CGO_CPPFLAGS = "${CPPFLAGS}"
+export CGO_CXXFLAGS = "${CXXFLAGS}"
+export CGO_LDFLAGS = "${LDFLAGS}"
+export GOCACHE = "${B}/.cache"
+
+GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS}"
+GO_SHLIB_LDFLAGS ?= '-ldflags="--linkmode=external -extldflags '${GO_EXTLDFLAGS}'"'
+
+do_configure() {
+ :
+}
+
+do_configure:libc-musl() {
+ rm -f ${S}/src/runtime/race/*.syso
+}
+
+do_compile() {
+ export CC_FOR_${TARGET_GOTUPLE}="${CC}"
+ export CXX_FOR_${TARGET_GOTUPLE}="${CXX}"
+
+ cd src
+ ./make.bash --target-only --no-banner std
+ if [ -n "${GO_DYNLINK}" ]; then
+ export GOTOOLDIR="${B}/pkg/tool/native_native"
+ CC="$CC_FOR_${TARGET_GOTUPLE}" GOARCH="${TARGET_GOARCH}" GOOS="${TARGET_GOOS}" GOROOT=${B} \
+ $GOTOOLDIR/go_bootstrap install -linkshared -buildmode=shared ${GO_SHLIB_LDFLAGS} std
+ fi
+ cd ${B}
+}
+do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg"
+do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
+
+do_install() {
+ install -d ${D}${libdir}/go/src
+ cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
+ if [ "${BUILD_GOTUPLE}" != "${TARGET_GOTUPLE}" ]; then
+ rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE}
+ rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE}
+ fi
+ rm -rf ${D}${libdir}/go/pkg/tool
+ rm -rf ${D}${libdir}/go/pkg/obj
+ rm -rf ${D}${libdir}/go/pkg/bootstrap
+ find src -mindepth 1 -maxdepth 1 -type d | while read srcdir; do
+ cp --preserve=mode,timestamps -R $srcdir ${D}${libdir}/go/src/
+ done
+ find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \;
+ rm -f ${D}${libdir}/go/src/cmd/dist/dist
+ rm -f ${D}${libdir}/go/src/cmd/cgo/zdefaultcc.go
+ rm -f ${D}${libdir}/go/src/cmd/go/internal/cfg/zdefaultcc.go
+
+}
+
+ALLOW_EMPTY:${PN} = "1"
+FILES:${PN} = "${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*${SOLIBSDEV}"
+FILES:${PN}-dev = "${libdir}/go/src ${libdir}/go/pkg/include \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*.shlibname \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*.shlibname \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*.shlibname \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*.shlibname \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*.shlibname \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*.shlibname \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*/*.shlibname \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*.a \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*.a \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*.a \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*.a \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*.a \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*.a \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*/*.a \
+"
+FILES:${PN}-staticdev = "${libdir}/go/pkg/${TARGET_GOTUPLE}"
+
+# Go sources include some scripts and pre-built binaries for
+# multiple architectures. The static .a files for dynamically-linked
+# runtime are also required in -dev.
+INSANE_SKIP:${PN}-dev = "staticdev file-rdeps arch"
+
+INHIBIT_PACKAGE_STRIP = "1"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+INHIBIT_SYSROOT_STRIP = "1"
+
+BBCLASSEXTEND = "nativesdk"
diff --git a/recipes-devtools/go-1.17/go-runtime_1.17.4.bb b/recipes-devtools/go-1.17/go-runtime_1.17.4.bb
new file mode 100644
index 0000000..63464a1
--- /dev/null
+++ b/recipes-devtools/go-1.17/go-runtime_1.17.4.bb
@@ -0,0 +1,3 @@
+require go-${PV}.inc
+require go-runtime.inc
+
diff --git a/recipes-devtools/go-1.17/go-target.inc b/recipes-devtools/go-1.17/go-target.inc
new file mode 100644
index 0000000..47b4411
--- /dev/null
+++ b/recipes-devtools/go-1.17/go-target.inc
@@ -0,0 +1,45 @@
+DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
+DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk go-native"
+
+export GOCACHE = "${B}/.cache"
+GO_LDFLAGS = ""
+GO_LDFLAGS:class-nativesdk = "-linkmode external"
+export GO_LDFLAGS
+
+CC:append:class-nativesdk = " ${SECURITY_NOPIE_CFLAGS}"
+
+do_configure[noexec] = "1"
+
+do_compile() {
+ export CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CC}"
+ export CXX_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CXX}"
+
+ cd src
+ ./make.bash --target-only --no-banner
+ cd ${B}
+}
+do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg"
+do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
+
+do_install() {
+ install -d ${D}${libdir}/go/pkg/tool
+ cp --preserve=mode,timestamps -R ${B}/pkg/tool/${TARGET_GOTUPLE} ${D}${libdir}/go/pkg/tool/
+ install -d ${D}${libdir}/go/src
+ cp --preserve=mode,timestamps -R ${S}/src/cmd ${D}${libdir}/go/src/
+ find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \;
+ install -d ${D}${libdir}/go/bin
+ install -d ${D}${bindir}
+ for f in ${B}/${GO_BUILD_BINDIR}/*; do
+ name=`basename $f`
+ install -m 0755 $f ${D}${libdir}/go/bin/
+ ln -sf ../${baselib}/go/bin/$name ${D}${bindir}/
+ done
+ rm -rf ${D}${libdir}/go/src
+}
+
+PACKAGES = "${PN} ${PN}-dev"
+FILES:${PN} = "${libdir}/go/bin ${libdir}/go/pkg/tool/${TARGET_GOTUPLE} ${bindir}"
+RDEPENDS:${PN} = "go-runtime"
+INSANE_SKIP:${PN} = "ldflags"
+
+BBCLASSEXTEND = "nativesdk"
diff --git a/recipes-devtools/go-1.17/go_1.17.4.bb b/recipes-devtools/go-1.17/go_1.17.4.bb
new file mode 100644
index 0000000..34dc89b
--- /dev/null
+++ b/recipes-devtools/go-1.17/go_1.17.4.bb
@@ -0,0 +1,17 @@
+require go-${PV}.inc
+require go-target.inc
+
+inherit linuxloader
+
+export GOBUILDMODE=""
+export GO_LDSO = "${@get_linuxloader(d)}"
+export CC_FOR_TARGET = "gcc"
+export CXX_FOR_TARGET = "g++"
+
+# mips/rv64 doesn't support -buildmode=pie, so skip the QA checking for mips/riscv32 and its
+# variants.
+python() {
+ if 'mips' in d.getVar('TARGET_ARCH',True) or 'riscv32' in d.getVar('TARGET_ARCH',True):
+ d.appendVar('INSANE_SKIP:%s' % d.getVar('PN',True), " textrel")
+}
+
--
2.20.1


[meta-lts-mixins][dunfell/go PATCH 2/4] go-1.16: import recipes from openembedded-core

Alexander Kanavin
 

This is a verbatim copy of go 1.16 recipes from oe-core master
just before they were updated to 1.17.

Link: https://git.yoctoproject.org/poky/tree/meta/recipes-devtools/go?id=6f092174b338066e5ac767312a914d00310690a1

(copy from external source:
git: https://git.yoctoproject.org/poky/
archive: 6f092174b338066e5ac767312a914d00310690a1
copy: meta/recipes-devtools/go --> recipes-devtools/go-1.16)

Acked-by: Martin Kaistra <martin.kaistra@...>
Signed-off-by: Alexander Kanavin <alex@...>
---
recipes-devtools/go-1.16/go-1.16.10.inc | 25 ++
...ow-CC-and-CXX-to-have-multiple-words.patch | 33 +++
...ent-based-hash-generation-less-pedan.patch | 219 ++++++++++++++
...-to-be-overridden-in-the-environment.patch | 47 +++
...4-ld-add-soname-to-shareable-objects.patch | 45 +++
...de-CC-when-building-dist-and-go_boot.patch | 39 +++
...dist-separate-host-and-target-builds.patch | 274 ++++++++++++++++++
...d-go-make-GOROOT-precious-by-default.patch | 104 +++++++
...008-use-GOBUILDMODE-to-set-buildmode.patch | 42 +++
...go-make-sure-CC-and-CXX-are-absolute.patch | 95 ++++++
.../go-1.16/go-binary-native_1.16.10.bb | 46 +++
recipes-devtools/go-1.16/go-common.inc | 42 +++
.../go-1.16/go-cross-canadian.inc | 62 ++++
.../go-1.16/go-cross-canadian_1.16.10.bb | 2 +
recipes-devtools/go-1.16/go-cross.inc | 53 ++++
recipes-devtools/go-1.16/go-cross_1.16.10.bb | 2 +
recipes-devtools/go-1.16/go-crosssdk.inc | 43 +++
.../go-1.16/go-crosssdk_1.16.10.bb | 2 +
recipes-devtools/go-1.16/go-native_1.16.10.bb | 59 ++++
recipes-devtools/go-1.16/go-runtime.inc | 87 ++++++
.../go-1.16/go-runtime_1.16.10.bb | 3 +
recipes-devtools/go-1.16/go-target.inc | 45 +++
recipes-devtools/go-1.16/go_1.16.10.bb | 17 ++
23 files changed, 1386 insertions(+)
create mode 100644 recipes-devtools/go-1.16/go-1.16.10.inc
create mode 100644 recipes-devtools/go-1.16/go-1.16/0001-allow-CC-and-CXX-to-have-multiple-words.patch
create mode 100644 recipes-devtools/go-1.16/go-1.16/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch
create mode 100644 recipes-devtools/go-1.16/go-1.16/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch
create mode 100644 recipes-devtools/go-1.16/go-1.16/0004-ld-add-soname-to-shareable-objects.patch
create mode 100644 recipes-devtools/go-1.16/go-1.16/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch
create mode 100644 recipes-devtools/go-1.16/go-1.16/0006-cmd-dist-separate-host-and-target-builds.patch
create mode 100644 recipes-devtools/go-1.16/go-1.16/0007-cmd-go-make-GOROOT-precious-by-default.patch
create mode 100644 recipes-devtools/go-1.16/go-1.16/0008-use-GOBUILDMODE-to-set-buildmode.patch
create mode 100644 recipes-devtools/go-1.16/go-1.16/0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch
create mode 100644 recipes-devtools/go-1.16/go-binary-native_1.16.10.bb
create mode 100644 recipes-devtools/go-1.16/go-common.inc
create mode 100644 recipes-devtools/go-1.16/go-cross-canadian.inc
create mode 100644 recipes-devtools/go-1.16/go-cross-canadian_1.16.10.bb
create mode 100644 recipes-devtools/go-1.16/go-cross.inc
create mode 100644 recipes-devtools/go-1.16/go-cross_1.16.10.bb
create mode 100644 recipes-devtools/go-1.16/go-crosssdk.inc
create mode 100644 recipes-devtools/go-1.16/go-crosssdk_1.16.10.bb
create mode 100644 recipes-devtools/go-1.16/go-native_1.16.10.bb
create mode 100644 recipes-devtools/go-1.16/go-runtime.inc
create mode 100644 recipes-devtools/go-1.16/go-runtime_1.16.10.bb
create mode 100644 recipes-devtools/go-1.16/go-target.inc
create mode 100644 recipes-devtools/go-1.16/go_1.16.10.bb

diff --git a/recipes-devtools/go-1.16/go-1.16.10.inc b/recipes-devtools/go-1.16/go-1.16.10.inc
new file mode 100644
index 0000000..7549ffc
--- /dev/null
+++ b/recipes-devtools/go-1.16/go-1.16.10.inc
@@ -0,0 +1,25 @@
+require go-common.inc
+
+GO_BASEVERSION = "1.16"
+PV = "1.16.10"
+FILESEXTRAPATHS:prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:"
+
+LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"
+
+SRC_URI += "\
+ file://0001-allow-CC-and-CXX-to-have-multiple-words.patch \
+ file://0002-cmd-go-make-content-based-hash-generation-less-pedan.patch \
+ file://0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch \
+ file://0004-ld-add-soname-to-shareable-objects.patch \
+ file://0005-make.bash-override-CC-when-building-dist-and-go_boot.patch \
+ file://0006-cmd-dist-separate-host-and-target-builds.patch \
+ file://0007-cmd-go-make-GOROOT-precious-by-default.patch \
+ file://0008-use-GOBUILDMODE-to-set-buildmode.patch \
+ file://0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch \
+"
+SRC_URI[main.sha256sum] = "a905472011585e403d00d2a41de7ced29b8884309d73482a307f689fd0f320b5"
+
+# Upstream don't believe it is a signifiant real world issue and will only
+# fix in 1.17 onwards where we can drop this.
+# https://github.com/golang/go/issues/30999#issuecomment-910470358
+CVE_CHECK_WHITELIST += "CVE-2021-29923"
diff --git a/recipes-devtools/go-1.16/go-1.16/0001-allow-CC-and-CXX-to-have-multiple-words.patch b/recipes-devtools/go-1.16/go-1.16/0001-allow-CC-and-CXX-to-have-multiple-words.patch
new file mode 100644
index 0000000..5f4823b
--- /dev/null
+++ b/recipes-devtools/go-1.16/go-1.16/0001-allow-CC-and-CXX-to-have-multiple-words.patch
@@ -0,0 +1,33 @@
+From 9e3dc44cdfa58d96504d0a789dc82617dd5bef55 Mon Sep 17 00:00:00 2001
+From: Alex Kube <alexander.j.kube@...>
+Date: Wed, 23 Oct 2019 21:01:13 +0430
+Subject: [PATCH 1/9] cmd/go: Allow CC and CXX to have multiple words
+
+Upstream-Status: Inappropriate [OE specific]
+
+Adapted to Go 1.13 from patches originally submitted to
+the meta/recipes-devtools/go tree by
+Matt Madison <matt@...>.
+
+Signed-off-by: Alexander J Kube <alexander.j.kube@...>
+
+---
+ src/cmd/go/internal/envcmd/env.go | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/src/cmd/go/internal/envcmd/env.go
++++ b/src/cmd/go/internal/envcmd/env.go
+@@ -103,11 +103,11 @@ func MkEnv() []cfg.EnvVar {
+
+ cc := cfg.DefaultCC(cfg.Goos, cfg.Goarch)
+ if env := strings.Fields(cfg.Getenv("CC")); len(env) > 0 {
+- cc = env[0]
++ cc = strings.Join(env, " ")
+ }
+ cxx := cfg.DefaultCXX(cfg.Goos, cfg.Goarch)
+ if env := strings.Fields(cfg.Getenv("CXX")); len(env) > 0 {
+- cxx = env[0]
++ cxx = strings.Join(env, " ")
+ }
+ env = append(env, cfg.EnvVar{Name: "AR", Value: envOr("AR", "ar")})
+ env = append(env, cfg.EnvVar{Name: "CC", Value: cc})
diff --git a/recipes-devtools/go-1.16/go-1.16/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch b/recipes-devtools/go-1.16/go-1.16/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch
new file mode 100644
index 0000000..04d0e49
--- /dev/null
+++ b/recipes-devtools/go-1.16/go-1.16/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch
@@ -0,0 +1,219 @@
+From a13ae484e41139094505d2834437e9262a5315f7 Mon Sep 17 00:00:00 2001
+From: Alex Kube <alexander.j.kube@...>
+Date: Wed, 23 Oct 2019 21:14:22 +0430
+Subject: [PATCH 2/9] cmd/go: make content-based hash generation less pedantic
+
+Upstream-Status: Inappropriate [OE specific]
+
+Go 1.10's build tool now uses content-based hashes to
+determine when something should be built or re-built.
+This same mechanism is used to maintain a built-artifact
+cache for speeding up builds.
+
+However, the hashes it generates include information that
+doesn't work well with OE, nor with using a shared runtime
+library.
+
+First, it embeds path names to source files, unless
+building within GOROOT. This prevents the building
+of a package in GOPATH for later staging into GOROOT.
+
+This patch adds support for the environment variable
+GOPATH_OMIT_IN_ACTIONID. If present, path name
+embedding is disabled.
+
+Second, if cgo is enabled, the build ID for cgo-related
+packages will include the current value of the environment
+variables for invoking the compiler (CC, CXX, FC) and
+any CGO_xxFLAGS variables. Only if the settings used
+during a compilation exactly match, character for character,
+the values used for compiling runtime/cgo or any other
+cgo-enabled package being imported, will the tool
+decide that the imported package is up-to-date.
+
+This is done to help ensure correctness, but is overly
+simplistic and effectively prevents the reuse of built
+artifacts that use cgo (or shared runtime, which includes
+runtime/cgo).
+
+This patch filters out all compiler flags except those
+beginning with '-m'. The default behavior can be restored
+by setting the CGO_PEDANTIC environment variable.
+
+Adapted to Go 1.13 from patches originally submitted to
+the meta/recipes-devtools/go tree by
+Matt Madison <matt@...>.
+
+Signed-off-by: Alexander J Kube <alexander.j.kube@...>
+---
+ src/cmd/go/internal/envcmd/env.go | 2 +-
+ src/cmd/go/internal/work/exec.go | 66 ++++++++++++++++++++++---------
+ 2 files changed, 49 insertions(+), 19 deletions(-)
+
+--- a/src/cmd/go/internal/envcmd/env.go
++++ b/src/cmd/go/internal/envcmd/env.go
+@@ -157,7 +157,7 @@ func ExtraEnvVars() []cfg.EnvVar {
+ func ExtraEnvVarsCostly() []cfg.EnvVar {
+ var b work.Builder
+ b.Init()
+- cppflags, cflags, cxxflags, fflags, ldflags, err := b.CFlags(&load.Package{})
++ cppflags, cflags, cxxflags, fflags, ldflags, err := b.CFlags(&load.Package{}, false)
+ if err != nil {
+ // Should not happen - b.CFlags was given an empty package.
+ fmt.Fprintf(os.Stderr, "go: invalid cflags: %v\n", err)
+--- a/src/cmd/go/internal/work/exec.go
++++ b/src/cmd/go/internal/work/exec.go
+@@ -37,6 +37,8 @@ import (
+ "cmd/go/internal/trace"
+ )
+
++var omitGopath = os.Getenv("GOPATH_OMIT_IN_ACTIONID") != ""
++
+ // actionList returns the list of actions in the dag rooted at root
+ // as visited in a depth-first post-order traversal.
+ func actionList(root *Action) []*Action {
+@@ -228,7 +230,7 @@ func (b *Builder) buildActionID(a *Actio
+ // Assume b.WorkDir is being trimmed properly.
+ // When -trimpath is used with a package built from the module cache,
+ // use the module path and version instead of the directory.
+- if !p.Goroot && !cfg.BuildTrimpath && !strings.HasPrefix(p.Dir, b.WorkDir) {
++ if !p.Goroot && !omitGopath && !cfg.BuildTrimpath && !strings.HasPrefix(p.Dir, b.WorkDir) {
+ fmt.Fprintf(h, "dir %s\n", p.Dir)
+ } else if cfg.BuildTrimpath && p.Module != nil {
+ fmt.Fprintf(h, "module %s@%s\n", p.Module.Path, p.Module.Version)
+@@ -247,13 +249,13 @@ func (b *Builder) buildActionID(a *Actio
+ }
+ if len(p.CgoFiles)+len(p.SwigFiles) > 0 {
+ fmt.Fprintf(h, "cgo %q\n", b.toolID("cgo"))
+- cppflags, cflags, cxxflags, fflags, ldflags, _ := b.CFlags(p)
+- fmt.Fprintf(h, "CC=%q %q %q %q\n", b.ccExe(), cppflags, cflags, ldflags)
++ cppflags, cflags, cxxflags, fflags, ldflags, _ := b.CFlags(p, true)
++ fmt.Fprintf(h, "CC=%q %q %q %q\n", b.ccExe(true), cppflags, cflags, ldflags)
+ if len(p.CXXFiles)+len(p.SwigFiles) > 0 {
+- fmt.Fprintf(h, "CXX=%q %q\n", b.cxxExe(), cxxflags)
++ fmt.Fprintf(h, "CXX=%q %q\n", b.cxxExe(true), cxxflags)
+ }
+ if len(p.FFiles) > 0 {
+- fmt.Fprintf(h, "FC=%q %q\n", b.fcExe(), fflags)
++ fmt.Fprintf(h, "FC=%q %q\n", b.fcExe(true), fflags)
+ }
+ // TODO(rsc): Should we include the SWIG version or Fortran/GCC/G++/Objective-C compiler versions?
+ }
+@@ -2401,33 +2403,48 @@ var (
+ // gccCmd returns a gcc command line prefix
+ // defaultCC is defined in zdefaultcc.go, written by cmd/dist.
+ func (b *Builder) GccCmd(incdir, workdir string) []string {
+- return b.compilerCmd(b.ccExe(), incdir, workdir)
++ return b.compilerCmd(b.ccExe(false), incdir, workdir)
+ }
+
+ // gxxCmd returns a g++ command line prefix
+ // defaultCXX is defined in zdefaultcc.go, written by cmd/dist.
+ func (b *Builder) GxxCmd(incdir, workdir string) []string {
+- return b.compilerCmd(b.cxxExe(), incdir, workdir)
++ return b.compilerCmd(b.cxxExe(false), incdir, workdir)
+ }
+
+ // gfortranCmd returns a gfortran command line prefix.
+ func (b *Builder) gfortranCmd(incdir, workdir string) []string {
+- return b.compilerCmd(b.fcExe(), incdir, workdir)
++ return b.compilerCmd(b.fcExe(false), incdir, workdir)
+ }
+
+ // ccExe returns the CC compiler setting without all the extra flags we add implicitly.
+-func (b *Builder) ccExe() []string {
+- return b.compilerExe(origCC, cfg.DefaultCC(cfg.Goos, cfg.Goarch))
++func (b *Builder) ccExe(filtered bool) []string {
++ return b.compilerExe(origCC, cfg.DefaultCC(cfg.Goos, cfg.Goarch), filtered)
+ }
+
+ // cxxExe returns the CXX compiler setting without all the extra flags we add implicitly.
+-func (b *Builder) cxxExe() []string {
+- return b.compilerExe(origCXX, cfg.DefaultCXX(cfg.Goos, cfg.Goarch))
++func (b *Builder) cxxExe(filtered bool) []string {
++ return b.compilerExe(origCXX, cfg.DefaultCXX(cfg.Goos, cfg.Goarch), filtered)
+ }
+
+ // fcExe returns the FC compiler setting without all the extra flags we add implicitly.
+-func (b *Builder) fcExe() []string {
+- return b.compilerExe(cfg.Getenv("FC"), "gfortran")
++func (b *Builder) fcExe(filtered bool) []string {
++ return b.compilerExe(os.Getenv("FC"), "gfortran", filtered)
++}
++
++var filterFlags = os.Getenv("CGO_PEDANTIC") == ""
++
++func filterCompilerFlags(flags []string) []string {
++ var newflags []string
++ if !filterFlags {
++ return flags
++ }
++ for _, flag := range flags {
++ if strings.HasPrefix(flag, "-m") {
++ newflags = append(newflags, flag)
++ }
++ }
++ return newflags
+ }
+
+ // compilerExe returns the compiler to use given an
+@@ -2436,11 +2453,16 @@ func (b *Builder) fcExe() []string {
+ // of the compiler but can have additional arguments if they
+ // were present in the environment value.
+ // For example if CC="gcc -DGOPHER" then the result is ["gcc", "-DGOPHER"].
+-func (b *Builder) compilerExe(envValue string, def string) []string {
++func (b *Builder) compilerExe(envValue string, def string, filtered bool) []string {
+ compiler := strings.Fields(envValue)
+ if len(compiler) == 0 {
+ compiler = strings.Fields(def)
+ }
++
++ if filtered {
++ return append(compiler[0:1], filterCompilerFlags(compiler[1:])...)
++ }
++
+ return compiler
+ }
+
+@@ -2620,7 +2642,7 @@ func envList(key, def string) []string {
+ }
+
+ // CFlags returns the flags to use when invoking the C, C++ or Fortran compilers, or cgo.
+-func (b *Builder) CFlags(p *load.Package) (cppflags, cflags, cxxflags, fflags, ldflags []string, err error) {
++func (b *Builder) CFlags(p *load.Package, filtered bool) (cppflags, cflags, cxxflags, fflags, ldflags []string, err error) {
+ defaults := "-g -O2"
+
+ if cppflags, err = buildFlags("CPPFLAGS", "", p.CgoCPPFLAGS, checkCompilerFlags); err != nil {
+@@ -2639,6 +2661,14 @@ func (b *Builder) CFlags(p *load.Package
+ return
+ }
+
++ if filtered {
++ cppflags = filterCompilerFlags(cppflags)
++ cflags = filterCompilerFlags(cflags)
++ cxxflags = filterCompilerFlags(cxxflags)
++ fflags = filterCompilerFlags(fflags)
++ ldflags = filterCompilerFlags(ldflags)
++ }
++
+ return
+ }
+
+@@ -2653,7 +2683,7 @@ var cgoRe = lazyregexp.New(`[/\\:]`)
+
+ func (b *Builder) cgo(a *Action, cgoExe, objdir string, pcCFLAGS, pcLDFLAGS, cgofiles, gccfiles, gxxfiles, mfiles, ffiles []string) (outGo, outObj []string, err error) {
+ p := a.Package
+- cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoFFLAGS, cgoLDFLAGS, err := b.CFlags(p)
++ cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoFFLAGS, cgoLDFLAGS, err := b.CFlags(p, false)
+ if err != nil {
+ return nil, nil, err
+ }
+@@ -3104,7 +3134,7 @@ func (b *Builder) swigIntSize(objdir str
+
+ // Run SWIG on one SWIG input file.
+ func (b *Builder) swigOne(a *Action, p *load.Package, file, objdir string, pcCFLAGS []string, cxx bool, intgosize string) (outGo, outC string, err error) {
+- cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, _, _, err := b.CFlags(p)
++ cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, _, _, err := b.CFlags(p, false)
+ if err != nil {
+ return "", "", err
+ }
diff --git a/recipes-devtools/go-1.16/go-1.16/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch b/recipes-devtools/go-1.16/go-1.16/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch
new file mode 100644
index 0000000..662c705
--- /dev/null
+++ b/recipes-devtools/go-1.16/go-1.16/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch
@@ -0,0 +1,47 @@
+From 28ada8896b76d620240bafc22aa395071d601482 Mon Sep 17 00:00:00 2001
+From: Alex Kube <alexander.j.kube@...>
+Date: Wed, 23 Oct 2019 21:15:37 +0430
+Subject: [PATCH 3/9] cmd/go: Allow GOTOOLDIR to be overridden in the environment
+
+to allow for split host/target build roots
+
+Adapted to Go 1.13 from patches originally submitted to
+the meta/recipes-devtools/go tree by
+Matt Madison <matt@...>.
+
+Upstream-Status: Inappropriate [OE specific]
+
+Signed-off-by: Alexander J Kube <alexander.j.kube@...>
+---
+ src/cmd/dist/build.go | 4 +++-
+ src/cmd/go/internal/cfg/cfg.go | 6 +++++-
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+--- a/src/cmd/dist/build.go
++++ b/src/cmd/dist/build.go
+@@ -246,7 +246,9 @@ func xinit() {
+ workdir = xworkdir()
+ xatexit(rmworkdir)
+
+- tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch)
++ if tooldir = os.Getenv("GOTOOLDIR"); tooldir == "" {
++ tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch)
++ }
+ }
+
+ // compilerEnv returns a map from "goos/goarch" to the
+--- a/src/cmd/go/internal/cfg/cfg.go
++++ b/src/cmd/go/internal/cfg/cfg.go
+@@ -64,7 +64,11 @@ func defaultContext() build.Context {
+ // variables. This matches the initialization of ToolDir in
+ // go/build, except for using ctxt.GOROOT rather than
+ // runtime.GOROOT.
+- build.ToolDir = filepath.Join(ctxt.GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
++ if s := os.Getenv("GOTOOLDIR"); s != "" {
++ build.ToolDir = filepath.Clean(s)
++ } else {
++ build.ToolDir = filepath.Join(ctxt.GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
++ }
+ }
+
+ ctxt.GOPATH = envOr("GOPATH", ctxt.GOPATH)
diff --git a/recipes-devtools/go-1.16/go-1.16/0004-ld-add-soname-to-shareable-objects.patch b/recipes-devtools/go-1.16/go-1.16/0004-ld-add-soname-to-shareable-objects.patch
new file mode 100644
index 0000000..cd875f1
--- /dev/null
+++ b/recipes-devtools/go-1.16/go-1.16/0004-ld-add-soname-to-shareable-objects.patch
@@ -0,0 +1,45 @@
+From bf5cf5301ae5914498454c87293d1df2e1d8489f Mon Sep 17 00:00:00 2001
+From: Alex Kube <alexander.j.kube@...>
+Date: Wed, 23 Oct 2019 21:16:32 +0430
+Subject: [PATCH 4/9] ld: add soname to shareable objects
+
+so that OE's shared library dependency handling
+can find them.
+
+Adapted to Go 1.13 from patches originally submitted to
+the meta/recipes-devtools/go tree by
+Matt Madison <matt@...>.
+
+Upstream-Status: Inappropriate [OE specific]
+
+Signed-off-by: Alexander J Kube <alexander.j.kube@...>
+---
+ src/cmd/link/internal/ld/lib.go | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/src/cmd/link/internal/ld/lib.go
++++ b/src/cmd/link/internal/ld/lib.go
+@@ -1343,6 +1343,7 @@ func (ctxt *Link) hostlink() {
+ argv = append(argv, "-Wl,-z,relro")
+ }
+ argv = append(argv, "-shared")
++ argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile)))
+ if ctxt.HeadType == objabi.Hwindows {
+ if *flagAslr {
+ argv = addASLRargs(argv)
+@@ -1358,6 +1359,7 @@ func (ctxt *Link) hostlink() {
+ argv = append(argv, "-Wl,-z,relro")
+ }
+ argv = append(argv, "-shared")
++ argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile)))
+ case BuildModePlugin:
+ if ctxt.HeadType == objabi.Hdarwin {
+ argv = append(argv, "-dynamiclib")
+@@ -1366,6 +1368,7 @@ func (ctxt *Link) hostlink() {
+ argv = append(argv, "-Wl,-z,relro")
+ }
+ argv = append(argv, "-shared")
++ argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile)))
+ }
+ }
+
diff --git a/recipes-devtools/go-1.16/go-1.16/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch b/recipes-devtools/go-1.16/go-1.16/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch
new file mode 100644
index 0000000..59c12d9
--- /dev/null
+++ b/recipes-devtools/go-1.16/go-1.16/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch
@@ -0,0 +1,39 @@
+From f05ef3ded52b98537c10efd0b15cd9612471524d Mon Sep 17 00:00:00 2001
+From: Alex Kube <alexander.j.kube@...>
+Date: Wed, 23 Oct 2019 21:17:16 +0430
+Subject: [PATCH 5/9] make.bash: override CC when building dist and
+ go_bootstrap
+
+for handling OE cross-canadian builds.
+
+Adapted to Go 1.13 from patches originally submitted to
+the meta/recipes-devtools/go tree by
+Matt Madison <matt@...>.
+
+Upstream-Status: Inappropriate [OE specific]
+
+Signed-off-by: Alexander J Kube <alexander.j.kube@...>
+---
+ src/make.bash | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/src/make.bash
++++ b/src/make.bash
+@@ -178,7 +178,7 @@ if [ "$GOROOT_BOOTSTRAP" = "$GOROOT" ];
+ exit 1
+ fi
+ rm -f cmd/dist/dist
+-GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" GO111MODULE=off "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
++CC="${BUILD_CC:-${CC}}" GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" GO111MODULE=off "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
+
+ # -e doesn't propagate out of eval, so check success by hand.
+ eval $(./cmd/dist/dist env -p || echo FAIL=true)
+@@ -209,7 +209,7 @@ fi
+ # Run dist bootstrap to complete make.bash.
+ # Bootstrap installs a proper cmd/dist, built with the new toolchain.
+ # Throw ours, built with Go 1.4, away after bootstrap.
+-./cmd/dist/dist bootstrap $buildall $vflag $GO_DISTFLAGS "$@"
++CC="${BUILD_CC:-${CC}}" ./cmd/dist/dist bootstrap $buildall $vflag $GO_DISTFLAGS "$@"
+ rm -f ./cmd/dist/dist
+
+ # DO NOT ADD ANY NEW CODE HERE.
diff --git a/recipes-devtools/go-1.16/go-1.16/0006-cmd-dist-separate-host-and-target-builds.patch b/recipes-devtools/go-1.16/go-1.16/0006-cmd-dist-separate-host-and-target-builds.patch
new file mode 100644
index 0000000..7aee0ba
--- /dev/null
+++ b/recipes-devtools/go-1.16/go-1.16/0006-cmd-dist-separate-host-and-target-builds.patch
@@ -0,0 +1,274 @@
+From 10735bb84df17ba657f76835f483cd8543a879c1 Mon Sep 17 00:00:00 2001
+From: Alex Kube <alexander.j.kube@...>
+Date: Wed, 23 Oct 2019 21:18:12 +0430
+Subject: [PATCH 6/9] cmd/dist: separate host and target builds
+
+Upstream-Status: Inappropriate [OE specific]
+
+Change the dist tool to allow for OE-style cross-
+and cross-canadian builds:
+
+ - command flags --host-only and --target only are added;
+ if one is present, the other changes mentioned below
+ take effect, and arguments may also be specified on
+ the command line to enumerate the package(s) to be
+ built.
+
+ - for OE cross builds, go_bootstrap is always built for
+ the current build host, and is moved, along with the supporting
+ toolchain (asm, compile, etc.) to a separate 'native_native'
+ directory under GOROOT/pkg/tool.
+
+ - go_bootstrap is not automatically removed after the build,
+ so it can be reused later (e.g., building both static and
+ shared runtime).
+
+Note that for --host-only builds, it would be nice to specify
+just the "cmd" package to build only the go commands/tools,
+the staleness checks in the dist tool will fail if the "std"
+library has not also been built. So host-only builds have to
+build everything anyway.
+
+Adapted to Go 1.13 from patches originally submitted to
+the meta/recipes-devtools/go tree by
+Matt Madison <matt@...>.
+
+Signed-off-by: Alexander J Kube <alexander.j.kube@...>
+---
+ src/cmd/dist/build.go | 155 ++++++++++++++++++++++++++++++------------
+ 1 file changed, 112 insertions(+), 43 deletions(-)
+
+--- a/src/cmd/dist/build.go
++++ b/src/cmd/dist/build.go
+@@ -41,6 +41,7 @@ var (
+ goldflags string
+ workdir string
+ tooldir string
++ build_tooldir string
+ oldgoos string
+ oldgoarch string
+ exe string
+@@ -53,6 +54,7 @@ var (
+
+ rebuildall bool
+ defaultclang bool
++ crossBuild bool
+
+ vflag int // verbosity
+ )
+@@ -249,6 +251,8 @@ func xinit() {
+ if tooldir = os.Getenv("GOTOOLDIR"); tooldir == "" {
+ tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch)
+ }
++
++ build_tooldir = pathf("%s/pkg/tool/native_native", goroot)
+ }
+
+ // compilerEnv returns a map from "goos/goarch" to the
+@@ -480,8 +484,10 @@ func setup() {
+ p := pathf("%s/pkg/%s_%s", goroot, gohostos, gohostarch)
+ if rebuildall {
+ xremoveall(p)
++ xremoveall(build_tooldir)
+ }
+ xmkdirall(p)
++ xmkdirall(build_tooldir)
+
+ if goos != gohostos || goarch != gohostarch {
+ p := pathf("%s/pkg/%s_%s", goroot, goos, goarch)
+@@ -1244,12 +1250,29 @@ func cmdbootstrap() {
+
+ var noBanner bool
+ var debug bool
++ var hostOnly bool
++ var targetOnly bool
++ var toBuild = []string{"std", "cmd"}
++
+ flag.BoolVar(&rebuildall, "a", rebuildall, "rebuild all")
+ flag.BoolVar(&debug, "d", debug, "enable debugging of bootstrap process")
+ flag.BoolVar(&noBanner, "no-banner", noBanner, "do not print banner")
++ flag.BoolVar(&hostOnly, "host-only", hostOnly, "build only host binaries, not target")
++ flag.BoolVar(&targetOnly, "target-only", targetOnly, "build only target binaries, not host")
+
+- xflagparse(0)
++ xflagparse(-1)
+
++ if hostOnly && targetOnly {
++ fatalf("specify only one of --host-only or --target-only\n")
++ }
++ crossBuild = hostOnly || targetOnly
++ if flag.NArg() > 0 {
++ if crossBuild {
++ toBuild = flag.Args()
++ } else {
++ fatalf("package names not permitted without --host-only or --target-only\n")
++ }
++ }
+ // Set GOPATH to an internal directory. We shouldn't actually
+ // need to store files here, since the toolchain won't
+ // depend on modules outside of vendor directories, but if
+@@ -1303,8 +1326,13 @@ func cmdbootstrap() {
+ xprintf("\n")
+ }
+
+- gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now
+- goldflags = os.Getenv("GO_LDFLAGS") // we were using $BOOT_GO_LDFLAGS until now
++ // For split host/target cross/cross-canadian builds, we don't
++ // want to be setting these flags until after we have compiled
++ // the toolchain that runs on the build host.
++ if !crossBuild {
++ gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now
++ goldflags = os.Getenv("GO_LDFLAGS") // we were using $BOOT_GO_LDFLAGS until now
++ }
+ goBootstrap := pathf("%s/go_bootstrap", tooldir)
+ cmdGo := pathf("%s/go", gobin)
+ if debug {
+@@ -1333,7 +1361,11 @@ func cmdbootstrap() {
+ xprintf("\n")
+ }
+ xprintf("Building Go toolchain2 using go_bootstrap and Go toolchain1.\n")
+- os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
++ if crossBuild {
++ os.Setenv("CC", defaultcc[""])
++ } else {
++ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
++ }
+ goInstall(goBootstrap, append([]string{"-i"}, toolchain...)...)
+ if debug {
+ run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
+@@ -1370,50 +1402,84 @@ func cmdbootstrap() {
+ }
+ checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
+
+- if goos == oldgoos && goarch == oldgoarch {
+- // Common case - not setting up for cross-compilation.
+- timelog("build", "toolchain")
+- if vflag > 0 {
+- xprintf("\n")
++ if crossBuild {
++ gogcflags = os.Getenv("GO_GCFLAGS")
++ goldflags = os.Getenv("GO_LDFLAGS")
++ tool_files, _ := filepath.Glob(pathf("%s/*", tooldir))
++ for _, f := range tool_files {
++ copyfile(pathf("%s/%s", build_tooldir, filepath.Base(f)), f, writeExec)
++ xremove(f)
++ }
++ os.Setenv("GOTOOLDIR", build_tooldir)
++ goBootstrap = pathf("%s/go_bootstrap", build_tooldir)
++ if hostOnly {
++ timelog("build", "host toolchain")
++ if vflag > 0 {
++ xprintf("\n")
++ }
++ xprintf("Building %s for host, %s/%s.\n", strings.Join(toBuild, ","), goos, goarch)
++ goInstall(goBootstrap, toBuild...)
++ checkNotStale(goBootstrap, toBuild...)
++ // Skip cmdGo staleness checks here, since we can't necessarily run the cmdGo binary
++
++ timelog("build", "target toolchain")
++ if vflag > 0 {
++ xprintf("\n")
++ }
++ } else if targetOnly {
++ goos = oldgoos
++ goarch = oldgoarch
++ os.Setenv("GOOS", goos)
++ os.Setenv("GOARCH", goarch)
++ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
++ xprintf("Building %s for target, %s/%s.\n", strings.Join(toBuild, ","), goos, goarch)
++ goInstall(goBootstrap, toBuild...)
++ checkNotStale(goBootstrap, toBuild...)
++ // Skip cmdGo staleness checks here, since we can't run the target's cmdGo binary
+ }
+- xprintf("Building packages and commands for %s/%s.\n", goos, goarch)
+ } else {
+- // GOOS/GOARCH does not match GOHOSTOS/GOHOSTARCH.
+- // Finish GOHOSTOS/GOHOSTARCH installation and then
+- // run GOOS/GOARCH installation.
+- timelog("build", "host toolchain")
+- if vflag > 0 {
+- xprintf("\n")
++
++ if goos == oldgoos && goarch == oldgoarch {
++ // Common case - not setting up for cross-compilation.
++ timelog("build", "toolchain")
++ if vflag > 0 {
++ xprintf("\n")
++ }
++ xprintf("Building packages and commands for %s/%s.\n", goos, goarch)
++ } else {
++ // GOOS/GOARCH does not match GOHOSTOS/GOHOSTARCH.
++ // Finish GOHOSTOS/GOHOSTARCH installation and then
++ // run GOOS/GOARCH installation.
++ timelog("build", "host toolchain")
++ if vflag > 0 {
++ xprintf("\n")
++ }
++ xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch)
++ goInstall(goBootstrap, "std", "cmd")
++ checkNotStale(goBootstrap, "std", "cmd")
++ checkNotStale(cmdGo, "std", "cmd")
++
++ timelog("build", "target toolchain")
++ if vflag > 0 {
++ xprintf("\n")
++ }
++ goos = oldgoos
++ goarch = oldgoarch
++ os.Setenv("GOOS", goos)
++ os.Setenv("GOARCH", goarch)
++ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
++ xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch)
+ }
+- xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch)
+ goInstall(goBootstrap, "std", "cmd")
+ checkNotStale(goBootstrap, "std", "cmd")
+ checkNotStale(cmdGo, "std", "cmd")
+
+- timelog("build", "target toolchain")
+- if vflag > 0 {
+- xprintf("\n")
+- }
+- goos = oldgoos
+- goarch = oldgoarch
+- os.Setenv("GOOS", goos)
+- os.Setenv("GOARCH", goarch)
+- os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
+- xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch)
+- }
+- targets := []string{"std", "cmd"}
+- if goos == "js" && goarch == "wasm" {
+- // Skip the cmd tools for js/wasm. They're not usable.
+- targets = targets[:1]
+- }
+- goInstall(goBootstrap, targets...)
+- checkNotStale(goBootstrap, targets...)
+- checkNotStale(cmdGo, targets...)
+- if debug {
+- run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
+- run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
+- checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
+- copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec)
++ if debug {
++ run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
++ run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
++ checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
++ copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec)
++ }
+ }
+
+ // Check that there are no new files in $GOROOT/bin other than
+@@ -1430,8 +1496,11 @@ func cmdbootstrap() {
+ }
+ }
+
+- // Remove go_bootstrap now that we're done.
+- xremove(pathf("%s/go_bootstrap", tooldir))
++ // Except that for split host/target cross-builds, we need to
++ // keep it.
++ if !crossBuild {
++ xremove(pathf("%s/go_bootstrap", tooldir))
++ }
+
+ if goos == "android" {
+ // Make sure the exec wrapper will sync a fresh $GOROOT to the device.
diff --git a/recipes-devtools/go-1.16/go-1.16/0007-cmd-go-make-GOROOT-precious-by-default.patch b/recipes-devtools/go-1.16/go-1.16/0007-cmd-go-make-GOROOT-precious-by-default.patch
new file mode 100644
index 0000000..4b4d0d4
--- /dev/null
+++ b/recipes-devtools/go-1.16/go-1.16/0007-cmd-go-make-GOROOT-precious-by-default.patch
@@ -0,0 +1,104 @@
+From 9ba507e076c744f4d394418e4a849e68cd426a4a Mon Sep 17 00:00:00 2001
+From: Alex Kube <alexander.j.kube@...>
+Date: Wed, 23 Oct 2019 21:18:56 +0430
+Subject: [PATCH 7/9] cmd/go: make GOROOT precious by default
+
+Upstream-Status: Inappropriate [OE specific]
+
+The go build tool normally rebuilds whatever it detects is
+stale. This can be a problem when GOROOT is intended to
+be read-only and the go runtime has been built as a shared
+library, since we don't want every application to be rebuilding
+the shared runtime - particularly in cross-build/packaging
+setups, since that would lead to 'abi mismatch' runtime errors.
+
+This patch prevents the install and linkshared actions from
+installing to GOROOT unless overridden with the GOROOT_OVERRIDE
+environment variable.
+
+Adapted to Go 1.13 from patches originally submitted to
+the meta/recipes-devtools/go tree by
+Matt Madison <matt@...>.
+
+Signed-off-by: Alexander J Kube <alexander.j.kube@...>
+---
+ src/cmd/go/internal/work/action.go | 3 +++
+ src/cmd/go/internal/work/build.go | 6 ++++++
+ src/cmd/go/internal/work/exec.go | 25 +++++++++++++++++++++++++
+ 3 files changed, 34 insertions(+)
+
+--- a/src/cmd/go/internal/work/action.go
++++ b/src/cmd/go/internal/work/action.go
+@@ -670,6 +670,9 @@ func (b *Builder) addTransitiveLinkDeps(
+ if p1 == nil || p1.Shlib == "" || haveShlib[filepath.Base(p1.Shlib)] {
+ continue
+ }
++ if goRootPrecious && (p1.Standard || p1.Goroot) {
++ continue
++ }
+ haveShlib[filepath.Base(p1.Shlib)] = true
+ // TODO(rsc): The use of ModeInstall here is suspect, but if we only do ModeBuild,
+ // we'll end up building an overall library or executable that depends at runtime
+--- a/src/cmd/go/internal/work/build.go
++++ b/src/cmd/go/internal/work/build.go
+@@ -167,6 +167,8 @@ See also: go install, go get, go clean.
+
+ const concurrentGCBackendCompilationEnabledByDefault = true
+
++var goRootPrecious bool = true
++
+ func init() {
+ // break init cycle
+ CmdBuild.Run = runBuild
+@@ -179,6 +181,10 @@ func init() {
+
+ AddBuildFlags(CmdBuild, DefaultBuildFlags)
+ AddBuildFlags(CmdInstall, DefaultBuildFlags)
++
++ if x := os.Getenv("GOROOT_OVERRIDE"); x != "" {
++ goRootPrecious = false
++ }
+ }
+
+ // Note that flags consulted by other parts of the code
+--- a/src/cmd/go/internal/work/exec.go
++++ b/src/cmd/go/internal/work/exec.go
+@@ -468,6 +468,23 @@ func (b *Builder) build(a *Action) (err
+ return errors.New("binary-only packages are no longer supported")
+ }
+
++ if goRootPrecious && (a.Package.Standard || a.Package.Goroot) {
++ _, err := os.Stat(a.Package.Target)
++ if err == nil {
++ a.built = a.Package.Target
++ a.Target = a.Package.Target
++ a.buildID = b.fileHash(a.Package.Target)
++ a.Package.Stale = false
++ a.Package.StaleReason = "GOROOT-resident package"
++ return nil
++ }
++ a.Package.Stale = true
++ a.Package.StaleReason = "missing or invalid GOROOT-resident package"
++ if b.IsCmdList {
++ return nil
++ }
++ }
++
+ if err := b.Mkdir(a.Objdir); err != nil {
+ return err
+ }
+@@ -1520,6 +1537,14 @@ func BuildInstallFunc(b *Builder, a *Act
+ return err
+ }
+
++ if goRootPrecious && a.Package != nil {
++ p := a.Package
++ if p.Standard || p.Goroot {
++ err := fmt.Errorf("attempting to install package %s into read-only GOROOT", p.ImportPath)
++ return err
++ }
++ }
++
+ if err := b.Mkdir(a.Objdir); err != nil {
+ return err
+ }
diff --git a/recipes-devtools/go-1.16/go-1.16/0008-use-GOBUILDMODE-to-set-buildmode.patch b/recipes-devtools/go-1.16/go-1.16/0008-use-GOBUILDMODE-to-set-buildmode.patch
new file mode 100644
index 0000000..4e5d502
--- /dev/null
+++ b/recipes-devtools/go-1.16/go-1.16/0008-use-GOBUILDMODE-to-set-buildmode.patch
@@ -0,0 +1,42 @@
+From 971b5626339ce0c4d57f9721c9a81af566c5a044 Mon Sep 17 00:00:00 2001
+From: Alex Kube <alexander.j.kube@...>
+Date: Wed, 23 Oct 2019 21:19:26 +0430
+Subject: [PATCH 8/9] cmd/go: Use GOBUILDMODE to set buildmode
+
+Upstream-Status: Denied [upstream choose antoher solution: `17a256b
+cmd/go: -buildmode=pie for android/arm']
+
+While building go itself, the go build system does not support
+to set `-buildmode=pie' from environment.
+
+Add GOBUILDMODE to support it which make PIE executables the default
+build mode, as PIE executables are required as of Yocto
+
+Refers: https://groups.google.com/forum/#!topic/golang-dev/gRCe5URKewI
+
+Adapted to Go 1.13 from patches originally submitted to
+the meta/recipes-devtools/go tree by
+Hongxu Jia <hongxu.jia@...>
+
+Signed-off-by: Alexander J Kube <alexander.j.kube@...>
+---
+ src/cmd/go/internal/work/build.go | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+--- a/src/cmd/go/internal/work/build.go
++++ b/src/cmd/go/internal/work/build.go
+@@ -254,7 +254,13 @@ func AddBuildFlags(cmd *base.Command, ma
+
+ cmd.Flag.Var(&load.BuildAsmflags, "asmflags", "")
+ cmd.Flag.Var(buildCompiler{}, "compiler", "")
+- cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", "default", "")
++
++ if bm := os.Getenv("GOBUILDMODE"); bm != "" {
++ cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", bm, "")
++ } else {
++ cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", "default", "")
++ }
++
+ cmd.Flag.Var(&load.BuildGcflags, "gcflags", "")
+ cmd.Flag.Var(&load.BuildGccgoflags, "gccgoflags", "")
+ if mask&OmitModFlag == 0 {
diff --git a/recipes-devtools/go-1.16/go-1.16/0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch b/recipes-devtools/go-1.16/go-1.16/0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch
new file mode 100644
index 0000000..dcbdf58
--- /dev/null
+++ b/recipes-devtools/go-1.16/go-1.16/0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch
@@ -0,0 +1,95 @@
+From a983bc6cd48fb0da939e3329cac18d7a3b29ecf8 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@...>
+Date: Mon, 22 Feb 2021 17:54:01 -0800
+Subject: [PATCH] Revert "cmd/go: make sure CC and CXX are absolute"
+
+OE uses CC/CXX values which consists of cmpiler and options together,
+secondly, the environment is canned so this check add little value to OE
+based builds
+
+Fixes go-runtime build issues
+
+go install: CXX environment variable is relative; must be absolute path: powerpc64le-yoe-linux-musl-g++ -mlittle-endian -mhard-float -m64 -mabi=elfv2 -mcpu=power9 -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/mnt/b/yoe/master/build/tmp/work/ppc64p9le-yoe-linux-musl/go/1.16-r0/recipe-sysroot
+
+This reverts commit aa161e799df7e1eba99d2be10271e76b6f758142.
+
+Upstream-Status: Inappropriate [OE-Specific]
+Signed-off-by: Khem Raj <raj.khem@...>
+---
+ src/cmd/go/internal/envcmd/env.go | 5 -----
+ src/cmd/go/internal/work/init.go | 7 -------
+ src/cmd/go/testdata/script/env_write.txt | 24 ------------------------
+ 3 files changed, 36 deletions(-)
+
+diff --git a/src/cmd/go/internal/envcmd/env.go b/src/cmd/go/internal/envcmd/env.go
+index 6937187522..29f9057c3f 100644
+--- a/src/cmd/go/internal/envcmd/env.go
++++ b/src/cmd/go/internal/envcmd/env.go
+@@ -427,11 +427,6 @@ func checkEnvWrite(key, val string) error {
+ if !filepath.IsAbs(val) && val != "" {
+ return fmt.Errorf("GOPATH entry is relative; must be absolute path: %q", val)
+ }
+- // Make sure CC and CXX are absolute paths
+- case "CC", "CXX":
+- if !filepath.IsAbs(val) && val != "" && val != filepath.Base(val) {
+- return fmt.Errorf("%s entry is relative; must be absolute path: %q", key, val)
+- }
+ }
+
+ if !utf8.ValidString(val) {
+diff --git a/src/cmd/go/internal/work/init.go b/src/cmd/go/internal/work/init.go
+index ba7c7c2fbb..3a6df5f758 100644
+--- a/src/cmd/go/internal/work/init.go
++++ b/src/cmd/go/internal/work/init.go
+@@ -41,13 +41,6 @@ func BuildInit() {
+ cfg.BuildPkgdir = p
+ }
+
+- // Make sure CC and CXX are absolute paths
+- for _, key := range []string{"CC", "CXX"} {
+- if path := cfg.Getenv(key); !filepath.IsAbs(path) && path != "" && path != filepath.Base(path) {
+- base.Fatalf("go %s: %s environment variable is relative; must be absolute path: %s\n", flag.Args()[0], key, path)
+- }
+- }
+-
+ // For each experiment that has been enabled in the toolchain, define a
+ // build tag with the same name but prefixed by "goexperiment." which can be
+ // used for compiling alternative files for the experiment. This allows
+diff --git a/src/cmd/go/testdata/script/env_write.txt b/src/cmd/go/testdata/script/env_write.txt
+index bda1e57826..c99aadb7f2 100644
+--- a/src/cmd/go/testdata/script/env_write.txt
++++ b/src/cmd/go/testdata/script/env_write.txt
+@@ -129,30 +129,6 @@ go env -w GOTMPDIR=
+ go env GOTMPDIR
+ stdout ^$
+
+-# go env -w rejects relative CC values
+-[!windows] go env -w CC=/usr/bin/clang
+-go env -w CC=clang
+-[!windows] ! go env -w CC=./clang
+-[!windows] ! go env -w CC=bin/clang
+-[!windows] stderr 'go env -w: CC entry is relative; must be absolute path'
+-
+-[windows] go env -w CC=$WORK\bin\clang
+-[windows] ! go env -w CC=.\clang
+-[windows] ! go env -w CC=bin\clang
+-[windows] stderr 'go env -w: CC entry is relative; must be absolute path'
+-
+-# go env -w rejects relative CXX values
+-[!windows] go env -w CC=/usr/bin/cpp
+-go env -w CXX=cpp
+-[!windows] ! go env -w CXX=./cpp
+-[!windows] ! go env -w CXX=bin/cpp
+-[!windows] stderr 'go env -w: CXX entry is relative; must be absolute path'
+-
+-[windows] go env -w CXX=$WORK\bin\cpp
+-[windows] ! go env -w CXX=.\cpp
+-[windows] ! go env -w CXX=bin\cpp
+-[windows] stderr 'go env -w: CXX entry is relative; must be absolute path'
+-
+ # go env -w/-u checks validity of GOOS/ARCH combinations
+ env GOOS=
+ env GOARCH=
+--
+2.30.1
+
diff --git a/recipes-devtools/go-1.16/go-binary-native_1.16.10.bb b/recipes-devtools/go-1.16/go-binary-native_1.16.10.bb
new file mode 100644
index 0000000..4866c9f
--- /dev/null
+++ b/recipes-devtools/go-1.16/go-binary-native_1.16.10.bb
@@ -0,0 +1,46 @@
+# This recipe is for bootstrapping our go-cross from a prebuilt binary of Go from golang.org.
+
+SUMMARY = "Go programming language compiler (upstream binary for bootstrap)"
+HOMEPAGE = " http://golang.org/"
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"
+
+PROVIDES = "go-native"
+
+SRC_URI = "https://dl.google.com/go/go${PV}.${BUILD_GOOS}-${BUILD_GOARCH}.tar.gz;name=go_${BUILD_GOTUPLE}"
+SRC_URI[go_linux_amd64.sha256sum] = "414cd18ce1d193769b9e97d2401ad718755ab47816e13b2a1cde203d263b55cf"
+SRC_URI[go_linux_arm64.sha256sum] = "bfe1d4b82626c742b4690a832ca59a21e3d702161556f3c0ed26dffb368927e9"
+
+UPSTREAM_CHECK_URI = "https://golang.org/dl/"
+UPSTREAM_CHECK_REGEX = "go(?P<pver>\d+(\.\d+)+)\.linux"
+
+S = "${WORKDIR}/go"
+
+inherit goarch native
+
+do_compile() {
+ :
+}
+
+make_wrapper() {
+ rm -f ${D}${bindir}/$1
+ cat <<END >${D}${bindir}/$1
+#!/bin/bash
+here=\`dirname \$0\`
+export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}"
+\$here/../lib/go/bin/$1 "\$@"
+END
+ chmod +x ${D}${bindir}/$1
+}
+
+do_install() {
+ find ${S} -depth -type d -name testdata -exec rm -rf {} +
+
+ install -d ${D}${bindir} ${D}${libdir}/go
+ cp --preserve=mode,timestamps -R ${S}/ ${D}${libdir}/
+
+ for f in ${S}/bin/*
+ do
+ make_wrapper `basename $f`
+ done
+}
diff --git a/recipes-devtools/go-1.16/go-common.inc b/recipes-devtools/go-1.16/go-common.inc
new file mode 100644
index 0000000..dfccebd
--- /dev/null
+++ b/recipes-devtools/go-1.16/go-common.inc
@@ -0,0 +1,42 @@
+SUMMARY = "Go programming language compiler"
+DESCRIPTION = " The Go programming language is an open source project to make \
+ programmers more productive. Go is expressive, concise, clean, and\
+ efficient. Its concurrency mechanisms make it easy to write programs\
+ that get the most out of multicore and networked machines, while its\
+ novel type system enables flexible and modular program construction.\
+ Go compiles quickly to machine code yet has the convenience of\
+ garbage collection and the power of run-time reflection. It's a\
+ fast, statically typed, compiled language that feels like a\
+ dynamically typed, interpreted language."
+
+HOMEPAGE = " http://golang.org/"
+LICENSE = "BSD-3-Clause"
+
+inherit goarch
+
+SRC_URI = "https://golang.org/dl/go${PV}.src.tar.gz;name=main"
+S = "${WORKDIR}/go"
+B = "${S}"
+UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)\.src\.tar"
+
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+SSTATE_SCAN_CMD = "true"
+
+export GOROOT_OVERRIDE = "1"
+export GOTMPDIR ?= "${WORKDIR}/go-tmp"
+GOTMPDIR[vardepvalue] = ""
+export CGO_ENABLED = "1"
+
+export GOHOSTOS ?= "${BUILD_GOOS}"
+export GOHOSTARCH ?= "${BUILD_GOARCH}"
+export GOROOT_BOOTSTRAP ?= "${STAGING_LIBDIR_NATIVE}/go"
+export GOOS ?= "${TARGET_GOOS}"
+export GOARCH ?= "${TARGET_GOARCH}"
+export GOARM ?= "${TARGET_GOARM}"
+export GO386 ?= "${TARGET_GO386}"
+export GOMIPS ?= "${TARGET_GOMIPS}"
+export GOROOT_FINAL ?= "${libdir}/go"
+
+do_compile:prepend() {
+ BUILD_CC=${BUILD_CC}
+}
diff --git a/recipes-devtools/go-1.16/go-cross-canadian.inc b/recipes-devtools/go-1.16/go-cross-canadian.inc
new file mode 100644
index 0000000..d49250a
--- /dev/null
+++ b/recipes-devtools/go-1.16/go-cross-canadian.inc
@@ -0,0 +1,62 @@
+inherit cross-canadian
+
+DEPENDS = "go-native virtual/${HOST_PREFIX}go-crosssdk virtual/nativesdk-${HOST_PREFIX}go-runtime \
+ virtual/${HOST_PREFIX}gcc-crosssdk virtual/nativesdk-libc \
+ virtual/nativesdk-${HOST_PREFIX}compilerlibs"
+PN = "go-cross-canadian-${TRANSLATED_TARGET_ARCH}"
+
+# it uses gcc on build machine during go-cross-canadian bootstrap, but
+# the gcc version may be old and not support option '-fmacro-prefix-map'
+# which is one of default values of DEBUG_PREFIX_MAP
+DEBUG_PREFIX_MAP = "-fdebug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
+ -fdebug-prefix-map=${STAGING_DIR_HOST}= \
+ -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
+ "
+
+export GOTOOLDIR_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/${HOST_SYS}/go/pkg/tool/${BUILD_GOTUPLE}"
+export CGO_CFLAGS = "${CFLAGS}"
+export CGO_LDFLAGS = "${LDFLAGS}"
+export GO_LDFLAGS = '-linkmode external -extld ${HOST_PREFIX}gcc -extldflags "--sysroot=${STAGING_DIR_HOST} ${SECURITY_NOPIE_CFLAGS} ${HOST_CC_ARCH} ${LDFLAGS}"'
+
+do_configure[noexec] = "1"
+
+do_compile() {
+ export CC_FOR_${HOST_GOTUPLE}="${HOST_PREFIX}gcc --sysroot=${STAGING_DIR_HOST}${SDKPATHNATIVE} ${SECURITY_NOPIE_CFLAGS}"
+ export CXX_FOR_${HOST_GOTUPLE}="${HOST_PREFIX}gxx --sysroot=${STAGING_DIR_HOST}${SDKPATHNATIVE} ${SECURITY_NOPIE_CFLAGS}"
+ 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/sh
+here=\`dirname \$0\`
+native_goroot=\`readlink -f \$here/../../lib/${TARGET_SYS}/go\`
+export GOARCH="${TARGET_GOARCH}"
+export GOOS="${TARGET_GOOS}"
+test -n "\$GOARM" || export GOARM="${TARGET_GOARM}"
+test -n "\$GO386" || export GO386="${TARGET_GO386}"
+test -n "\$GOMIPS" || export GOMIPS="${TARGET_GOMIPS}"
+export GOTOOLDIR="\$native_goroot/pkg/tool/${HOST_GOTUPLE}"
+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/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}/${GO_BUILD_BINDIR}/*
+ do
+ base=`basename $f`
+ install -m755 $f ${D}${libdir}/go/bin
+ make_wrapper $base ${TARGET_PREFIX}$base
+ done
+}
diff --git a/recipes-devtools/go-1.16/go-cross-canadian_1.16.10.bb b/recipes-devtools/go-1.16/go-cross-canadian_1.16.10.bb
new file mode 100644
index 0000000..7ac9449
--- /dev/null
+++ b/recipes-devtools/go-1.16/go-cross-canadian_1.16.10.bb
@@ -0,0 +1,2 @@
+require go-cross-canadian.inc
+require go-${PV}.inc
diff --git a/recipes-devtools/go-1.16/go-cross.inc b/recipes-devtools/go-1.16/go-cross.inc
new file mode 100644
index 0000000..3d5803b
--- /dev/null
+++ b/recipes-devtools/go-1.16/go-cross.inc
@@ -0,0 +1,53 @@
+inherit cross
+
+PROVIDES = "virtual/${TUNE_PKGARCH}-go"
+DEPENDS = "go-native"
+
+PN = "go-cross-${TUNE_PKGARCH}"
+
+export GOCACHE = "${B}/.cache"
+CC = "${@d.getVar('BUILD_CC').strip()}"
+
+do_configure[noexec] = "1"
+
+do_compile() {
+ export CC_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
+ export CXX_FOR_${TARGET_GOTUPLE}="${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}}"
+export GOMIPS="\${GOMIPS:-${TARGET_GOMIPS}}"
+\$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
+}
diff --git a/recipes-devtools/go-1.16/go-cross_1.16.10.bb b/recipes-devtools/go-1.16/go-cross_1.16.10.bb
new file mode 100644
index 0000000..80b5a03
--- /dev/null
+++ b/recipes-devtools/go-1.16/go-cross_1.16.10.bb
@@ -0,0 +1,2 @@
+require go-cross.inc
+require go-${PV}.inc
diff --git a/recipes-devtools/go-1.16/go-crosssdk.inc b/recipes-devtools/go-1.16/go-crosssdk.inc
new file mode 100644
index 0000000..f0bec79
--- /dev/null
+++ b/recipes-devtools/go-1.16/go-crosssdk.inc
@@ -0,0 +1,43 @@
+inherit crosssdk
+
+DEPENDS = "go-native virtual/${TARGET_PREFIX}gcc-crosssdk virtual/nativesdk-${TARGET_PREFIX}compilerlibs virtual/${TARGET_PREFIX}binutils-crosssdk"
+PN = "go-crosssdk-${SDK_SYS}"
+PROVIDES = "virtual/${TARGET_PREFIX}go-crosssdk"
+
+do_configure[noexec] = "1"
+
+do_compile() {
+ export CC_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}"
+ export CXX_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}"
+ 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}"
+\$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@"
+END
+ chmod +x ${D}${bindir}/$2
+}
+
+do_install() {
+ install -d ${D}${libdir}/go
+ install -d ${D}${libdir}/go/bin
+ install -d ${D}${libdir}/go/pkg/tool
+ install -d ${D}${bindir}
+ cp --preserve=mode,timestamps -R ${S}/pkg/tool/${BUILD_GOTUPLE} ${D}${libdir}/go/pkg/tool/
+ for f in ${B}/bin/*
+ do
+ base=`basename $f`
+ install -m755 $f ${D}${libdir}/go/bin
+ make_wrapper $base ${TARGET_PREFIX}$base
+ done
+}
diff --git a/recipes-devtools/go-1.16/go-crosssdk_1.16.10.bb b/recipes-devtools/go-1.16/go-crosssdk_1.16.10.bb
new file mode 100644
index 0000000..1857c8a
--- /dev/null
+++ b/recipes-devtools/go-1.16/go-crosssdk_1.16.10.bb
@@ -0,0 +1,2 @@
+require go-crosssdk.inc
+require go-${PV}.inc
diff --git a/recipes-devtools/go-1.16/go-native_1.16.10.bb b/recipes-devtools/go-1.16/go-native_1.16.10.bb
new file mode 100644
index 0000000..ffe4ef3
--- /dev/null
+++ b/recipes-devtools/go-1.16/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
+}
diff --git a/recipes-devtools/go-1.16/go-runtime.inc b/recipes-devtools/go-1.16/go-runtime.inc
new file mode 100644
index 0000000..617e6b5
--- /dev/null
+++ b/recipes-devtools/go-1.16/go-runtime.inc
@@ -0,0 +1,87 @@
+DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
+DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk"
+PROVIDES = "virtual/${TARGET_PREFIX}go-runtime"
+
+export CGO_CFLAGS = "${CFLAGS}"
+export CGO_CPPFLAGS = "${CPPFLAGS}"
+export CGO_CXXFLAGS = "${CXXFLAGS}"
+export CGO_LDFLAGS = "${LDFLAGS}"
+export GOCACHE = "${B}/.cache"
+
+GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS}"
+GO_SHLIB_LDFLAGS ?= '-ldflags="--linkmode=external -extldflags '${GO_EXTLDFLAGS}'"'
+
+do_configure() {
+ :
+}
+
+do_configure:libc-musl() {
+ rm -f ${S}/src/runtime/race/*.syso
+}
+
+do_compile() {
+ export CC_FOR_${TARGET_GOTUPLE}="${CC}"
+ export CXX_FOR_${TARGET_GOTUPLE}="${CXX}"
+
+ cd src
+ ./make.bash --target-only --no-banner std
+ if [ -n "${GO_DYNLINK}" ]; then
+ export GOTOOLDIR="${B}/pkg/tool/native_native"
+ CC="$CC_FOR_${TARGET_GOTUPLE}" GOARCH="${TARGET_GOARCH}" GOOS="${TARGET_GOOS}" GOROOT=${B} \
+ $GOTOOLDIR/go_bootstrap install -linkshared -buildmode=shared ${GO_SHLIB_LDFLAGS} std
+ fi
+ cd ${B}
+}
+do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg"
+do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
+
+do_install() {
+ install -d ${D}${libdir}/go/src
+ cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
+ if [ "${BUILD_GOTUPLE}" != "${TARGET_GOTUPLE}" ]; then
+ rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE}
+ rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE}
+ fi
+ rm -rf ${D}${libdir}/go/pkg/tool
+ rm -rf ${D}${libdir}/go/pkg/obj
+ rm -rf ${D}${libdir}/go/pkg/bootstrap
+ find src -mindepth 1 -maxdepth 1 -type d | while read srcdir; do
+ cp --preserve=mode,timestamps -R $srcdir ${D}${libdir}/go/src/
+ done
+ find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \;
+ rm -f ${D}${libdir}/go/src/cmd/dist/dist
+ rm -f ${D}${libdir}/go/src/cmd/cgo/zdefaultcc.go
+ rm -f ${D}${libdir}/go/src/cmd/go/internal/cfg/zdefaultcc.go
+
+}
+
+ALLOW_EMPTY:${PN} = "1"
+FILES:${PN} = "${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*${SOLIBSDEV}"
+FILES:${PN}-dev = "${libdir}/go/src ${libdir}/go/pkg/include \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*.shlibname \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*.shlibname \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*.shlibname \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*.shlibname \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*.shlibname \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*.shlibname \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*/*.shlibname \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*.a \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*.a \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*.a \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*.a \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*.a \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*.a \
+ ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*/*.a \
+"
+FILES:${PN}-staticdev = "${libdir}/go/pkg/${TARGET_GOTUPLE}"
+
+# Go sources include some scripts and pre-built binaries for
+# multiple architectures. The static .a files for dynamically-linked
+# runtime are also required in -dev.
+INSANE_SKIP:${PN}-dev = "staticdev file-rdeps arch"
+
+INHIBIT_PACKAGE_STRIP = "1"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+INHIBIT_SYSROOT_STRIP = "1"
+
+BBCLASSEXTEND = "nativesdk"
diff --git a/recipes-devtools/go-1.16/go-runtime_1.16.10.bb b/recipes-devtools/go-1.16/go-runtime_1.16.10.bb
new file mode 100644
index 0000000..63464a1
--- /dev/null
+++ b/recipes-devtools/go-1.16/go-runtime_1.16.10.bb
@@ -0,0 +1,3 @@
+require go-${PV}.inc
+require go-runtime.inc
+
diff --git a/recipes-devtools/go-1.16/go-target.inc b/recipes-devtools/go-1.16/go-target.inc
new file mode 100644
index 0000000..47b4411
--- /dev/null
+++ b/recipes-devtools/go-1.16/go-target.inc
@@ -0,0 +1,45 @@
+DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
+DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk go-native"
+
+export GOCACHE = "${B}/.cache"
+GO_LDFLAGS = ""
+GO_LDFLAGS:class-nativesdk = "-linkmode external"
+export GO_LDFLAGS
+
+CC:append:class-nativesdk = " ${SECURITY_NOPIE_CFLAGS}"
+
+do_configure[noexec] = "1"
+
+do_compile() {
+ export CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CC}"
+ export CXX_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CXX}"
+
+ cd src
+ ./make.bash --target-only --no-banner
+ cd ${B}
+}
+do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg"
+do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
+
+do_install() {
+ install -d ${D}${libdir}/go/pkg/tool
+ cp --preserve=mode,timestamps -R ${B}/pkg/tool/${TARGET_GOTUPLE} ${D}${libdir}/go/pkg/tool/
+ install -d ${D}${libdir}/go/src
+ cp --preserve=mode,timestamps -R ${S}/src/cmd ${D}${libdir}/go/src/
+ find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \;
+ install -d ${D}${libdir}/go/bin
+ install -d ${D}${bindir}
+ for f in ${B}/${GO_BUILD_BINDIR}/*; do
+ name=`basename $f`
+ install -m 0755 $f ${D}${libdir}/go/bin/
+ ln -sf ../${baselib}/go/bin/$name ${D}${bindir}/
+ done
+ rm -rf ${D}${libdir}/go/src
+}
+
+PACKAGES = "${PN} ${PN}-dev"
+FILES:${PN} = "${libdir}/go/bin ${libdir}/go/pkg/tool/${TARGET_GOTUPLE} ${bindir}"
+RDEPENDS:${PN} = "go-runtime"
+INSANE_SKIP:${PN} = "ldflags"
+
+BBCLASSEXTEND = "nativesdk"
diff --git a/recipes-devtools/go-1.16/go_1.16.10.bb b/recipes-devtools/go-1.16/go_1.16.10.bb
new file mode 100644
index 0000000..34dc89b
--- /dev/null
+++ b/recipes-devtools/go-1.16/go_1.16.10.bb
@@ -0,0 +1,17 @@
+require go-${PV}.inc
+require go-target.inc
+
+inherit linuxloader
+
+export GOBUILDMODE=""
+export GO_LDSO = "${@get_linuxloader(d)}"
+export CC_FOR_TARGET = "gcc"
+export CXX_FOR_TARGET = "g++"
+
+# mips/rv64 doesn't support -buildmode=pie, so skip the QA checking for mips/riscv32 and its
+# variants.
+python() {
+ if 'mips' in d.getVar('TARGET_ARCH',True) or 'riscv32' in d.getVar('TARGET_ARCH',True):
+ d.appendVar('INSANE_SKIP:%s' % d.getVar('PN',True), " textrel")
+}
+
--
2.20.1


[meta-lts-mixins][dunfell/go PATCH 1/4] Initial commit: add license, readme and layer config.

Alexander Kanavin
 

Reviewed-by: Martin Kaistra <martin.kaistra@...>
Signed-off-by: Alexander Kanavin <alex@...>
---
COPYING.MIT | 17 +++++++++++++++++
README | 23 +++++++++++++++++++++++
conf/layer.conf | 19 +++++++++++++++++++
3 files changed, 59 insertions(+)
create mode 100644 COPYING.MIT
create mode 100644 README
create mode 100644 conf/layer.conf

diff --git a/COPYING.MIT b/COPYING.MIT
new file mode 100644
index 0000000..fb950dc
--- /dev/null
+++ b/COPYING.MIT
@@ -0,0 +1,17 @@
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/README b/README
new file mode 100644
index 0000000..5b22b72
--- /dev/null
+++ b/README
@@ -0,0 +1,23 @@
+"Mixin" layer for adding latest Go toolchain versions into the Yocto Project LTS.
+
+At the time Dunfell was released in April 2020, Go 1.14 was the latest version
+and officially Dunfell supports only that. This thin special-purpose mixin
+layer is meant to address this issue by backporting Go recipes from the master
+branch of openembedded-core.
+
+You can see what Go versions are provided by listing recipes-devtools/ content.
+
+Including the layer automatically picks up the latest Go version; different versions
+need to be set explicitly by adding the following line to your distro config
+or local.conf:
+
+GOVERSION = "1.16%"
+
+Please note: enabling these newer Go versions makes docker from dunfell branch
+of meta-virtualization unbuildable as it is too old. If you need a working docker
+recipe, you can use the supplementary 'dunfell/docker' layer from this meta-lts-mixin
+repository.
+
+
+Maintainers:
+Alexander Kanavin <alex@...>
diff --git a/conf/layer.conf b/conf/layer.conf
new file mode 100644
index 0000000..5f74224
--- /dev/null
+++ b/conf/layer.conf
@@ -0,0 +1,19 @@
+# We have a conf and classes directory, append to BBPATH
+BBPATH .= ":${LAYERDIR}"
+
+# We have a recipes directory, add to BBFILES
+BBFILES += "${LAYERDIR}/recipes*/*/*.bb ${LAYERDIR}/recipes*/*/*.bbappend"
+
+BBFILE_COLLECTIONS += "lts-go-mixin"
+BBFILE_PATTERN_lts-go-mixin := "^${LAYERDIR}/"
+BBFILE_PRIORITY_lts-go-mixin = "6"
+
+LAYERSERIES_COMPAT_lts-go-mixin = "dunfell"
+
+LAYERDEPENDS_lts-go-mixin = " \
+ core \
+"
+
+GOVERSION ?= "1.17%"
+PREFERRED_PROVIDER_go-native = "go-binary-native"
+
--
2.20.1


Re: Additional hardening options

Khem Raj
 

On Wed, Jan 26, 2022 at 1:17 PM Paul Eggleton
<bluelightning@...> wrote:

On Wednesday, 26 January 2022 14:39:39 NZDT Paul Eggleton wrote:
Hi folks

I've been looking into a couple of compiler flags for hardening that I think
we might want to consider enabling by default in security-flags.inc:


1) -fstack-clash-protection

This option was introduced to gcc 8.x and provides protection against the
stack clash vulnerability:

https://securingsoftware.blogspot.com/2017/12/stack-clash-vulnerability.html

It has been enabled in some Linux distributions already (e.g. Ubuntu,
Fedora).
That is good testimony, it will be good to know how this option
impacts performance
and does it work across architectures and libc's supported in OE.


Another quirk of this - with dunfell, the buildepoxy SDK test fails on Ubuntu
18.04 with -fstack-clash-protection because the version of meson in dunfell
uses the same LDFLAGS value for both host and target, and host gcc doesn't
support that option. Not sure what to do other than just filtering out the
option from LDFLAGS in the test.

Cheers
Paul





Re: Additional hardening options

Alexander Kanavin
 

I guess you can submit a patch, and it can be taken for a spin on the autobuilder?

Alex


On Wed, 26 Jan 2022 at 22:17, Paul Eggleton <bluelightning@...> wrote:
On Wednesday, 26 January 2022 14:39:39 NZDT Paul Eggleton wrote:
> Hi folks
>
> I've been looking into a couple of compiler flags for hardening that I think
> we might want to consider enabling by default in security-flags.inc:
>
>
> 1) -fstack-clash-protection
>
> This option was introduced to gcc 8.x and provides protection against the
> stack clash vulnerability:
>
> https://securingsoftware.blogspot.com/2017/12/stack-clash-vulnerability.html
>
> It has been enabled in some Linux distributions already (e.g. Ubuntu,
> Fedora).

Another quirk of this - with dunfell, the buildepoxy SDK test fails on Ubuntu
18.04 with -fstack-clash-protection because the version of meson in dunfell
uses the same LDFLAGS value for both host and target, and host gcc doesn't
support that option. Not sure what to do other than just filtering out the
option from LDFLAGS in the test.

Cheers
Paul






Re: Additional hardening options

Paul Eggleton
 

On Wednesday, 26 January 2022 14:39:39 NZDT Paul Eggleton wrote:
Hi folks

I've been looking into a couple of compiler flags for hardening that I think
we might want to consider enabling by default in security-flags.inc:


1) -fstack-clash-protection

This option was introduced to gcc 8.x and provides protection against the
stack clash vulnerability:

https://securingsoftware.blogspot.com/2017/12/stack-clash-vulnerability.html

It has been enabled in some Linux distributions already (e.g. Ubuntu,
Fedora).
Another quirk of this - with dunfell, the buildepoxy SDK test fails on Ubuntu
18.04 with -fstack-clash-protection because the version of meson in dunfell
uses the same LDFLAGS value for both host and target, and host gcc doesn't
support that option. Not sure what to do other than just filtering out the
option from LDFLAGS in the test.

Cheers
Paul


Re: linux-firmware_20211216

Rudolf J Streif
 

On 1/26/22 10:10 AM, Khem Raj wrote:
On Wed, Jan 26, 2022 at 9:21 AM Rudolf J Streif
<rudolf.streif@...> wrote:
I got a question about the linux-firmware-bcm4373 package. The link

/lib/firmware/brcm/brcmfmac4373-sdio.clm_blob ->
../cypress/cyfmac4373-sdio.clm_blob

is packaged into linux-firmware and not into linux-firmware-bcm4373.

It's essentially not included in

FILES:${PN}-bcm4373 =
"${nonarch_base_libdir}/firmware/brcm/brcmfmac4373-sdio.bin \
${nonarch_base_libdir}/firmware/brcm/brcmfmac4373.bin \
${nonarch_base_libdir}/firmware/cypress/cyfmac4373-sdio.bin \
"

which means it is automatically packaged as a "leftover" into
linux-firmware.

Is there a reason for that or is it simply an oversight?
seems an oversight.
Thanks, Khem. I sent a patch to OE.
Thanks,
Rudi

--
Rudolf J Streif
CEO/CTO ibeeto
+1.855.442.3386 x700


--
Rudolf J Streif
CEO/CTO ibeeto
+1.855.442.3386 x700


Re: linux-firmware_20211216

Khem Raj
 

On Wed, Jan 26, 2022 at 9:21 AM Rudolf J Streif
<rudolf.streif@...> wrote:

I got a question about the linux-firmware-bcm4373 package. The link

/lib/firmware/brcm/brcmfmac4373-sdio.clm_blob ->
../cypress/cyfmac4373-sdio.clm_blob

is packaged into linux-firmware and not into linux-firmware-bcm4373.

It's essentially not included in

FILES:${PN}-bcm4373 =
"${nonarch_base_libdir}/firmware/brcm/brcmfmac4373-sdio.bin \
${nonarch_base_libdir}/firmware/brcm/brcmfmac4373.bin \
${nonarch_base_libdir}/firmware/cypress/cyfmac4373-sdio.bin \
"

which means it is automatically packaged as a "leftover" into
linux-firmware.

Is there a reason for that or is it simply an oversight?
seems an oversight.

Thanks,
Rudi

--
Rudolf J Streif
CEO/CTO ibeeto
+1.855.442.3386 x700




Re: build yocto 2.6 on Ubuntu 20.04

Bill Plunkett
 

It's been a while, but I was able to build yocto sumo (2.5) usingĀ https://github.com/crops/poky-container


On Wed, Jan 26, 2022 at 9:51 AM Alexander Kanavin <alex.kanavin@...> wrote:
I think the best way out for you is to set up a container with a supported older distribution. Usually you need an older gcc version from the host machine, so the container will have that.

Alex

On Wed, 26 Jan 2022 at 17:43, Jacob Avraham <jacob.avraham@...> wrote:
Hi,
Has anyone tried to build yocto 2.6 on Ubuntu 20.04?
I know it's not supported, but it's a major task for me to upgradeĀ to yocto 3.x.
I triedĀ it myself and it fails on building qemu-native.
I wonder if anyone worked around this.

Thanks,
Jacob








Python3 app install best practice

Mauro Ziliani
 

Hi all

I'd like to install my python3 application in a custom folder with all local packages and data.


The source code folder has this tree


./myapp/__main__.py

./package/__init__.py

./package/pkg.py


I manage the application by myapp_1.0.bb recipe.

I'd like the myapp_1.0.ipk package contains


/home/apps/myapp/__main__.py

/home/apps/package/__init__.py

/home/apps/package/pkg.py


I try setup.py andĀ  inherit setuptools3 in my myapp_git.bb but 'packages' is installed under python system folder.


There is a way to customize the path of python package installation?


MZ


linux-firmware_20211216

Rudolf J Streif
 

I got a question about the linux-firmware-bcm4373 package. The link

/lib/firmware/brcm/brcmfmac4373-sdio.clm_blob -> ../cypress/cyfmac4373-sdio.clm_blob

is packaged into linux-firmware and not into linux-firmware-bcm4373.

It's essentially not included in

FILES:${PN}-bcm4373 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4373-sdio.bin \
Ā  ${nonarch_base_libdir}/firmware/brcm/brcmfmac4373.bin \
Ā  ${nonarch_base_libdir}/firmware/cypress/cyfmac4373-sdio.bin \
"

which means it is automatically packaged as a "leftover" into linux-firmware.

Is there a reason for that or is it simply an oversight?

Thanks,
Rudi

--
Rudolf J Streif
CEO/CTO ibeeto
+1.855.442.3386 x700


Re: build yocto 2.6 on Ubuntu 20.04

Alexander Kanavin
 

I think the best way out for you is to set up a container with a supported older distribution. Usually you need an older gcc version from the host machine, so the container will have that.

Alex


On Wed, 26 Jan 2022 at 17:43, Jacob Avraham <jacob.avraham@...> wrote:
Hi,
Has anyone tried to build yocto 2.6 on Ubuntu 20.04?
I know it's not supported, but it's a major task for me to upgradeĀ to yocto 3.x.
I triedĀ it myself and it fails on building qemu-native.
I wonder if anyone worked around this.

Thanks,
Jacob





build yocto 2.6 on Ubuntu 20.04

Jacob Avraham
 

Hi,
Has anyone tried to build yocto 2.6 on Ubuntu 20.04?
I know it's not supported, but it's a major task for me to upgradeĀ to yocto 3.x.
I triedĀ it myself and it fails on building qemu-native.
I wonder if anyone worked around this.

Thanks,
Jacob


Preferred provide base-utils issue

pvanberlo@...
 

Hello,

so I'm a bit at a loss. I admit, I've not yet been using Yocto for a long time. I'm trying to use base-utils as provided by packagegroup-core-base-utils to have a more full featured set of base utils instead of busybox. It all builds just fine, however, whatever I do (using dunfell), it ends up with a kernel panic during boot.

I added the following to local.conf on a clean clone of poky:

INIT_MANAGER="systemd"

IMAGE_FSTYPES="live"

PREFERRED_PROVIDER_base-utils = "packagegroup-core-base-utils"
VIRTUAL-RUNTIME_base-utils = "packagegroup-core-base-utils"
VIRTUAL-RUNTIME_base-utils-hwclock = "util-linux-hwclock"
VIRTUAL-RUNTIME_base-utils-syslog = ""

Does anyone have any idea how to get this to work?

Regards,

Paul van Berlo


Re: [oe] Inclusive Language Proposal for YP/OE

Mikko Rapeli
 

Hi,

On Tue, Jan 25, 2022 at 04:30:40PM +0000, Ross Burton wrote:
On Mon, 24 Jan 2022 at 16:18, Jon Mason <jdmason@...> wrote:
CVE_CHECK_PN_WHITELIST -> CVE_CHECK_SKIPRECIPE
CVE_CHECK_WHITELIST -> CVE_CHECK_IGNORECVE
This is the only one that sticks out to me. I think it needs another
_, SKIP_RECIPE and IGNORE_CVE.
Please don't include CVE twice in the variable name, that's was annoying and just
got used to the CVE_CHECK_WHITELIST one. CVE_CHECK_IGNORE would do.

Cheers,

-Mikko

Other than that, +1.

Will we have a bit of logic to detect the obsolete names being set and
emit warnings/errors?

Ross



Re: [PATCH yocto-autobuilder-helper] run-docs-build: fix checkout of releases.rst from master

Quentin Schulz
 

Hi Michael,

On January 25, 2022 5:45:46 PM GMT+01:00, Michael Opdenacker <michael.opdenacker@...> wrote:
A wrong path was given given the working directory.

Also revert the changes with "git reset --hard" to
have a clean state before further branch switches.
One change at a time please ā˜ŗļø

Signed-off-by: Michael Opdenacker <michael.opdenacker@...>
---
scripts/run-docs-build | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/scripts/run-docs-build b/scripts/run-docs-build
index 5d6d24a..c93b3e6 100755
--- a/scripts/run-docs-build
+++ b/scripts/run-docs-build
@@ -43,11 +43,12 @@ cp -r ./_build/final/* $outputdir/bitbake/next
# see the latest releases.
for branch in 1.46 1.48 1.50 1.52; do
git checkout $branch
- git checkout master doc/releases.rst
+ git checkout master releases.rst
make clean
make publish
mkdir $outputdir/bitbake/$branch
cp -r ./_build/final/* $outputdir/bitbake/$branch
+ git reset --hard
This should be done right after the git checkout. It's better to ensure what you build is clean that try to ensure the next oneto build has a clean env. Especially since checkouts can dirty the git repo I think (I've had this issue multiple times when switching between kernel branches far enough from one another).

Also git reset --hard is not enough. I use git clean -ffdx instead usually. Didn't have a problem with this one for a while now.

done

# only sync bitbake folder for now. We need bitbake to be published first
@@ -79,11 +80,12 @@ cp -r ./_build/final/* $outputdir/next
for branch in dunfell gatesgarth hardknott honister; do
cd $ypdocs
git checkout $branch
- git checkout master documentation/releases.rst
+ git checkout master releases.rst
make clean
make publish
mkdir $outputdir/$branch
cp -r ./_build/final/* $outputdir/$branch
+ git reset --hard
Ditto.

done

# Yocto Project releases/tags
@@ -101,12 +103,13 @@ for tag in $(git tag --list 'yocto-*'); do
if [ "$tag" = "yocto-3.3" ] || [ "$tag" = "yocto-3.4" ]; then
git am "${scriptdir}/${tag}/0001-conf-update-for-release.patch"
fi
- git checkout master documentation/releases.rst
+ git checkout master releases.rst
make clean
make publish
version=$(echo $tag | cut -c7-)
mkdir $outputdir/$version
cp -r ./_build/final/* $outputdir/$version
+ git reset --hard
Ditto.

Cheers,
Quentin

fi
done

1861 - 1880 of 57811