From bed91a8f11718435724f3b2999c5707c018ecab9 Mon Sep 17 00:00:00 2001 From: Zephyr Lykos Date: Mon, 19 Feb 2024 19:47:01 +0800 Subject: [PATCH] golang: Update to 1.22.0 Added a third bootstrap stage since go1.22 (and onwards) requires at least go1.20.14 to build.[1] [1]: https://go.dev/doc/go1.22#bootstrap Signed-off-by: Zephyr Lykos --- lang/golang/golang/Makefile | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/lang/golang/golang/Makefile b/lang/golang/golang/Makefile index ee99de47cf13ef..ff06c6e325c00f 100644 --- a/lang/golang/golang/Makefile +++ b/lang/golang/golang/Makefile @@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk -GO_VERSION_MAJOR_MINOR:=1.21 -GO_VERSION_PATCH:=5 +GO_VERSION_MAJOR_MINOR:=1.22 +GO_VERSION_PATCH:=0 PKG_NAME:=golang PKG_VERSION:=$(GO_VERSION_MAJOR_MINOR)$(if $(GO_VERSION_PATCH),.$(GO_VERSION_PATCH)) @@ -20,7 +20,7 @@ GO_SOURCE_URLS:=https://dl.google.com/go/ \ PKG_SOURCE:=go$(PKG_VERSION).src.tar.gz PKG_SOURCE_URL:=$(GO_SOURCE_URLS) -PKG_HASH:=285cbbdf4b6e6e62ed58f370f3f6d8c30825d6e56c5853c66d3c23bcdb09db19 +PKG_HASH:=4d196c3d41a0d6c1dfc64d04e3cc1f608b0c436bd87b7060ce3e23234e1f4d5c PKG_MAINTAINER:=Jeffery To PKG_LICENSE:=BSD-3-Clause @@ -95,6 +95,12 @@ BOOTSTRAP_1_17_HASH:=a1a48b23afb206f95e7bbaa9b898d965f90826f6f1d1fc0c1d784ada0cd BOOTSTRAP_1_17_BUILD_DIR:=$(HOST_BUILD_DIR)/.go_bootstrap_1.17 +BOOTSTRAP_1_21_SOURCE:=go1.21.5.src.tar.gz +BOOTSTRAP_1_21_SOURCE_URL:=$(GO_SOURCE_URLS) +BOOTSTRAP_1_21_HASH:=285cbbdf4b6e6e62ed58f370f3f6d8c30825d6e56c5853c66d3c23bcdb09db19 + +BOOTSTRAP_1_21_BUILD_DIR:=$(HOST_BUILD_DIR)/.go_bootstrap_1.21 + include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/package.mk include ../golang-compiler.mk @@ -104,6 +110,7 @@ PKG_UNPACK:=$(HOST_TAR) -C "$(PKG_BUILD_DIR)" --strip-components=1 -xzf "$(DL_DI HOST_UNPACK:=$(HOST_TAR) -C "$(HOST_BUILD_DIR)" --strip-components=1 -xzf "$(DL_DIR)/$(PKG_SOURCE)" BOOTSTRAP_UNPACK:=$(HOST_TAR) -C "$(BOOTSTRAP_BUILD_DIR)" --strip-components=1 -xzf "$(DL_DIR)/$(BOOTSTRAP_SOURCE)" BOOTSTRAP_1_17_UNPACK:=$(HOST_TAR) -C "$(BOOTSTRAP_1_17_BUILD_DIR)" --strip-components=1 -xzf "$(DL_DIR)/$(BOOTSTRAP_1_17_SOURCE)" +BOOTSTRAP_1_21_UNPACK:=$(HOST_TAR) -C "$(BOOTSTRAP_1_21_BUILD_DIR)" --strip-components=1 -xzf "$(DL_DIR)/$(BOOTSTRAP_1_21_SOURCE)" # don't strip ELF executables in test data RSTRIP:=: @@ -216,6 +223,22 @@ Hooks/HostPrepare/Post+=Bootstrap-1.17/Prepare $(eval $(call GoCompiler/AddProfile,Bootstrap-1.17,$(BOOTSTRAP_1_17_BUILD_DIR),,bootstrap-1.17,$(GO_HOST_OS_ARCH))) +# Bootstrap 1.21 + +define Download/golang-bootstrap-1.21 + FILE:=$(BOOTSTRAP_1_21_SOURCE) + URL:=$(BOOTSTRAP_1_21_SOURCE_URL) + HASH:=$(BOOTSTRAP_1_21_HASH) +endef +$(eval $(call Download,golang-bootstrap-1.21)) + +define Bootstrap-1.21/Prepare + mkdir -p "$(BOOTSTRAP_1_21_BUILD_DIR)" && $(BOOTSTRAP_1_21_UNPACK) ; +endef +Hooks/HostPrepare/Post+=Bootstrap-1.21/Prepare + +$(eval $(call GoCompiler/AddProfile,Bootstrap-1.21,$(BOOTSTRAP_1_21_BUILD_DIR),,bootstrap-1.21,$(GO_HOST_OS_ARCH))) + # Host ifeq ($(GO_HOST_PIE_SUPPORTED),1) @@ -251,8 +274,13 @@ define Host/Compile $(HOST_GO_VARS) \ ) - $(call GoCompiler/Host/Make, \ + $(call GoCompiler/Bootstrap-1.21/Make, \ GOROOT_BOOTSTRAP="$(BOOTSTRAP_1_17_BUILD_DIR)" \ + $(HOST_GO_VARS) \ + ) + + $(call GoCompiler/Host/Make, \ + GOROOT_BOOTSTRAP="$(BOOTSTRAP_1_21_BUILD_DIR)" \ $(if $(HOST_GO_ENABLE_PIE),GO_LDFLAGS="-buildmode pie") \ $(HOST_GO_VARS) \ )