Initial Commit
- initial default booting image
This commit is contained in:
94
package/go/Config.in.host
Normal file
94
package/go/Config.in.host
Normal file
@@ -0,0 +1,94 @@
|
||||
# Target go packages should depend on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
|
||||
config BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
|
||||
bool
|
||||
default y
|
||||
depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE5_ARCH_SUPPORTS || BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH_SUPPORTS
|
||||
# See https://go.dev/doc/install/source#environment
|
||||
# See src/go/build/syslist.go for the list of supported architectures
|
||||
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
|
||||
depends on !BR2_ARM_CPU_ARMV4
|
||||
# MIPS R6 support in Go has not yet been developed.
|
||||
depends on !BR2_MIPS_CPU_MIPS64R6
|
||||
# Go doesn't support Risc-v 32-bit.
|
||||
depends on !BR2_RISCV_32
|
||||
# Go requires the following Risc-v General (G) features:
|
||||
depends on !BR2_riscv || (BR2_RISCV_ISA_RVI && \
|
||||
BR2_RISCV_ISA_RVM && BR2_RISCV_ISA_RVA && \
|
||||
BR2_RISCV_ISA_RVF && BR2_RISCV_ISA_RVD)
|
||||
|
||||
config BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS
|
||||
bool
|
||||
default y
|
||||
depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
|
||||
# Go doesn't support CGO linking on MIPS64x platforms
|
||||
# See: https://github.com/karalabe/xgo/issues/46
|
||||
depends on !BR2_mips64 && !BR2_mips64el
|
||||
# go uses dlfcn.h + cgo for its plugin module
|
||||
depends on !BR2_STATIC_LIBS
|
||||
# cgo supports uses threads
|
||||
depends on BR2_TOOLCHAIN_HAS_THREADS
|
||||
|
||||
# Host go packages should depend on BR2_PACKAGE_HOST_GO_HOST_ARCH_SUPPORTS
|
||||
config BR2_PACKAGE_HOST_GO_HOST_ARCH_SUPPORTS
|
||||
bool
|
||||
default y
|
||||
depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE5_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.
|
||||
# But if the target is not supported by Go, then the host can do CGO
|
||||
# linking (except when it itself does not support CGO linking).
|
||||
config BR2_PACKAGE_HOST_GO_HOST_CGO_LINKING_SUPPORTS
|
||||
bool
|
||||
default y if BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS
|
||||
default y if !BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
|
||||
depends on BR2_PACKAGE_HOST_GO_HOST_ARCH_SUPPORTS
|
||||
depends on BR2_HOSTARCH != "mips64"
|
||||
depends on BR2_HOSTARCH != "mips64el"
|
||||
|
||||
# Go packages should select BR2_PACKAGE_HOST_GO
|
||||
config BR2_PACKAGE_HOST_GO
|
||||
bool "host go"
|
||||
depends on BR2_PACKAGE_HOST_GO_HOST_ARCH_SUPPORTS
|
||||
|
||||
if BR2_PACKAGE_HOST_GO
|
||||
|
||||
choice
|
||||
prompt "Go compiler variant"
|
||||
default BR2_PACKAGE_HOST_GO_SRC if BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE5_ARCH_SUPPORTS
|
||||
default BR2_PACKAGE_HOST_GO_BIN if BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH_SUPPORTS
|
||||
help
|
||||
Select a Go compiler variant.
|
||||
|
||||
Default to 'host-go-src'.
|
||||
|
||||
config BR2_PACKAGE_HOST_GO_SRC
|
||||
bool "host go (source)"
|
||||
depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE5_ARCH_SUPPORTS
|
||||
help
|
||||
This package will build the go compiler for the host.
|
||||
|
||||
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
|
||||
|
||||
endchoice
|
||||
|
||||
endif
|
||||
|
||||
config BR2_PACKAGE_PROVIDES_HOST_GO
|
||||
string
|
||||
# Default to host-go-bin unless src explicitly requested
|
||||
default "host-go-src" if BR2_PACKAGE_HOST_GO_SRC
|
||||
default "host-go-bin"
|
||||
|
||||
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"
|
||||
source "package/go/go-bootstrap-stage4/Config.in.host"
|
||||
source "package/go/go-bootstrap-stage5/Config.in.host"
|
||||
14
package/go/go-bin/Config.in.host
Normal file
14
package/go/go-bin/Config.in.host
Normal file
@@ -0,0 +1,14 @@
|
||||
# Translate the HOSTARCH into the architecture name used by the Go compiler
|
||||
config BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH
|
||||
string
|
||||
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 != ""
|
||||
1
package/go/go-bin/go-bin.hash
Symbolic link
1
package/go/go-bin/go-bin.hash
Symbolic link
@@ -0,0 +1 @@
|
||||
../go.hash
|
||||
23
package/go/go-bin/go-bin.mk
Normal file
23
package/go/go-bin/go-bin.mk
Normal file
@@ -0,0 +1,23 @@
|
||||
################################################################################
|
||||
#
|
||||
# go-bin
|
||||
#
|
||||
################################################################################
|
||||
|
||||
GO_BIN_VERSION = $(GO_VERSION)
|
||||
GO_BIN_SITE = https://go.dev/dl
|
||||
GO_BIN_SOURCE = go$(GO_VERSION).linux-$(call qstrip, $(BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH)).tar.gz
|
||||
GO_BIN_DL_SUBDIR = go
|
||||
HOST_GO_BIN_ACTUAL_SOURCE_TARBALL = go$(GO_VERSION).src.tar.gz
|
||||
GO_BIN_LICENSE = BSD-3-Clause
|
||||
GO_BIN_LICENSE_FILES = LICENSE
|
||||
GO_BIN_CPE_ID_VENDOR = golang
|
||||
GO_BIN_CPE_ID_PRODUCT = go
|
||||
|
||||
HOST_GO_BIN_PROVIDES = host-go
|
||||
|
||||
define HOST_GO_BIN_INSTALL_CMDS
|
||||
$(GO_BINARIES_INSTALL)
|
||||
endef
|
||||
|
||||
$(eval $(host-generic-package))
|
||||
6
package/go/go-bootstrap-stage1/Config.in.host
Normal file
6
package/go/go-bootstrap-stage1/Config.in.host
Normal file
@@ -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"
|
||||
3
package/go/go-bootstrap-stage1/go-bootstrap-stage1.hash
Normal file
3
package/go/go-bootstrap-stage1/go-bootstrap-stage1.hash
Normal file
@@ -0,0 +1,3 @@
|
||||
# Locally computed:
|
||||
sha256 f4ff5b5eb3a3cae1c993723f3eab519c5bae18866b5e5f96fe1102f0cb5c3e52 go1.4-bootstrap-20171003.tar.gz
|
||||
sha256 dd26a7abddd02e2d0aba97805b31f248ef7835d9e10da289b22e3b8ab78b324d LICENSE
|
||||
44
package/go/go-bootstrap-stage1/go-bootstrap-stage1.mk
Normal file
44
package/go/go-bootstrap-stage1/go-bootstrap-stage1.mk
Normal file
@@ -0,0 +1,44 @@
|
||||
################################################################################
|
||||
#
|
||||
# go-bootstrap-stage1
|
||||
#
|
||||
################################################################################
|
||||
|
||||
# Use last C-based Go compiler: v1.4.x
|
||||
# See https://golang.org/doc/install/source#bootstrapFromSource
|
||||
GO_BOOTSTRAP_STAGE1_VERSION = 1.4-bootstrap-20171003
|
||||
GO_BOOTSTRAP_STAGE1_SITE = https://dl.google.com/go
|
||||
GO_BOOTSTRAP_STAGE1_SOURCE = go$(GO_BOOTSTRAP_STAGE1_VERSION).tar.gz
|
||||
|
||||
GO_BOOTSTRAP_STAGE1_LICENSE = BSD-3-Clause
|
||||
GO_BOOTSTRAP_STAGE1_LICENSE_FILES = LICENSE
|
||||
|
||||
HOST_GO_BOOTSTRAP_STAGE1_ROOT = $(HOST_DIR)/lib/go-$(GO_BOOTSTRAP_STAGE1_VERSION)
|
||||
|
||||
# The go build system is not compatible with ccache, so use
|
||||
# HOSTCC_NOCCACHE. See https://github.com/golang/go/issues/11685.
|
||||
# CFLAGS and GO_CCFLAGS have no effect, so overwrite CC directly.
|
||||
HOST_GO_BOOTSTRAP_STAGE1_MAKE_ENV = \
|
||||
GOOS=linux \
|
||||
GOROOT_FINAL="$(HOST_GO_BOOTSTRAP_STAGE1_ROOT)" \
|
||||
GOROOT="$(@D)" \
|
||||
GOBIN="$(@D)/bin" \
|
||||
CC="$(HOSTCC_NOCCACHE) -std=gnu99" \
|
||||
CGO_ENABLED=0
|
||||
|
||||
define HOST_GO_BOOTSTRAP_STAGE1_BUILD_CMDS
|
||||
cd $(@D)/src && $(HOST_GO_BOOTSTRAP_STAGE1_MAKE_ENV) ./make.bash
|
||||
endef
|
||||
|
||||
define HOST_GO_BOOTSTRAP_STAGE1_INSTALL_CMDS
|
||||
$(INSTALL) -D -m 0755 $(@D)/bin/go $(HOST_GO_BOOTSTRAP_STAGE1_ROOT)/bin/go
|
||||
$(INSTALL) -D -m 0755 $(@D)/bin/gofmt $(HOST_GO_BOOTSTRAP_STAGE1_ROOT)/bin/gofmt
|
||||
|
||||
cp -a $(@D)/lib $(HOST_GO_BOOTSTRAP_STAGE1_ROOT)/
|
||||
cp -a $(@D)/pkg $(HOST_GO_BOOTSTRAP_STAGE1_ROOT)/
|
||||
|
||||
# The Go sources must be installed to the host/ tree for the Go stdlib.
|
||||
cp -a $(@D)/src $(HOST_GO_BOOTSTRAP_STAGE1_ROOT)/
|
||||
endef
|
||||
|
||||
$(eval $(host-generic-package))
|
||||
4
package/go/go-bootstrap-stage2/Config.in.host
Normal file
4
package/go/go-bootstrap-stage2/Config.in.host
Normal file
@@ -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
|
||||
3
package/go/go-bootstrap-stage2/go-bootstrap-stage2.hash
Normal file
3
package/go/go-bootstrap-stage2/go-bootstrap-stage2.hash
Normal file
@@ -0,0 +1,3 @@
|
||||
# From https://go.dev/dl
|
||||
sha256 ccf36b53fb0024a017353c3ddb22c1f00bc7a8073c6aac79042da24ee34434d3 go1.19.13.src.tar.gz
|
||||
sha256 2d36597f7117c38b006835ae7f537487207d8ec407aa9d9980794b2030cbc067 LICENSE
|
||||
53
package/go/go-bootstrap-stage2/go-bootstrap-stage2.mk
Normal file
53
package/go/go-bootstrap-stage2/go-bootstrap-stage2.mk
Normal file
@@ -0,0 +1,53 @@
|
||||
################################################################################
|
||||
#
|
||||
# go-bootstrap-stage2
|
||||
#
|
||||
################################################################################
|
||||
|
||||
# Use last Go version that go-bootstrap-stage1 can build: v1.19.x
|
||||
# See https://golang.org/doc/install/source#bootstrapFromSource
|
||||
GO_BOOTSTRAP_STAGE2_VERSION = 1.19.13
|
||||
GO_BOOTSTRAP_STAGE2_SITE = https://go.dev/dl
|
||||
GO_BOOTSTRAP_STAGE2_SOURCE = go$(GO_BOOTSTRAP_STAGE2_VERSION).src.tar.gz
|
||||
|
||||
GO_BOOTSTRAP_STAGE2_LICENSE = BSD-3-Clause
|
||||
GO_BOOTSTRAP_STAGE2_LICENSE_FILES = LICENSE
|
||||
|
||||
# Use go-bootstrap-stage1 to bootstrap.
|
||||
HOST_GO_BOOTSTRAP_STAGE2_DEPENDENCIES = host-go-bootstrap-stage1
|
||||
|
||||
HOST_GO_BOOTSTRAP_STAGE2_ROOT = $(HOST_DIR)/lib/go-$(GO_BOOTSTRAP_STAGE2_VERSION)
|
||||
|
||||
# The go build system is not compatible with ccache, so use
|
||||
# HOSTCC_NOCCACHE. See https://github.com/golang/go/issues/11685.
|
||||
HOST_GO_BOOTSTRAP_STAGE2_MAKE_ENV = \
|
||||
GO111MODULE=off \
|
||||
GOROOT_BOOTSTRAP=$(HOST_GO_BOOTSTRAP_STAGE1_ROOT) \
|
||||
GOROOT_FINAL=$(HOST_GO_BOOTSTRAP_STAGE2_ROOT) \
|
||||
GOROOT="$(@D)" \
|
||||
GOBIN="$(@D)/bin" \
|
||||
GOOS=linux \
|
||||
CC=$(HOSTCC_NOCCACHE) \
|
||||
CXX=$(HOSTCXX_NOCCACHE) \
|
||||
CGO_ENABLED=0
|
||||
|
||||
define HOST_GO_BOOTSTRAP_STAGE2_BUILD_CMDS
|
||||
cd $(@D)/src && \
|
||||
$(HOST_GO_BOOTSTRAP_STAGE2_MAKE_ENV) ./make.bash $(if $(VERBOSE),-v)
|
||||
endef
|
||||
|
||||
define HOST_GO_BOOTSTRAP_STAGE2_INSTALL_CMDS
|
||||
$(INSTALL) -D -m 0755 $(@D)/bin/go $(HOST_GO_BOOTSTRAP_STAGE2_ROOT)/bin/go
|
||||
$(INSTALL) -D -m 0755 $(@D)/bin/gofmt $(HOST_GO_BOOTSTRAP_STAGE2_ROOT)/bin/gofmt
|
||||
|
||||
cp -a $(@D)/lib $(HOST_GO_BOOTSTRAP_STAGE2_ROOT)/
|
||||
|
||||
mkdir -p $(HOST_GO_BOOTSTRAP_STAGE2_ROOT)/pkg
|
||||
cp -a $(@D)/pkg/include $(@D)/pkg/linux_* $(HOST_GO_BOOTSTRAP_STAGE2_ROOT)/pkg/
|
||||
cp -a $(@D)/pkg/tool $(HOST_GO_BOOTSTRAP_STAGE2_ROOT)/pkg/
|
||||
|
||||
# The Go sources must be installed to the host/ tree for the Go stdlib.
|
||||
cp -a $(@D)/src $(HOST_GO_BOOTSTRAP_STAGE2_ROOT)/
|
||||
endef
|
||||
|
||||
$(eval $(host-generic-package))
|
||||
@@ -0,0 +1,71 @@
|
||||
From 6b05378097c6a386ed9912d2471976dc39504e86 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Stewart <christian@aperture.us>
|
||||
Date: Thu, 27 Jul 2023 21:28:47 -0700
|
||||
Subject: [PATCH] cmd/dist: set buildvcs=false when building go-bootstrap
|
||||
|
||||
When building go-bootstrap as part of the make.bash process, the cmd/dist
|
||||
invokes the bootstrap Go compiler to build the go_bootstrap tool:
|
||||
|
||||
${GOROOT_BOOTSTRAP}/bin/go install -tags=math_big_pure_go compiler_bootstrap purego bootstrap/cmd/...
|
||||
|
||||
If there is an invalid .git directory in a parent of ${GOROOT_BOOTSTRAP},
|
||||
make.bash will fail. Reproduction of the issue:
|
||||
|
||||
mkdir go-issue-61620
|
||||
cd ./go-issue-61620
|
||||
wget https://go.dev/dl/go1.19.11.src.tar.gz
|
||||
mkdir go-bootstrap
|
||||
tar -xf go1.19.11.src.tar.gz -C ./go-bootstrap --strip-components=1
|
||||
cd ./go-bootstrap/src/
|
||||
bash make.bash
|
||||
cd ../../
|
||||
wget https://go.dev/dl/go1.20.6.src.tar.gz
|
||||
mkdir go
|
||||
tar -xf go1.20.6.src.tar.gz -C ./go/ --strip-components=1
|
||||
printf "gitdir: ../../does/not/exist/.git" > ./.git
|
||||
cd ./go/src/
|
||||
GOROOT_BOOTSTRAP=$(pwd)/../../go-bootstrap/ bash make.bash
|
||||
|
||||
The build fails with the following error:
|
||||
|
||||
Building Go toolchain1 using [snip]/go-1.19.10.
|
||||
error obtaining VCS status: exit status 128
|
||||
Use -buildvcs=false to disable VCS stamping.
|
||||
go tool dist: FAILED: [snip]/go-1.19.10/bin/go install -tags=math_big_pure_go \
|
||||
compiler_bootstrap purego bootstrap/cmd/...: exit status 1
|
||||
|
||||
This change unconditionally sets -buildvcs=false when compiling go-bootstrap. We
|
||||
don't need the revision information in those binaries anyway. Setting this flag
|
||||
was previously not done as we were unsure if the go-bootstrap compiler would be
|
||||
new enough to support the buildvcs build flag. Since Go 1.20.x, Go 1.19.x is the
|
||||
minimum version for go-bootstrap, and supports -buildvcs=false. We can now set
|
||||
-buildvcs=false without worrying about compatibility.
|
||||
|
||||
Related: https://github.com/golang/go/issues/54852
|
||||
Fixes: https://github.com/golang/go/issues/61620
|
||||
|
||||
Upstream: https://github.com/golang/go/pull/61621
|
||||
|
||||
Signed-off-by: Christian Stewart <christian@aperture.us>
|
||||
Signed-off-by: Romain Naour <romain.naour@smile.fr>
|
||||
---
|
||||
src/cmd/dist/buildtool.go | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/src/cmd/dist/buildtool.go b/src/cmd/dist/buildtool.go
|
||||
index a528d7aa76..3b411d6ebb 100644
|
||||
--- a/src/cmd/dist/buildtool.go
|
||||
+++ b/src/cmd/dist/buildtool.go
|
||||
@@ -221,6 +221,9 @@ func bootstrapBuildTools() {
|
||||
cmd := []string{
|
||||
pathf("%s/bin/go", goroot_bootstrap),
|
||||
"install",
|
||||
+ // Fixes cases where an invalid .git is present in a parent of GOROOT_BOOTSTRAP.
|
||||
+ // See: https://github.com/golang/go/issues/61620
|
||||
+ "-buildvcs=false",
|
||||
"-tags=math_big_pure_go compiler_bootstrap purego",
|
||||
}
|
||||
if vflag > 0 {
|
||||
--
|
||||
2.41.0
|
||||
|
||||
4
package/go/go-bootstrap-stage3/Config.in.host
Normal file
4
package/go/go-bootstrap-stage3/Config.in.host
Normal file
@@ -0,0 +1,4 @@
|
||||
config BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS
|
||||
bool
|
||||
default y
|
||||
depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE2_ARCH_SUPPORTS
|
||||
3
package/go/go-bootstrap-stage3/go-bootstrap-stage3.hash
Normal file
3
package/go/go-bootstrap-stage3/go-bootstrap-stage3.hash
Normal file
@@ -0,0 +1,3 @@
|
||||
# From https://go.dev/dl
|
||||
sha256 dc806cf75a87e1414b5b4c3dcb9dd3e9cc98f4cfccec42b7af617d5a658a3c43 go1.21.8.src.tar.gz
|
||||
sha256 2d36597f7117c38b006835ae7f537487207d8ec407aa9d9980794b2030cbc067 LICENSE
|
||||
54
package/go/go-bootstrap-stage3/go-bootstrap-stage3.mk
Normal file
54
package/go/go-bootstrap-stage3/go-bootstrap-stage3.mk
Normal file
@@ -0,0 +1,54 @@
|
||||
################################################################################
|
||||
#
|
||||
# go-bootstrap-stage3
|
||||
#
|
||||
################################################################################
|
||||
|
||||
# Use last Go version that go-bootstrap-stage2 can build: v1.21.x
|
||||
# See https://go.dev/doc/go1.22#bootstrap
|
||||
GO_BOOTSTRAP_STAGE3_VERSION = 1.21.8
|
||||
GO_BOOTSTRAP_STAGE3_SITE = https://go.dev/dl
|
||||
GO_BOOTSTRAP_STAGE3_SOURCE = go$(GO_BOOTSTRAP_STAGE3_VERSION).src.tar.gz
|
||||
|
||||
GO_BOOTSTRAP_STAGE3_LICENSE = BSD-3-Clause
|
||||
GO_BOOTSTRAP_STAGE3_LICENSE_FILES = LICENSE
|
||||
|
||||
# Use go-bootstrap-stage2 to bootstrap.
|
||||
HOST_GO_BOOTSTRAP_STAGE3_DEPENDENCIES = host-go-bootstrap-stage2
|
||||
|
||||
HOST_GO_BOOTSTRAP_STAGE3_ROOT = $(HOST_DIR)/lib/go-$(GO_BOOTSTRAP_STAGE3_VERSION)
|
||||
|
||||
# The go build system is not compatible with ccache, so use
|
||||
# HOSTCC_NOCCACHE. See https://github.com/golang/go/issues/11685.
|
||||
HOST_GO_BOOTSTRAP_STAGE3_MAKE_ENV = \
|
||||
GO111MODULE=off \
|
||||
GOCACHE=$(HOST_GO_HOST_CACHE) \
|
||||
GOROOT_BOOTSTRAP=$(HOST_GO_BOOTSTRAP_STAGE2_ROOT) \
|
||||
GOROOT_FINAL=$(HOST_GO_BOOTSTRAP_STAGE3_ROOT) \
|
||||
GOROOT="$(@D)" \
|
||||
GOBIN="$(@D)/bin" \
|
||||
GOOS=linux \
|
||||
CC=$(HOSTCC_NOCCACHE) \
|
||||
CXX=$(HOSTCXX_NOCCACHE) \
|
||||
CGO_ENABLED=0
|
||||
|
||||
define HOST_GO_BOOTSTRAP_STAGE3_BUILD_CMDS
|
||||
cd $(@D)/src && \
|
||||
$(HOST_GO_BOOTSTRAP_STAGE3_MAKE_ENV) ./make.bash $(if $(VERBOSE),-v)
|
||||
endef
|
||||
|
||||
define HOST_GO_BOOTSTRAP_STAGE3_INSTALL_CMDS
|
||||
$(INSTALL) -D -m 0755 $(@D)/bin/go $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/bin/go
|
||||
$(INSTALL) -D -m 0755 $(@D)/bin/gofmt $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/bin/gofmt
|
||||
|
||||
cp -a $(@D)/lib $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/
|
||||
|
||||
mkdir -p $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/pkg
|
||||
cp -a $(@D)/pkg/include $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/pkg/
|
||||
cp -a $(@D)/pkg/tool $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/pkg/
|
||||
|
||||
# The Go sources must be installed to the host/ tree for the Go stdlib.
|
||||
cp -a $(@D)/src $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/
|
||||
endef
|
||||
|
||||
$(eval $(host-generic-package))
|
||||
@@ -0,0 +1,71 @@
|
||||
From 6b05378097c6a386ed9912d2471976dc39504e86 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Stewart <christian@aperture.us>
|
||||
Date: Thu, 27 Jul 2023 21:28:47 -0700
|
||||
Subject: [PATCH] cmd/dist: set buildvcs=false when building go-bootstrap
|
||||
|
||||
When building go-bootstrap as part of the make.bash process, the cmd/dist
|
||||
invokes the bootstrap Go compiler to build the go_bootstrap tool:
|
||||
|
||||
${GOROOT_BOOTSTRAP}/bin/go install -tags=math_big_pure_go compiler_bootstrap purego bootstrap/cmd/...
|
||||
|
||||
If there is an invalid .git directory in a parent of ${GOROOT_BOOTSTRAP},
|
||||
make.bash will fail. Reproduction of the issue:
|
||||
|
||||
mkdir go-issue-61620
|
||||
cd ./go-issue-61620
|
||||
wget https://go.dev/dl/go1.19.11.src.tar.gz
|
||||
mkdir go-bootstrap
|
||||
tar -xf go1.19.11.src.tar.gz -C ./go-bootstrap --strip-components=1
|
||||
cd ./go-bootstrap/src/
|
||||
bash make.bash
|
||||
cd ../../
|
||||
wget https://go.dev/dl/go1.20.6.src.tar.gz
|
||||
mkdir go
|
||||
tar -xf go1.20.6.src.tar.gz -C ./go/ --strip-components=1
|
||||
printf "gitdir: ../../does/not/exist/.git" > ./.git
|
||||
cd ./go/src/
|
||||
GOROOT_BOOTSTRAP=$(pwd)/../../go-bootstrap/ bash make.bash
|
||||
|
||||
The build fails with the following error:
|
||||
|
||||
Building Go toolchain1 using [snip]/go-1.19.10.
|
||||
error obtaining VCS status: exit status 128
|
||||
Use -buildvcs=false to disable VCS stamping.
|
||||
go tool dist: FAILED: [snip]/go-1.19.10/bin/go install -tags=math_big_pure_go \
|
||||
compiler_bootstrap purego bootstrap/cmd/...: exit status 1
|
||||
|
||||
This change unconditionally sets -buildvcs=false when compiling go-bootstrap. We
|
||||
don't need the revision information in those binaries anyway. Setting this flag
|
||||
was previously not done as we were unsure if the go-bootstrap compiler would be
|
||||
new enough to support the buildvcs build flag. Since Go 1.20.x, Go 1.19.x is the
|
||||
minimum version for go-bootstrap, and supports -buildvcs=false. We can now set
|
||||
-buildvcs=false without worrying about compatibility.
|
||||
|
||||
Related: https://github.com/golang/go/issues/54852
|
||||
Fixes: https://github.com/golang/go/issues/61620
|
||||
|
||||
Upstream: https://github.com/golang/go/pull/61621
|
||||
|
||||
Signed-off-by: Christian Stewart <christian@aperture.us>
|
||||
Signed-off-by: Romain Naour <romain.naour@smile.fr>
|
||||
---
|
||||
src/cmd/dist/buildtool.go | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/src/cmd/dist/buildtool.go b/src/cmd/dist/buildtool.go
|
||||
index a528d7aa76..3b411d6ebb 100644
|
||||
--- a/src/cmd/dist/buildtool.go
|
||||
+++ b/src/cmd/dist/buildtool.go
|
||||
@@ -221,6 +221,9 @@ func bootstrapBuildTools() {
|
||||
cmd := []string{
|
||||
pathf("%s/bin/go", goroot_bootstrap),
|
||||
"install",
|
||||
+ // Fixes cases where an invalid .git is present in a parent of GOROOT_BOOTSTRAP.
|
||||
+ // See: https://github.com/golang/go/issues/61620
|
||||
+ "-buildvcs=false",
|
||||
"-tags=math_big_pure_go compiler_bootstrap purego",
|
||||
}
|
||||
if vflag > 0 {
|
||||
--
|
||||
2.41.0
|
||||
|
||||
4
package/go/go-bootstrap-stage4/Config.in.host
Normal file
4
package/go/go-bootstrap-stage4/Config.in.host
Normal file
@@ -0,0 +1,4 @@
|
||||
config BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE4_ARCH_SUPPORTS
|
||||
bool
|
||||
default y
|
||||
depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS
|
||||
3
package/go/go-bootstrap-stage4/go-bootstrap-stage4.hash
Normal file
3
package/go/go-bootstrap-stage4/go-bootstrap-stage4.hash
Normal file
@@ -0,0 +1,3 @@
|
||||
# From https://go.dev/dl
|
||||
sha256 e1cce9379a24e895714a412c7ddd157d2614d9edbe83a84449b6e1840b4f1226 go1.23.12.src.tar.gz
|
||||
sha256 2d36597f7117c38b006835ae7f537487207d8ec407aa9d9980794b2030cbc067 LICENSE
|
||||
54
package/go/go-bootstrap-stage4/go-bootstrap-stage4.mk
Normal file
54
package/go/go-bootstrap-stage4/go-bootstrap-stage4.mk
Normal file
@@ -0,0 +1,54 @@
|
||||
################################################################################
|
||||
#
|
||||
# go-bootstrap-stage4
|
||||
#
|
||||
################################################################################
|
||||
|
||||
# Use last Go version that go-bootstrap-stage3 can build: v1.23.x
|
||||
# See https://go.dev/doc/go1.24#bootstrap
|
||||
GO_BOOTSTRAP_STAGE4_VERSION = 1.23.12
|
||||
GO_BOOTSTRAP_STAGE4_SITE = https://go.dev/dl
|
||||
GO_BOOTSTRAP_STAGE4_SOURCE = go$(GO_BOOTSTRAP_STAGE4_VERSION).src.tar.gz
|
||||
|
||||
GO_BOOTSTRAP_STAGE4_LICENSE = BSD-3-Clause
|
||||
GO_BOOTSTRAP_STAGE4_LICENSE_FILES = LICENSE
|
||||
|
||||
# Use go-bootstrap-stage3 to bootstrap.
|
||||
HOST_GO_BOOTSTRAP_STAGE4_DEPENDENCIES = host-go-bootstrap-stage3
|
||||
|
||||
HOST_GO_BOOTSTRAP_STAGE4_ROOT = $(HOST_DIR)/lib/go-$(GO_BOOTSTRAP_STAGE4_VERSION)
|
||||
|
||||
# The go build system is not compatible with ccache, so use
|
||||
# HOSTCC_NOCCACHE. See https://github.com/golang/go/issues/11685.
|
||||
HOST_GO_BOOTSTRAP_STAGE4_MAKE_ENV = \
|
||||
GO111MODULE=off \
|
||||
GOCACHE=$(HOST_GO_HOST_CACHE) \
|
||||
GOROOT_BOOTSTRAP=$(HOST_GO_BOOTSTRAP_STAGE3_ROOT) \
|
||||
GOROOT_FINAL=$(HOST_GO_BOOTSTRAP_STAGE4_ROOT) \
|
||||
GOROOT="$(@D)" \
|
||||
GOBIN="$(@D)/bin" \
|
||||
GOOS=linux \
|
||||
CC=$(HOSTCC_NOCCACHE) \
|
||||
CXX=$(HOSTCXX_NOCCACHE) \
|
||||
CGO_ENABLED=0
|
||||
|
||||
define HOST_GO_BOOTSTRAP_STAGE4_BUILD_CMDS
|
||||
cd $(@D)/src && \
|
||||
$(HOST_GO_BOOTSTRAP_STAGE4_MAKE_ENV) ./make.bash $(if $(VERBOSE),-v)
|
||||
endef
|
||||
|
||||
define HOST_GO_BOOTSTRAP_STAGE4_INSTALL_CMDS
|
||||
$(INSTALL) -D -m 0755 $(@D)/bin/go $(HOST_GO_BOOTSTRAP_STAGE4_ROOT)/bin/go
|
||||
$(INSTALL) -D -m 0755 $(@D)/bin/gofmt $(HOST_GO_BOOTSTRAP_STAGE4_ROOT)/bin/gofmt
|
||||
|
||||
cp -a $(@D)/lib $(HOST_GO_BOOTSTRAP_STAGE4_ROOT)/
|
||||
|
||||
mkdir -p $(HOST_GO_BOOTSTRAP_STAGE4_ROOT)/pkg
|
||||
cp -a $(@D)/pkg/include $(HOST_GO_BOOTSTRAP_STAGE4_ROOT)/pkg/
|
||||
cp -a $(@D)/pkg/tool $(HOST_GO_BOOTSTRAP_STAGE4_ROOT)/pkg/
|
||||
|
||||
# The Go sources must be installed to the host/ tree for the Go stdlib.
|
||||
cp -a $(@D)/src $(HOST_GO_BOOTSTRAP_STAGE4_ROOT)/
|
||||
endef
|
||||
|
||||
$(eval $(host-generic-package))
|
||||
@@ -0,0 +1,71 @@
|
||||
From 6b05378097c6a386ed9912d2471976dc39504e86 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Stewart <christian@aperture.us>
|
||||
Date: Thu, 27 Jul 2023 21:28:47 -0700
|
||||
Subject: [PATCH] cmd/dist: set buildvcs=false when building go-bootstrap
|
||||
|
||||
When building go-bootstrap as part of the make.bash process, the cmd/dist
|
||||
invokes the bootstrap Go compiler to build the go_bootstrap tool:
|
||||
|
||||
${GOROOT_BOOTSTRAP}/bin/go install -tags=math_big_pure_go compiler_bootstrap purego bootstrap/cmd/...
|
||||
|
||||
If there is an invalid .git directory in a parent of ${GOROOT_BOOTSTRAP},
|
||||
make.bash will fail. Reproduction of the issue:
|
||||
|
||||
mkdir go-issue-61620
|
||||
cd ./go-issue-61620
|
||||
wget https://go.dev/dl/go1.19.11.src.tar.gz
|
||||
mkdir go-bootstrap
|
||||
tar -xf go1.19.11.src.tar.gz -C ./go-bootstrap --strip-components=1
|
||||
cd ./go-bootstrap/src/
|
||||
bash make.bash
|
||||
cd ../../
|
||||
wget https://go.dev/dl/go1.20.6.src.tar.gz
|
||||
mkdir go
|
||||
tar -xf go1.20.6.src.tar.gz -C ./go/ --strip-components=1
|
||||
printf "gitdir: ../../does/not/exist/.git" > ./.git
|
||||
cd ./go/src/
|
||||
GOROOT_BOOTSTRAP=$(pwd)/../../go-bootstrap/ bash make.bash
|
||||
|
||||
The build fails with the following error:
|
||||
|
||||
Building Go toolchain1 using [snip]/go-1.19.10.
|
||||
error obtaining VCS status: exit status 128
|
||||
Use -buildvcs=false to disable VCS stamping.
|
||||
go tool dist: FAILED: [snip]/go-1.19.10/bin/go install -tags=math_big_pure_go \
|
||||
compiler_bootstrap purego bootstrap/cmd/...: exit status 1
|
||||
|
||||
This change unconditionally sets -buildvcs=false when compiling go-bootstrap. We
|
||||
don't need the revision information in those binaries anyway. Setting this flag
|
||||
was previously not done as we were unsure if the go-bootstrap compiler would be
|
||||
new enough to support the buildvcs build flag. Since Go 1.20.x, Go 1.19.x is the
|
||||
minimum version for go-bootstrap, and supports -buildvcs=false. We can now set
|
||||
-buildvcs=false without worrying about compatibility.
|
||||
|
||||
Related: https://github.com/golang/go/issues/54852
|
||||
Fixes: https://github.com/golang/go/issues/61620
|
||||
|
||||
Upstream: https://github.com/golang/go/pull/61621
|
||||
|
||||
Signed-off-by: Christian Stewart <christian@aperture.us>
|
||||
Signed-off-by: Romain Naour <romain.naour@smile.fr>
|
||||
---
|
||||
src/cmd/dist/buildtool.go | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/src/cmd/dist/buildtool.go b/src/cmd/dist/buildtool.go
|
||||
index a528d7aa76..3b411d6ebb 100644
|
||||
--- a/src/cmd/dist/buildtool.go
|
||||
+++ b/src/cmd/dist/buildtool.go
|
||||
@@ -221,6 +221,9 @@ func bootstrapBuildTools() {
|
||||
cmd := []string{
|
||||
pathf("%s/bin/go", goroot_bootstrap),
|
||||
"install",
|
||||
+ // Fixes cases where an invalid .git is present in a parent of GOROOT_BOOTSTRAP.
|
||||
+ // See: https://github.com/golang/go/issues/61620
|
||||
+ "-buildvcs=false",
|
||||
"-tags=math_big_pure_go compiler_bootstrap purego",
|
||||
}
|
||||
if vflag > 0 {
|
||||
--
|
||||
2.41.0
|
||||
|
||||
4
package/go/go-bootstrap-stage5/Config.in.host
Normal file
4
package/go/go-bootstrap-stage5/Config.in.host
Normal file
@@ -0,0 +1,4 @@
|
||||
config BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE5_ARCH_SUPPORTS
|
||||
bool
|
||||
default y
|
||||
depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE4_ARCH_SUPPORTS
|
||||
3
package/go/go-bootstrap-stage5/go-bootstrap-stage5.hash
Normal file
3
package/go/go-bootstrap-stage5/go-bootstrap-stage5.hash
Normal file
@@ -0,0 +1,3 @@
|
||||
# From https://go.dev/dl
|
||||
sha256 20cf04a92e5af99748e341bc8996fa28090c9ac98765fa115ec5ddf41d7af41d go1.25.10.src.tar.gz
|
||||
sha256 911f8f5782931320f5b8d1160a76365b83aea6447ee6c04fa6d5591467db9dad LICENSE
|
||||
54
package/go/go-bootstrap-stage5/go-bootstrap-stage5.mk
Normal file
54
package/go/go-bootstrap-stage5/go-bootstrap-stage5.mk
Normal file
@@ -0,0 +1,54 @@
|
||||
################################################################################
|
||||
#
|
||||
# go-bootstrap-stage5
|
||||
#
|
||||
################################################################################
|
||||
|
||||
# Use last Go version that go-bootstrap-stage4 can build: v1.25.x
|
||||
# See https://go.dev/doc/go1.26#bootstrap
|
||||
GO_BOOTSTRAP_STAGE5_VERSION = 1.25.10
|
||||
GO_BOOTSTRAP_STAGE5_SITE = https://go.dev/dl
|
||||
GO_BOOTSTRAP_STAGE5_SOURCE = go$(GO_BOOTSTRAP_STAGE5_VERSION).src.tar.gz
|
||||
|
||||
GO_BOOTSTRAP_STAGE5_LICENSE = BSD-3-Clause
|
||||
GO_BOOTSTRAP_STAGE5_LICENSE_FILES = LICENSE
|
||||
|
||||
# Use go-bootstrap-stage4 to bootstrap.
|
||||
HOST_GO_BOOTSTRAP_STAGE5_DEPENDENCIES = host-go-bootstrap-stage4
|
||||
|
||||
HOST_GO_BOOTSTRAP_STAGE5_ROOT = $(HOST_DIR)/lib/go-$(GO_BOOTSTRAP_STAGE5_VERSION)
|
||||
|
||||
# The go build system is not compatible with ccache, so use
|
||||
# HOSTCC_NOCCACHE. See https://github.com/golang/go/issues/11685.
|
||||
HOST_GO_BOOTSTRAP_STAGE5_MAKE_ENV = \
|
||||
GO111MODULE=off \
|
||||
GOCACHE=$(HOST_GO_HOST_CACHE) \
|
||||
GOROOT_BOOTSTRAP=$(HOST_GO_BOOTSTRAP_STAGE4_ROOT) \
|
||||
GOROOT_FINAL=$(HOST_GO_BOOTSTRAP_STAGE5_ROOT) \
|
||||
GOROOT="$(@D)" \
|
||||
GOBIN="$(@D)/bin" \
|
||||
GOOS=linux \
|
||||
CC=$(HOSTCC_NOCCACHE) \
|
||||
CXX=$(HOSTCXX_NOCCACHE) \
|
||||
CGO_ENABLED=0
|
||||
|
||||
define HOST_GO_BOOTSTRAP_STAGE5_BUILD_CMDS
|
||||
cd $(@D)/src && \
|
||||
$(HOST_GO_BOOTSTRAP_STAGE5_MAKE_ENV) ./make.bash $(if $(VERBOSE),-v)
|
||||
endef
|
||||
|
||||
define HOST_GO_BOOTSTRAP_STAGE5_INSTALL_CMDS
|
||||
$(INSTALL) -D -m 0755 $(@D)/bin/go $(HOST_GO_BOOTSTRAP_STAGE5_ROOT)/bin/go
|
||||
$(INSTALL) -D -m 0755 $(@D)/bin/gofmt $(HOST_GO_BOOTSTRAP_STAGE5_ROOT)/bin/gofmt
|
||||
|
||||
cp -a $(@D)/lib $(HOST_GO_BOOTSTRAP_STAGE5_ROOT)/
|
||||
|
||||
mkdir -p $(HOST_GO_BOOTSTRAP_STAGE5_ROOT)/pkg
|
||||
cp -a $(@D)/pkg/include $(HOST_GO_BOOTSTRAP_STAGE5_ROOT)/pkg/
|
||||
cp -a $(@D)/pkg/tool $(HOST_GO_BOOTSTRAP_STAGE5_ROOT)/pkg/
|
||||
|
||||
# The Go sources must be installed to the host/ tree for the Go stdlib.
|
||||
cp -a $(@D)/src $(HOST_GO_BOOTSTRAP_STAGE5_ROOT)/
|
||||
endef
|
||||
|
||||
$(eval $(host-generic-package))
|
||||
@@ -0,0 +1,40 @@
|
||||
From 6aed475557032a7ff9009e9b4b691b40b561876a Mon Sep 17 00:00:00 2001
|
||||
From: Angelo Compagnucci <angelo@amarulasolutions.com>
|
||||
Date: Tue, 8 May 2018 16:08:44 +0200
|
||||
Subject: [PATCH] build.go: explicit option for crosscompilation
|
||||
|
||||
Actually if GOHOSTOS == GOOS || GOHOSTARCH == GOARCH the go build system
|
||||
assume it's not cross compiling and uses the same toolchain also for the
|
||||
bootstrap. This is a problem in case the cross compilation mandates a
|
||||
different toolchain for bootstrap and target. This patch adds
|
||||
GO_ASSUME_CROSSCOMPILING variable to assure that in case of cross
|
||||
compilation CC_FOR_TARGET can be different from CC.
|
||||
|
||||
Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
|
||||
Signed-off-by: Anisse Astier <anisse@astier.eu>
|
||||
---
|
||||
src/cmd/dist/build.go | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
|
||||
index 7c44c4a605..03500920c4 100644
|
||||
--- a/src/cmd/dist/build.go
|
||||
+++ b/src/cmd/dist/build.go
|
||||
@@ -286,12 +286,13 @@ func xinit() {
|
||||
// $CC_FOR_goos_goarch, if set, applies only to goos/goarch.
|
||||
func compilerEnv(envName, def string) map[string]string {
|
||||
m := map[string]string{"": def}
|
||||
+ crosscompiling := os.Getenv("GO_ASSUME_CROSSCOMPILING")
|
||||
|
||||
if env := os.Getenv(envName); env != "" {
|
||||
m[""] = env
|
||||
}
|
||||
if env := os.Getenv(envName + "_FOR_TARGET"); env != "" {
|
||||
- if gohostos != goos || gohostarch != goarch {
|
||||
+ if gohostos != goos || gohostarch != goarch || crosscompiling == "1" {
|
||||
m[gohostos+"/"+gohostarch] = m[""]
|
||||
}
|
||||
m[""] = env
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
From 6b05378097c6a386ed9912d2471976dc39504e86 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Stewart <christian@aperture.us>
|
||||
Date: Thu, 27 Jul 2023 21:28:47 -0700
|
||||
Subject: [PATCH] cmd/dist: set buildvcs=false when building go-bootstrap
|
||||
|
||||
When building go-bootstrap as part of the make.bash process, the cmd/dist
|
||||
invokes the bootstrap Go compiler to build the go_bootstrap tool:
|
||||
|
||||
${GOROOT_BOOTSTRAP}/bin/go install -tags=math_big_pure_go compiler_bootstrap purego bootstrap/cmd/...
|
||||
|
||||
If there is an invalid .git directory in a parent of ${GOROOT_BOOTSTRAP},
|
||||
make.bash will fail. Reproduction of the issue:
|
||||
|
||||
mkdir go-issue-61620
|
||||
cd ./go-issue-61620
|
||||
wget https://go.dev/dl/go1.19.11.src.tar.gz
|
||||
mkdir go-bootstrap
|
||||
tar -xf go1.19.11.src.tar.gz -C ./go-bootstrap --strip-components=1
|
||||
cd ./go-bootstrap/src/
|
||||
bash make.bash
|
||||
cd ../../
|
||||
wget https://go.dev/dl/go1.20.6.src.tar.gz
|
||||
mkdir go
|
||||
tar -xf go1.20.6.src.tar.gz -C ./go/ --strip-components=1
|
||||
printf "gitdir: ../../does/not/exist/.git" > ./.git
|
||||
cd ./go/src/
|
||||
GOROOT_BOOTSTRAP=$(pwd)/../../go-bootstrap/ bash make.bash
|
||||
|
||||
The build fails with the following error:
|
||||
|
||||
Building Go toolchain1 using [snip]/go-1.19.10.
|
||||
error obtaining VCS status: exit status 128
|
||||
Use -buildvcs=false to disable VCS stamping.
|
||||
go tool dist: FAILED: [snip]/go-1.19.10/bin/go install -tags=math_big_pure_go \
|
||||
compiler_bootstrap purego bootstrap/cmd/...: exit status 1
|
||||
|
||||
This change unconditionally sets -buildvcs=false when compiling go-bootstrap. We
|
||||
don't need the revision information in those binaries anyway. Setting this flag
|
||||
was previously not done as we were unsure if the go-bootstrap compiler would be
|
||||
new enough to support the buildvcs build flag. Since Go 1.20.x, Go 1.19.x is the
|
||||
minimum version for go-bootstrap, and supports -buildvcs=false. We can now set
|
||||
-buildvcs=false without worrying about compatibility.
|
||||
|
||||
Related: https://github.com/golang/go/issues/54852
|
||||
Fixes: https://github.com/golang/go/issues/61620
|
||||
|
||||
---
|
||||
|
||||
Upstream: https://github.com/golang/go/pull/61621
|
||||
|
||||
Signed-off-by: Christian Stewart <christian@aperture.us>
|
||||
|
||||
---
|
||||
src/cmd/dist/buildtool.go | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/src/cmd/dist/buildtool.go b/src/cmd/dist/buildtool.go
|
||||
index a528d7aa76..3b411d6ebb 100644
|
||||
--- a/src/cmd/dist/buildtool.go
|
||||
+++ b/src/cmd/dist/buildtool.go
|
||||
@@ -221,6 +221,9 @@ func bootstrapBuildTools() {
|
||||
cmd := []string{
|
||||
pathf("%s/bin/go", goroot_bootstrap),
|
||||
"install",
|
||||
+ // Fixes cases where an invalid .git is present in a parent of GOROOT_BOOTSTRAP.
|
||||
+ // See: https://github.com/golang/go/issues/61620
|
||||
+ "-buildvcs=false",
|
||||
"-tags=math_big_pure_go compiler_bootstrap purego",
|
||||
}
|
||||
if vflag > 0 {
|
||||
--
|
||||
2.41.0
|
||||
|
||||
1
package/go/go-src/go-src.hash
Symbolic link
1
package/go/go-src/go-src.hash
Symbolic link
@@ -0,0 +1 @@
|
||||
../go.hash
|
||||
59
package/go/go-src/go-src.mk
Normal file
59
package/go/go-src/go-src.mk
Normal file
@@ -0,0 +1,59 @@
|
||||
################################################################################
|
||||
#
|
||||
# go-src
|
||||
#
|
||||
################################################################################
|
||||
|
||||
GO_SRC_VERSION = $(GO_VERSION)
|
||||
GO_SRC_SITE = https://go.dev/dl
|
||||
GO_SRC_SOURCE = go$(GO_VERSION).src.tar.gz
|
||||
GO_SRC_DL_SUBDIR = go
|
||||
|
||||
GO_SRC_LICENSE = BSD-3-Clause
|
||||
GO_SRC_LICENSE_FILES = LICENSE
|
||||
GO_SRC_CPE_ID_VENDOR = golang
|
||||
GO_SRC_CPE_ID_PRODUCT = go
|
||||
|
||||
HOST_GO_SRC_PROVIDES = host-go
|
||||
HOST_GO_SRC_DEPENDENCIES = \
|
||||
host-go-bootstrap-stage5 \
|
||||
$(HOST_GO_DEPENDENCIES_CGO)
|
||||
|
||||
ifeq ($(BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS),y)
|
||||
|
||||
HOST_GO_SRC_CROSS_ENV = \
|
||||
CC_FOR_TARGET="$(TARGET_CC)" \
|
||||
CXX_FOR_TARGET="$(TARGET_CXX)" \
|
||||
GOOS="linux" \
|
||||
GOARCH=$(GO_GOARCH) \
|
||||
$(if $(GO_GO386),GO386=$(GO_GO386)) \
|
||||
$(if $(GO_GOARM),GOARM=$(GO_GOARM)) \
|
||||
GO_ASSUME_CROSSCOMPILING=1
|
||||
|
||||
endif
|
||||
|
||||
# The go build system is not compatible with ccache, so use
|
||||
# HOSTCC_NOCCACHE. See https://github.com/golang/go/issues/11685.
|
||||
HOST_GO_SRC_MAKE_ENV = \
|
||||
GO111MODULE=off \
|
||||
GOCACHE=$(HOST_GO_HOST_CACHE) \
|
||||
GOROOT_BOOTSTRAP=$(HOST_GO_BOOTSTRAP_STAGE5_ROOT) \
|
||||
GOROOT_FINAL=$(HOST_GO_ROOT) \
|
||||
GOROOT="$(@D)" \
|
||||
GOBIN="$(@D)/bin" \
|
||||
GOOS=linux \
|
||||
CC=$(HOSTCC_NOCCACHE) \
|
||||
CXX=$(HOSTCXX_NOCCACHE) \
|
||||
CGO_ENABLED=$(HOST_GO_CGO_ENABLED) \
|
||||
$(HOST_GO_SRC_CROSS_ENV)
|
||||
|
||||
define HOST_GO_SRC_BUILD_CMDS
|
||||
cd $(@D)/src && \
|
||||
$(HOST_GO_SRC_MAKE_ENV) ./make.bash $(if $(VERBOSE),-v)
|
||||
endef
|
||||
|
||||
define HOST_GO_SRC_INSTALL_CMDS
|
||||
$(GO_BINARIES_INSTALL)
|
||||
endef
|
||||
|
||||
$(eval $(host-generic-package))
|
||||
9
package/go/go.hash
Normal file
9
package/go/go.hash
Normal file
@@ -0,0 +1,9 @@
|
||||
# sha256 checksum from https://go.dev/dl/
|
||||
sha256 a0721c54c688901448d77ad9b3ec7ea7c474730755ff891382e92ecb93ff2cb1 go1.26.6.src.tar.gz
|
||||
sha256 f09a71029fc5cd2940fbe36b0eb1fb2d8f3407cd6adb6b7b4de3eaf04007f8c4 go1.26.6.linux-386.tar.gz
|
||||
sha256 708effb774be8237570d0add163225abbdfaf4fca28b2611df167beba4feef89 go1.26.6.linux-amd64.tar.gz
|
||||
sha256 d0507e9e9d7fe012aae570108cbd76c15de879e17130ab8cb90d4d7445cb1f2e go1.26.6.linux-arm64.tar.gz
|
||||
sha256 e1379a2fe77bd30fa29833074388247e7c65416e09279f746f20de2d5cf4dfea go1.26.6.linux-armv6l.tar.gz
|
||||
sha256 232b65543a42eda95df6a63f76235c1795bb535eba5c74e509faec71bc648388 go1.26.6.linux-ppc64le.tar.gz
|
||||
sha256 958757933d38172dd544085d253c8738cf09793d24c8bc0422e5e1e1fffa4fde go1.26.6.linux-s390x.tar.gz
|
||||
sha256 911f8f5782931320f5b8d1160a76365b83aea6447ee6c04fa6d5591467db9dad LICENSE
|
||||
147
package/go/go.mk
Normal file
147
package/go/go.mk
Normal file
@@ -0,0 +1,147 @@
|
||||
################################################################################
|
||||
#
|
||||
# go
|
||||
#
|
||||
################################################################################
|
||||
|
||||
# When bumping this to 1.27 (or beyond), remove the workaround for
|
||||
# upstream issue https://github.com/golang/go/issues/77436, below
|
||||
# (i.e. revert the commit adding these lines).
|
||||
GO_VERSION = 1.26.6
|
||||
|
||||
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
|
||||
HOST_GO_TARGET_CACHE = $(HOST_DIR)/share/go-cache
|
||||
|
||||
# We pass an empty GOBIN, otherwise "go install: cannot install
|
||||
# cross-compiled binaries when GOBIN is set"
|
||||
HOST_GO_COMMON_ENV = \
|
||||
GO111MODULE=on \
|
||||
GOFLAGS=-mod=vendor \
|
||||
GOROOT="$(HOST_GO_ROOT)" \
|
||||
GOPATH="$(HOST_GO_GOPATH)" \
|
||||
GOCACHE="$(HOST_GO_TARGET_CACHE)" \
|
||||
GOMODCACHE="$(HOST_GO_GOPATH)/pkg/mod" \
|
||||
GOPROXY=off \
|
||||
GOTOOLCHAIN=local \
|
||||
PATH=$(BR_PATH) \
|
||||
GOBIN= \
|
||||
CGO_ENABLED=$(HOST_GO_CGO_ENABLED)
|
||||
|
||||
ifeq ($(BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS),y)
|
||||
|
||||
ifeq ($(BR2_arm),y)
|
||||
GO_GOARCH = arm
|
||||
ifeq ($(BR2_ARM_CPU_ARMV5),y)
|
||||
GO_GOARM = 5
|
||||
else ifeq ($(BR2_ARM_CPU_ARMV6),y)
|
||||
GO_GOARM = 6
|
||||
else ifeq ($(BR2_ARM_CPU_ARMV7A),y)
|
||||
GO_GOARM = 7
|
||||
else ifeq ($(BR2_ARM_CPU_ARMV8A),y)
|
||||
# Go doesn't support 32-bit GOARM=8 (https://github.com/golang/go/issues/29373)
|
||||
# but can still benefit from armv7 optimisations
|
||||
GO_GOARM = 7
|
||||
endif
|
||||
else ifeq ($(BR2_aarch64),y)
|
||||
GO_GOARCH = arm64
|
||||
else ifeq ($(BR2_i386),y)
|
||||
GO_GOARCH = 386
|
||||
# i386: use softfloat if no SSE2: https://golang.org/doc/go1.16#386
|
||||
ifneq ($(BR2_X86_CPU_HAS_SSE2),y)
|
||||
GO_GO386 = softfloat
|
||||
endif
|
||||
else ifeq ($(BR2_x86_64),y)
|
||||
GO_GOARCH = amd64
|
||||
else ifeq ($(BR2_powerpc64),y)
|
||||
GO_GOARCH = ppc64
|
||||
else ifeq ($(BR2_powerpc64le),y)
|
||||
GO_GOARCH = ppc64le
|
||||
else ifeq ($(BR2_mips64),y)
|
||||
GO_GOARCH = mips64
|
||||
else ifeq ($(BR2_mips64el),y)
|
||||
GO_GOARCH = mips64le
|
||||
else ifeq ($(BR2_riscv),y)
|
||||
GO_GOARCH = riscv64
|
||||
else ifeq ($(BR2_s390x),y)
|
||||
GO_GOARCH = s390x
|
||||
endif
|
||||
|
||||
# For the convenience of target packages.
|
||||
HOST_GO_TOOLDIR = $(HOST_GO_ROOT)/pkg/tool/linux_$(GO_GOARCH)
|
||||
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_LDFLAGS="$(TARGET_LDFLAGS)" \
|
||||
GOTOOLDIR="$(HOST_GO_TOOLDIR)"
|
||||
|
||||
# Workaround for https://github.com/golang/go/issues/77436
|
||||
HOST_GO_TARGET_ENV += \
|
||||
CGO_CFLAGS="$(subst -g3,-g2,$(TARGET_CFLAGS))" \
|
||||
CGO_CXXFLAGS="$(subst -g3,-g2,$(TARGET_CXXFLAGS))"
|
||||
|
||||
# Allow packages to use cgo support if it is available for the target. They
|
||||
# will need the toolchain for cgo support; for convenence, include that
|
||||
# dependency here.
|
||||
#
|
||||
# Note that any target package needing cgo support must include 'depends on
|
||||
# BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS' in its config file.
|
||||
ifeq ($(BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS),y)
|
||||
HOST_GO_DEPENDENCIES_CGO += toolchain
|
||||
HOST_GO_CGO_ENABLED = 1
|
||||
else
|
||||
HOST_GO_CGO_ENABLED = 0
|
||||
endif
|
||||
else # !BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
|
||||
ifeq ($(BR2_PACKAGE_HOST_GO_HOST_CGO_LINKING_SUPPORTS),y)
|
||||
HOST_GO_CGO_ENABLED = 1
|
||||
else # !BR2_PACKAGE_HOST_GO_HOST_CGO_LINKING_SUPPORTS
|
||||
HOST_GO_CGO_ENABLED = 0
|
||||
endif # BR2_PACKAGE_HOST_GO_HOST_CGO_LINKING_SUPPORTS
|
||||
endif # BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
|
||||
# Ensure the toolchain is available, whatever the provider
|
||||
HOST_GO_DEPENDENCIES += $(HOST_GO_DEPENDENCIES_CGO)
|
||||
|
||||
# For the convenience of host golang packages
|
||||
HOST_GO_HOST_ENV = \
|
||||
$(HOST_GO_COMMON_ENV) \
|
||||
GOOS="" \
|
||||
GOARCH="" \
|
||||
GOCACHE="$(HOST_GO_HOST_CACHE)" \
|
||||
CC="$(HOSTCC_NOCCACHE)" \
|
||||
CXX="$(HOSTCXX_NOCCACHE)" \
|
||||
CGO_CFLAGS="$(HOST_CFLAGS)" \
|
||||
CGO_CXXFLAGS="$(HOST_CXXFLAGS)" \
|
||||
CGO_LDFLAGS="$(HOST_LDFLAGS)"
|
||||
|
||||
define GO_BINARIES_INSTALL
|
||||
$(INSTALL) -D -m 0755 $(@D)/bin/go $(HOST_GO_ROOT)/bin/go
|
||||
$(INSTALL) -D -m 0755 $(@D)/bin/gofmt $(HOST_GO_ROOT)/bin/gofmt
|
||||
|
||||
mkdir -p $(HOST_DIR)/bin
|
||||
ln -sf ../lib/go/bin/go $(HOST_DIR)/bin/
|
||||
ln -sf ../lib/go/bin/gofmt $(HOST_DIR)/bin/
|
||||
|
||||
cp -a $(@D)/lib $(HOST_GO_ROOT)/
|
||||
|
||||
mkdir -p $(HOST_GO_ROOT)/pkg
|
||||
cp -a $(@D)/pkg/include $(HOST_GO_ROOT)/pkg/
|
||||
cp -a $(@D)/pkg/tool $(HOST_GO_ROOT)/pkg/
|
||||
|
||||
# The Go sources must be installed to the host/ tree for the Go stdlib.
|
||||
cp -a $(@D)/src $(HOST_GO_ROOT)/
|
||||
|
||||
# Set file timestamps to prevent the Go compiler from rebuilding the stdlib
|
||||
# when compiling other programs.
|
||||
find $(HOST_GO_ROOT) -type f -exec touch -r $(@D)/bin/go {} \;
|
||||
endef
|
||||
|
||||
$(eval $(host-virtual-package))
|
||||
|
||||
include $(sort $(wildcard package/go/*/*.mk))
|
||||
Reference in New Issue
Block a user