+++ /dev/null
-menu "Configuration"
-
-config GOLANG_EXTERNAL_BOOTSTRAP_ROOT
- string "External bootstrap Go root directory"
- default ""
- help
- Path to a working Go tree (>= Go 1.4), with bin, pkg, and src
- subdirectories and the Go compiler at bin/go.
-
- If specified, the existing Go installation will be used to
- compile host (buildroot) Go.
-
- Leave blank to compile the default bootstrap Go.
-
-config GOLANG_BUILD_CACHE_DIR
- string "Go build cache directory"
- default ""
- help
- Store the Go build cache in this directory.
- If not set, uses '$(TMP_DIR)/go-build'.
-
-config GOLANG_MOD_CACHE_WORLD_READABLE
- bool "Ensure Go module cache is world-readable"
- default n
-
-config GOLANG_SPECTRE
- bool "Enable Spectre mitigations"
- default n
- depends on x86_64
- help
- Currently only available for x86-64 (amd64).
-
-endmenu
--- /dev/null
+menu "Configuration"
+
+config GOLANG_EXTERNAL_BOOTSTRAP_ROOT
+ string "External bootstrap Go root directory"
+ default ""
+ help
+ Path to a working Go tree (>= Go 1.4), with bin, pkg, and src
+ subdirectories and the Go compiler in bin/go.
+
+ If set, the existing Go installation will be used to compile host
+ (buildroot) Go.
+
+ Leave blank to compile the default bootstrap Go.
+
+config GOLANG_BUILD_BOOTSTRAP
+ bool "Build bootstrap instead of using an external one"
+ default y
+ help
+ When enabled, build the local bootstrap instead of using an external one
+ for host Go. If 'External bootstrap Go root directory' is set, skip the
+ initial 1.4 step.
+
+ When disabled, let Go auto-detect the toolchain or use the toolchain
+ specified in 'External bootstrap Go root directory' to skip building the
+ bootstrap and build host Go using that toolchain directly. Configured
+ toolchain must be compatible with the current version of Go.
+
+config GOLANG_BUILD_CACHE_DIR
+ string "Go build cache directory"
+ default ""
+ help
+ Path where Go should store its build cache.
+
+ If not set, uses '$(TMP_DIR)/go-build'.
+
+config GOLANG_MOD_CACHE_WORLD_READABLE
+ bool "Ensure Go module cache is world-readable"
+ default n
+
+config GOLANG_SPECTRE
+ bool "Enable Spectre mitigations"
+ default n
+ depends on x86_64
+ help
+ Currently only available for x86-64 (amd64).
+
+endmenu
PKG_LICENSE_FILES:=LICENSE
PKG_CPE_ID:=cpe:/a:golang:go
-PKG_BUILD_DIR:=$(BUILD_DIR)/go-$(PKG_VERSION)
-PKG_BUILD_PARALLEL:=1
-PKG_BUILD_FLAGS:=no-mips16
-
PKG_HOST_ONLY:=1
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/go-$(PKG_VERSION)
endif
define Package/golang-bootstrap
+ $(call GoPackage/GoSubMenu)
TITLE:=Go programming language (bootstrap)
DEPENDS:=$(GO_ARCH_DEPENDS)
- HIDDEN:=1
endef
define Package/golang-bootstrap/description
endef
define Package/golang-bootstrap/config
- source "$(SOURCE)/../Config.in"
+ source "$(SOURCE)/Config.in"
endef
BOOTSTRAP_ROOT_DIR:=$(call qstrip,$(CONFIG_GOLANG_EXTERNAL_BOOTSTRAP_ROOT))
$(eval $(call GoCompiler/AddProfile,Bootstrap,$(BOOTSTRAP_BUILD_DIR),,bootstrap,$(GO_HOST_OS_ARCH)))
endif
+# Skip configuring and downloading stages when building is not configured
+ifeq ($(CONFIG_GOLANG_BUILD_BOOTSTRAP),y)
+
# Bootstrap 1.17
define Download/golang-bootstrap-1.17
$(eval $(call GoCompiler/AddProfile,Bootstrap-1.20,$(BOOTSTRAP_1_20_BUILD_DIR),,bootstrap-1.20,$(GO_HOST_OS_ARCH)))
+endif
+
# Host
ifeq ($(GO_HOST_PIE_SUPPORTED),1)
# When using GO_LDFLAGS to set buildmode=pie, the PIE install suffix does not
# apply (we also delete the std lib during Host/Install)
-$(eval $(call GoCompiler/AddProfile,Host,$(HOST_BUILD_DIR),$(HOST_GO_PREFIX),$(HOST_GO_VERSION_ID),$(GO_HOST_OS_ARCH)))
+ifeq ($(CONFIG_GOLANG_BUILD_BOOTSTRAP),y)
+ $(eval $(call GoCompiler/AddProfile,Host,$(HOST_BUILD_DIR),$(HOST_GO_PREFIX),$(HOST_GO_VERSION_ID),$(GO_HOST_OS_ARCH)))
+endif
HOST_GO_VARS= \
GOHOSTARCH="$(GO_HOST_ARCH)" \
$(call GoCompiler/Host/Uninstall)
endef
-$(eval $(call HostBuild))
+# Skip downloading and building final bootstrap when building is not configured
+ifeq ($(CONFIG_GOLANG_BUILD_BOOTSTRAP),y)
+ $(eval $(call HostBuild))
+else
+ host-compile:
+endif
+
$(eval $(call BuildPackage,golang-bootstrap))
HOST_GO_VERSION_ID:=$(GO_VERSION_MAJOR_MINOR)
HOST_GO_ROOT:=$(HOST_GO_PREFIX)/lib/go-$(HOST_GO_VERSION_ID)
-BOOTSTRAP_DIR:=$(HOST_GO_PREFIX)/lib/go-$(GO_BOOTSTRAP_VERSION)
+ifeq ($(CONFIG_GOLANG_BUILD_BOOTSTRAP),y)
+ BOOTSTRAP_DIR:=$(HOST_GO_PREFIX)/lib/go-$(GO_BOOTSTRAP_VERSION)
+else
+ BOOTSTRAP_DIR:=$(call qstrip,$(CONFIG_GOLANG_EXTERNAL_BOOTSTRAP_ROOT))
+endif
include ../golang-compiler.mk
include ../golang-package.mk
TITLE+= (compiler)
DEPENDS+= +golang$(GO_VERSION_MAJOR_MINOR)-src
EXTRA_DEPENDS:=golang$(GO_VERSION_MAJOR_MINOR)-src (=$(PKG_VERSION)-r$(PKG_RELEASE))
+ MDEPENDS:=+golang-bootstrap
PROVIDES:=@golang
$(if $(filter $(GO_DEFAULT_VERSION),$(GO_VERSION_MAJOR_MINOR)),DEFAULT_VARIANT:=1)
ALTERNATIVES:=\
for the Go programming language.
endef
-define Package/$(PKG_NAME)/config
- source "$(SOURCE)/../Config.in"
-endef
-
define Package/$(PKG_NAME)-doc
$(call Package/$(PKG_NAME)/Default)
TITLE+= (documentation)