Skip to contentSkip to conversation

package/go-bootstrap: split into two stages: go1.4 and go1.19.10

Buildroot Thomas Petazzoni via buildroot 1 participant 1 message Jul 22, 2023

lore
Share & tools
lore
#0 lore raw

commit: https://git.buildroot.net/buildroot/commit/?id=6bedfdf6917ab7e4fb6d692f2e17eaff09b136a8
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

Go 1.20 requires a minimum version of go 1.17.13 to bootstrap.

https://go.dev/doc/go1.20#bootstrap

As Go 1.4 was the previous version that could be compiled with C, there is now no way to bootstrap go with a C compiler, unless we use a two-stage bootstrap:

- build host-go-bootstrap-1.4-20170531
- build host-go-bootstrap-1.19.10 with host-go-bootstrap-1.4-20170531
- build host-go-1.20 with host-go-bootstrap-1.19.9

This is implemented in this commit first, before upgrading host-go to 1.20.

Note: the .patch files from package/go version 1.19.x are not necessary for package/go-bootstrap-stage2 and have not been included there.

Previous discussion of possible alternatives:

https://lore.kernel.org/all/CA+h8R2rtcynkCBsz=_9yANOEguyPCOcQDj8_ns+cv8RS8+8t9A@mail.gmail.com/
https://lore.kernel.org/all/20220525234312.643dfc03@windsurf/T/

---
 DEVELOPERS                                         |  2 +
 package/Config.in.host                             |  3 +-
 package/go-bootstrap-stage1/Config.in.host         |  6 +++
 .../go-bootstrap-stage1.hash}                      |  0
 package/go-bootstrap-stage1/go-bootstrap-stage1.mk | 43 ++++++++++++++++++
 package/go-bootstrap-stage2/Config.in.host         |  4 ++
 .../go-bootstrap-stage2/go-bootstrap-stage2.hash   |  3 ++
 package/go-bootstrap-stage2/go-bootstrap-stage2.mk | 53 ++++++++++++++++++++++
 package/go-bootstrap/Config.in.host                |  7 ---
 package/go-bootstrap/go-bootstrap.mk               | 50 --------------------
 package/go/Config.in.host                          |  4 +-
 package/go/go.mk                                   |  4 +-
 12 files changed, 117 insertions(+), 62 deletions(-)
DEVELOPERS +2 -0
index 01050ebf59..469a93449a 100644
@@ -558,6 +558,8 @@ F:	package/docker-engine/
 F:	package/embiggen-disk/
 F:	package/fuse-overlayfs/
 F:	package/go/
+F:	package/go-bootstrap-stage1/
+F:	package/go-bootstrap-stage2/
 F:	package/gocryptfs/
 F:	package/mbpfan/
 F:	package/moby-buildkit/
package/Config.in.host +2 -1
index 9addc88522..ab91bd4e70 100644
@@ -40,7 +40,8 @@ menu "Host utilities"
 	source "package/genpart/Config.in.host"
 	source "package/gnupg/Config.in.host"
 	source "package/go/Config.in.host"
-	source "package/go-bootstrap/Config.in.host"
+	source "package/go-bootstrap-stage1/Config.in.host"
+	source "package/go-bootstrap-stage2/Config.in.host"
 	source "package/google-breakpad/Config.in.host"
 	source "package/gptfdisk/Config.in.host"
 	source "package/imagemagick/Config.in.host"
package/go-bootstrap-stage1/Config.in.host new file +6 -0
new file mode 100644
index 0000000000..56a743caf9
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE1_ARCH_SUPPORTS
+	bool
+	# See src/cmd/dist/unix.c for the list of supported architectures
+	default y if BR2_HOSTARCH = "x86"
+	default y if BR2_HOSTARCH = "x86_64"
+	default y if BR2_HOSTARCH = "arm"
package/go-bootstrap-stage1/go-bootstrap-stage1.hash renamed from package/go-bootstrap/go-bootstrap.hash +0 -0
similarity index 100%
rename from package/go-bootstrap/go-bootstrap.hash
rename to package/go-bootstrap-stage1/go-bootstrap-stage1.hash
package/go-bootstrap-stage1/go-bootstrap-stage1.mk new file +43 -0

43 lines not on this page · raw message

package/go-bootstrap-stage2/Config.in.host new file +4 -0
new file mode 100644
index 0000000000..967ddaed1d
@@ -0,0 +1,4 @@
+config BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE2_ARCH_SUPPORTS
+	bool
+	default y
+	depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE1_ARCH_SUPPORTS
package/go-bootstrap-stage2/go-bootstrap-stage2.hash new file +3 -0
new file mode 100644
index 0000000000..874737ea2d
@@ -0,0 +1,3 @@
+# From https://go.dev/dl
+sha256  13755bcce529747d5f2930dee034730c86d02bd3e521ab3e2bbede548d3b953f  go1.19.10.src.tar.gz
+sha256  2d36597f7117c38b006835ae7f537487207d8ec407aa9d9980794b2030cbc067  LICENSE
package/go-bootstrap-stage2/go-bootstrap-stage2.mk new file +53 -0

53 lines not on this page · raw message

package/go-bootstrap/Config.in.host deleted +0 -7
deleted file mode 100644
index fab80d24b4..0000000000
@@ -1,7 +0,0 @@
-config BR2_PACKAGE_HOST_GO_BOOTSTRAP_ARCH_SUPPORTS
-	bool
-	# See src/cmd/dist/unix.c for the list of support
-	# architectures
-	default y if BR2_HOSTARCH = "x86"
-	default y if BR2_HOSTARCH = "x86_64"
-	default y if BR2_HOSTARCH = "arm"
package/go-bootstrap/go-bootstrap.mk deleted +0 -50

50 lines not on this page · raw message

package/go/Config.in.host +2 -2
index ded02d3b3a..90a54f0da6 100644
@@ -2,7 +2,7 @@
 config BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
 	bool
 	default y
-	depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE2_ARCH_SUPPORTS
 	depends on (BR2_arm && BR2_TOOLCHAIN_SUPPORTS_PIE) || BR2_aarch64 \
 		|| BR2_i386 || BR2_x86_64 || BR2_powerpc64le \
 		|| BR2_mips64 || BR2_mips64el || BR2_riscv || BR2_s390x
@@ -28,4 +28,4 @@ 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_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE2_ARCH_SUPPORTS
package/go/go.mk +2 -2
index 22b8161e05..94c90877d1 100644
@@ -12,7 +12,7 @@ GO_LICENSE = BSD-3-Clause
 GO_LICENSE_FILES = LICENSE
 GO_CPE_ID_VENDOR = golang
 
-HOST_GO_DEPENDENCIES = host-go-bootstrap
+HOST_GO_DEPENDENCIES = host-go-bootstrap-stage2
 HOST_GO_GOPATH = $(HOST_DIR)/share/go-path
 HOST_GO_HOST_CACHE = $(HOST_DIR)/share/host-go-cache
 HOST_GO_ROOT = $(HOST_DIR)/lib/go
@@ -126,7 +126,7 @@ HOST_GO_HOST_ENV = \
 HOST_GO_MAKE_ENV = \
 	GO111MODULE=off \
 	GOCACHE=$(HOST_GO_HOST_CACHE) \
-	GOROOT_BOOTSTRAP=$(HOST_GO_BOOTSTRAP_ROOT) \
+	GOROOT_BOOTSTRAP=$(HOST_GO_BOOTSTRAP_STAGE2_ROOT) \
 	GOROOT_FINAL=$(HOST_GO_ROOT) \
 	GOROOT="$(@D)" \
 	GOBIN="$(@D)/bin" \

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot