Add go-bin virtual package to go providers
cover Add go-bin virtual package to go providers
Previous patch set adding 'go-bin' failed the tests in newer go version because of illegal instructions.
This patch set fix the cross-compilation issue coming from the 'go-bin' this was solved by specifically mentionning the GOARM version in environment variable when building a go package for the target (HOST_GO_TARGET_ENV).
Thomas Perale (2):
package/go/go-bin: new host-go provider
support/testing: add tests for Go providers
package/go/Config.in.host | 22 ++++++++++++++++------ package/go/go-bin/Config.in.host | 13 +++++++++++++ package/go/go-bin/go-bin.hash | 8 ++++++++ package/go/go-bin/go-bin.mk | 20 ++++++++++++++++++++ package/go/go.mk | 2 ++ support/testing/tests/package/test_go.py | 14 ++++++++++++++ 6 files changed, 73 insertions(+), 6 deletions(-) create mode 100644 package/go/go-bin/Config.in.host create mode 100644 package/go/go-bin/go-bin.hash create mode 100644 package/go/go-bin/go-bin.mk
Signature · 6 lines
2.46.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 1/2 package/go/go-bin: new host-go provider
This package provides a pre-built version for the host-go virtual package introduced in the previous commits:
- host-go-bin installs a pre-built version of the Go compiler.
By default, host-go remains built from sources to keep the same behavior as the former version.
The menuconfig entry for host-go is updated to expose the host-go-bin provider. The dependencies are set as such as if host-go-src does not support the host architecture, it will automatically fall back to host-go-bin and vice versa.
--- package/go/Config.in.host | 22 ++++++++++++++++------ package/go/go-bin/Config.in.host | 13 +++++++++++++ package/go/go-bin/go-bin.hash | 8 ++++++++ package/go/go-bin/go-bin.mk | 20 ++++++++++++++++++++ package/go/go.mk | 2 ++ 5 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 package/go/go-bin/Config.in.host create mode 100644 package/go/go-bin/go-bin.hash create mode 100644 package/go/go-bin/go-bin.mk
package/go/Config.in.host +16 -6
@@ -34,7 +34,7 @@ config BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS config BR2_PACKAGE_HOST_GO_HOST_ARCH_SUPPORTS bool default y - depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS + depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS || BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH_SUPPORTS # CGO linking for the host. Since we use the same compiler for target # and host, if the target can't do CGO linking, then the host can't.
@@ -57,7 +57,8 @@ if BR2_PACKAGE_HOST_GO choice prompt "Go compiler variant" - default BR2_PACKAGE_HOST_GO_SRC + default BR2_PACKAGE_HOST_GO_SRC if BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS + default BR2_PACKAGE_HOST_GO_BIN if BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH_SUPPORTS help Select a Go compiler variant.
@@ -65,18 +66,27 @@ choice config BR2_PACKAGE_HOST_GO_SRC bool "host go (source)" + depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS help This package will build the go compiler for the host. -endchoice +config BR2_PACKAGE_HOST_GO_BIN + bool "host go (pre-built)" + depends on BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH_SUPPORTS + help + This package will install pre-built versions of the compiler -endif +endchoice config BR2_PACKAGE_PROVIDES_HOST_GO string - # Default to host-go-src, as the only provider for now - default "host-go-src" + # Default to host-go-src + default "host-go-src" if BR2_PACKAGE_HOST_GO_SRC + default "host-go-bin" if BR2_PACKAGE_HOST_GO_BIN + +endif +source "package/go/go-bin/Config.in.host" source "package/go/go-bootstrap-stage1/Config.in.host" source "package/go/go-bootstrap-stage2/Config.in.host" source "package/go/go-bootstrap-stage3/Config.in.host"
package/go/go-bin/Config.in.host new file +13 -0
@@ -0,0 +1,13 @@ +config BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH + string "Translate the HOSTARCH into the architecture name used by the Go compiler" + default "armv6l" if BR2_HOSTARCH = "arm" + default "arm64" if BR2_HOSTARCH = "aarch64" + default "ppc64le" if BR2_HOSTARCH = "powerpc64le" + default "s390x" if BR2_HOSTARCH = "s390x" + default "386" if BR2_HOSTARCH = "x86" + default "amd64" if BR2_HOSTARCH = "x86_64" + +config BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH_SUPPORTS + bool + default y + depends on BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH != ""
package/go/go-bin/go-bin.hash new file +8 -0
@@ -0,0 +1,8 @@ +# sha256 checksum from https://go.dev/dl/ +sha256 3ea4c78e6fa52978ae1ed2e5927ad17495da440c9fae7787b1ebc1d0572f7f43 go1.22.5.linux-386.tar.gz +sha256 904b924d435eaea086515bc63235b192ea441bd8c9b198c507e85009e6e4c7f0 go1.22.5.linux-amd64.tar.gz +sha256 8d21325bfcf431be3660527c1a39d3d9ad71535fabdf5041c826e44e31642b5a go1.22.5.linux-arm64.tar.gz +sha256 8c4587cf3e63c9aefbcafa92818c4d9d51683af93ea687bf6c7508d6fa36f85e go1.22.5.linux-armv6l.tar.gz +sha256 5312bb420ac0b59175a58927e70b4660b14ab7319aab54398b6071fabcbfbb09 go1.22.5.linux-ppc64le.tar.gz +sha256 24c6c5c9d515adea5d58ae78388348c97614a0c21ac4d4f4c0dab75e893b0b5d go1.22.5.linux-s390x.tar.gz +sha256 2d36597f7117c38b006835ae7f537487207d8ec407aa9d9980794b2030cbc067 LICENSE
package/go/go-bin/go-bin.mk new file +20 -0
@@ -0,0 +1,20 @@ +################################################################################ +# +# go-bin +# +################################################################################ + +GO_BIN_SITE = https://go.dev/dl +HOST_GO_BIN_ACTUAL_SOURCE_TARBALL = go$(GO_VERSION).src.tar.gz +GO_BIN_LICENSE = BSD-3-Clause +GO_BIN_LICENSE_FILES = LICENSE + +HOST_GO_BIN_PROVIDES = host-go + +HOST_GO_BIN_SOURCE = go$(GO_VERSION).linux-$(call qstrip, $(BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH)).tar.gz + +define HOST_GO_BIN_INSTALL_CMDS + $(GO_BINARIES_INSTALL) +endef + +$(eval $(host-generic-package))
package/go/go.mk +2 -0
@@ -71,6 +71,8 @@ HOST_GO_TARGET_ENV = \ $(HOST_GO_COMMON_ENV) \ GOOS="linux" \ GOARCH=$(GO_GOARCH) \ + $(if $(GO_GO386),GO386=$(GO_GO386)) \ + $(if $(GO_GOARM),GOARM=$(GO_GOARM)) \ CC="$(TARGET_CC)" \ CXX="$(TARGET_CXX)" \ CGO_CFLAGS="$(TARGET_CFLAGS)" \
Signature · 6 lines
2.46.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Yann E. MORIN
AppliedRe: [Buildroot] [PATCH 1/2] package/go/go-bin: new host-go provider
Thomas, All,
On 2024-09-14 17:23 +0200, Thomas Perale via buildroot spake thusly:
Quoted 8 lines
This package provides a pre-built version for the host-go virtual package introduced in the previous commits:
- host-go-bin installs a pre-built version of the Go compiler.
By default, host-go remains built from sources to keep the same behavior as the former version.
Quoted 6 lines
The menuconfig entry for host-go is updated to expose the host-go-bin provider. The dependencies are set as such as if host-go-src does not support the host architecture, it will automatically fall back to host-go-bin and vice versa.
Signed-off-by Thomas Perale <[email protected]>
I've done a few changes:
- update hashes for 1.22.7
- add hash for the source tarball
- set _DL_SUBDIR
- don't set a prompt to BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH
Applied to master with those fixes, thanks a lot!
Regards,
Yann E. MORIN.
Quoted 145 lines
--- package/go/Config.in.host | 22 ++++++++++++++++------ package/go/go-bin/Config.in.host | 13 +++++++++++++ package/go/go-bin/go-bin.hash | 8 ++++++++ package/go/go-bin/go-bin.mk | 20 ++++++++++++++++++++ package/go/go.mk | 2 ++ 5 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 package/go/go-bin/Config.in.host create mode 100644 package/go/go-bin/go-bin.hash create mode 100644 package/go/go-bin/go-bin.mkpackage/go/Config.in.host +16
-6@@ -34,7 +34,7 @@ config BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS config BR2_PACKAGE_HOST_GO_HOST_ARCH_SUPPORTS bool default y - depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS + depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS || BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH_SUPPORTS # CGO linking for the host. Since we use the same compiler for target # and host, if the target can't do CGO linking, then the host can't.@@ -57,7 +57,8 @@ if BR2_PACKAGE_HOST_GO choice prompt "Go compiler variant" - default BR2_PACKAGE_HOST_GO_SRC + default BR2_PACKAGE_HOST_GO_SRC if BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS + default BR2_PACKAGE_HOST_GO_BIN if BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH_SUPPORTS help Select a Go compiler variant.@@ -65,18 +66,27 @@ choice config BR2_PACKAGE_HOST_GO_SRC bool "host go (source)" + depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS help This package will build the go compiler for the host. -endchoice +config BR2_PACKAGE_HOST_GO_BIN + bool "host go (pre-built)" + depends on BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH_SUPPORTS + help + This package will install pre-built versions of the compiler -endif +endchoice config BR2_PACKAGE_PROVIDES_HOST_GO string - # Default to host-go-src, as the only provider for now - default "host-go-src" + # Default to host-go-src + default "host-go-src" if BR2_PACKAGE_HOST_GO_SRC + default "host-go-bin" if BR2_PACKAGE_HOST_GO_BIN + +endif +source "package/go/go-bin/Config.in.host" source "package/go/go-bootstrap-stage1/Config.in.host" source "package/go/go-bootstrap-stage2/Config.in.host" source "package/go/go-bootstrap-stage3/Config.in.host"package/go/go-bin/Config.in.host new file +13
-0@@ -0,0 +1,13 @@ +config BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH + string "Translate the HOSTARCH into the architecture name used by the Go compiler" + default "armv6l" if BR2_HOSTARCH = "arm" + default "arm64" if BR2_HOSTARCH = "aarch64" + default "ppc64le" if BR2_HOSTARCH = "powerpc64le" + default "s390x" if BR2_HOSTARCH = "s390x" + default "386" if BR2_HOSTARCH = "x86" + default "amd64" if BR2_HOSTARCH = "x86_64" + +config BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH_SUPPORTS + bool + default y + depends on BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH != ""package/go/go-bin/go-bin.hash new file +8
-0@@ -0,0 +1,8 @@ +# sha256 checksum from https://go.dev/dl/ +sha256 3ea4c78e6fa52978ae1ed2e5927ad17495da440c9fae7787b1ebc1d0572f7f43 go1.22.5.linux-386.tar.gz +sha256 904b924d435eaea086515bc63235b192ea441bd8c9b198c507e85009e6e4c7f0 go1.22.5.linux-amd64.tar.gz +sha256 8d21325bfcf431be3660527c1a39d3d9ad71535fabdf5041c826e44e31642b5a go1.22.5.linux-arm64.tar.gz +sha256 8c4587cf3e63c9aefbcafa92818c4d9d51683af93ea687bf6c7508d6fa36f85e go1.22.5.linux-armv6l.tar.gz +sha256 5312bb420ac0b59175a58927e70b4660b14ab7319aab54398b6071fabcbfbb09 go1.22.5.linux-ppc64le.tar.gz +sha256 24c6c5c9d515adea5d58ae78388348c97614a0c21ac4d4f4c0dab75e893b0b5d go1.22.5.linux-s390x.tar.gz +sha256 2d36597f7117c38b006835ae7f537487207d8ec407aa9d9980794b2030cbc067 LICENSEpackage/go/go-bin/go-bin.mk new file +20
-0@@ -0,0 +1,20 @@ +################################################################################ +# +# go-bin +# +################################################################################ + +GO_BIN_SITE = https://go.dev/dl +HOST_GO_BIN_ACTUAL_SOURCE_TARBALL = go$(GO_VERSION).src.tar.gz +GO_BIN_LICENSE = BSD-3-Clause +GO_BIN_LICENSE_FILES = LICENSE + +HOST_GO_BIN_PROVIDES = host-go + +HOST_GO_BIN_SOURCE = go$(GO_VERSION).linux-$(call qstrip, $(BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH)).tar.gz + +define HOST_GO_BIN_INSTALL_CMDS + $(GO_BINARIES_INSTALL) +endef + +$(eval $(host-generic-package))package/go/go.mk +2
-0@@ -71,6 +71,8 @@ HOST_GO_TARGET_ENV = \ $(HOST_GO_COMMON_ENV) \ GOOS="linux" \ GOARCH=$(GO_GOARCH) \ + $(if $(GO_GO386),GO386=$(GO_GO386)) \ + $(if $(GO_GOARM),GOARM=$(GO_GOARM)) \ CC="$(TARGET_CC)" \ CXX="$(TARGET_CXX)" \ CGO_CFLAGS="$(TARGET_CFLAGS)" \Signature · 6 lines
2.46.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/2 support/testing: add tests for Go providers
In reply to Thomas Perale via buildrootTest the go-bin provider of host-go to build a Go package.
The tests consist of building and installing a Go package in the root file system of an ARM vexpress QEMU system.
The tests pass if the program runs on the target.
--- support/testing/tests/package/test_go.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
support/testing/tests/package/test_go.py +14 -0
@@ -13,6 +13,20 @@ class TestGoBase(infra.basetest.BRTest): self.emulator.login() +class TestGoBin(TestGoBase): + config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ + """ + BR2_TARGET_ROOTFS_CPIO=y + BR2_PACKAGE_HOST_GO=y + BR2_PACKAGE_HOST_GO_BIN=y + BR2_PACKAGE_TINIFIER=y + """ + + def test_run(self): + self.login() + self.assertRunOk("tinifier -h") + + class TestGoSource(TestGoBase): config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ """
Signature · 6 lines
2.46.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Yann E. MORIN
AppliedRe: [Buildroot] [PATCH 2/2] support/testing: add tests for Go providers
Thomas, All,
On 2024-09-14 17:23 +0200, Thomas Perale via buildroot spake thusly:
Quoted 16 lines
Test the go-bin provider of host-go to build a Go package.
The tests consist of building and installing a Go package in the root file system of an ARM vexpress QEMU system.
The tests pass if the program runs on the target.Signed-off-by Thomas Perale <[email protected]>--- support/testing/tests/package/test_go.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+)support/testing/tests/package/test_go.py +0
-0
support/testing/tests/package/test_go.py class TestGoBase(infra.basetest.BRTest): · line 22
Quoted 10 lines
support/testing/tests/package/test_go.py +7
-0@@ -13,6 +13,20 @@ class TestGoBase(infra.basetest.BRTest): self.emulator.login() +class TestGoBin(TestGoBase): + config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ + """ + BR2_TARGET_ROOTFS_CPIO=y + BR2_PACKAGE_HOST_GO=y + BR2_PACKAGE_HOST_GO_BIN=y + BR2_PACKAGE_TINIFIER=y
tinifier can't be vendored today, so I could not test jhost-go-bin, so I switched to use another package that could not be vendroed either (sigh), so I switched to flannel, and that worked.
So, I oushed to master, with the test using flannel imstead of tinifier. And I also changed the GoSource test similarly.
Applied to master, thanks.
Regards,
Yann E. MORIN.
Quoted 17 lines
support/testing/tests/package/test_go.py +7
-0+ """ + + def test_run(self): + self.login() + self.assertRunOk("tinifier -h") + + class TestGoSource(TestGoBase): config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ """Signature · 6 lines
2.46.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Thomas, All,
On 2024-09-14 17:23 +0200, Thomas Perale via buildroot spake thusly:
Quoted 7 lines
Previous patch set adding 'go-bin' failed the tests in newer go version because of illegal instructions.
This patch set fix the cross-compilation issue coming from the 'go-bin' this was solved by specifically mentionning the GOARM version in environment variable when building a go package for the target (
HOST_GO_TARGET_ENV).
I applied the series with a few changes, see the commits.
I also added three preparatory commits;
559bb33ae7 support/testing: do not use s.b.o e9b0893a8e package/go/go-src: share download directory with go 8931e9f534 support/testing: switch go-src to use flannel
Thanks a lot for this work! 👍
Regards,
Yann E. MORIN.
Quoted 22 lines
Thomas Perale (2):
package/go/go-bin: new host-go provider
support/testing: add tests for Go providerspackage/go/Config.in.host | 22 ++++++++++++++++------ package/go/go-bin/Config.in.host | 13 +++++++++++++ package/go/go-bin/go-bin.hash | 8 ++++++++ package/go/go-bin/go-bin.mk | 20 ++++++++++++++++++++ package/go/go.mk | 2 ++ support/testing/tests/package/test_go.py | 14 ++++++++++++++ 6 files changed, 73 insertions(+), 6 deletions(-) create mode 100644 package/go/go-bin/Config.in.host create mode 100644 package/go/go-bin/go-bin.hash create mode 100644 package/go/go-bin/go-bin.mkSignature · 6 lines
2.46.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot