package/go: make host package a virtual package

Turns host-go into a virtual package, with a single providers:

 - host-go-src, which builds host-go from source based on the same logic
   that was previously used in package/go/go/go.mk, now moved to
   package/go/go-src/go-src.mk to remove any ambiguity on the role of
   the package.

In later commits, we'll add host-go-bin a prebuilt binary host go compiler
as another provider.

A similar solution is proposed for host-rust.

Signed-off-by: Thomas Perale <thomas.perale@mind.be>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
Thomas Perale 2024-04-15 18:22:25 +02:00 committed by Yann E. MORIN
parent 58a291470a
commit fa2536ec94
7 changed files with 41 additions and 14 deletions

View File

@ -715,7 +715,7 @@ package/glorytun/0002-aegis256.c-fix-aarch64-build-with-uclibc.patch lib_patch.U
package/gnu-efi/0001-Make.defaults-don-t-override-ARCH-when-cross-compili.patch lib_patch.Upstream
package/gnupg/0001-build-Always-use-EXTERN_UNLESS_MAIN_MODULE-pattern.patch lib_patch.Upstream
package/gnuplot/0001-configure-add-without-demo-option.patch lib_patch.Upstream
package/go/go/0001-build.go-explicit-option-for-crosscompilation.patch lib_patch.Upstream
package/go/go-src/0001-build.go-explicit-option-for-crosscompilation.patch lib_patch.Upstream
package/gob2/0001-dont-include-from-prefix.patch lib_patch.Upstream
package/gobject-introspection/0001-disable-tests.patch lib_patch.Upstream
package/gobject-introspection/0002-Add-rpath-links-to-ccompiler.patch lib_patch.Upstream

View File

@ -37,6 +37,30 @@ config BR2_PACKAGE_HOST_GO
bool
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
help
Select a Go compiler variant.
Default to 'host-go-src'.
config BR2_PACKAGE_HOST_GO_SRC
bool "host go (source)"
help
This package will build the go compiler for the host.
endchoice
config BR2_PACKAGE_PROVIDES_HOST_GO
string
# Default to host-go-src
default "host-go-src" if BR2_PACKAGE_HOST_GO_SRC
endif
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"

View File

@ -1,21 +1,22 @@
################################################################################
#
# go
# go-src
#
################################################################################
GO_SITE = https://storage.googleapis.com/golang
GO_SOURCE = go$(GO_VERSION).src.tar.gz
GO_SRC_SITE = https://storage.googleapis.com/golang
GO_SRC_SOURCE = go$(GO_VERSION).src.tar.gz
GO_LICENSE = BSD-3-Clause
GO_LICENSE_FILES = LICENSE
GO_CPE_ID_VENDOR = golang
GO_SRC_LICENSE = BSD-3-Clause
GO_SRC_LICENSE_FILES = LICENSE
GO_SRC_CPE_ID_VENDOR = golang
HOST_GO_DEPENDENCIES = host-go-bootstrap-stage3
HOST_GO_SRC_PROVIDES = host-go
HOST_GO_SRC_DEPENDENCIES = host-go-bootstrap-stage3
ifeq ($(BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS),y)
HOST_GO_CROSS_ENV = \
HOST_GO_SRC_CROSS_ENV = \
CC_FOR_TARGET="$(TARGET_CC)" \
CXX_FOR_TARGET="$(TARGET_CXX)" \
GOOS="linux" \
@ -28,7 +29,7 @@ endif
# The go build system is not compatible with ccache, so use
# HOSTCC_NOCCACHE. See https://github.com/golang/go/issues/11685.
HOST_GO_MAKE_ENV = \
HOST_GO_SRC_MAKE_ENV = \
GO111MODULE=off \
GOCACHE=$(HOST_GO_HOST_CACHE) \
GOROOT_BOOTSTRAP=$(HOST_GO_BOOTSTRAP_STAGE3_ROOT) \
@ -39,14 +40,14 @@ HOST_GO_MAKE_ENV = \
CC=$(HOSTCC_NOCCACHE) \
CXX=$(HOSTCXX_NOCCACHE) \
CGO_ENABLED=$(HOST_GO_CGO_ENABLED) \
$(HOST_GO_CROSS_ENV)
$(HOST_GO_SRC_CROSS_ENV)
define HOST_GO_BUILD_CMDS
define HOST_GO_SRC_BUILD_CMDS
cd $(@D)/src && \
$(HOST_GO_MAKE_ENV) ./make.bash $(if $(VERBOSE),-v)
$(HOST_GO_SRC_MAKE_ENV) ./make.bash $(if $(VERBOSE),-v)
endef
define HOST_GO_INSTALL_CMDS
define HOST_GO_SRC_INSTALL_CMDS
$(GO_BINARIES_INSTALL)
endef

View File

@ -129,4 +129,6 @@ define GO_BINARIES_INSTALL
find $(HOST_GO_ROOT) -type f -exec touch -r $(@D)/bin/go {} \;
endef
$(eval $(host-virtual-package))
include $(sort $(wildcard package/go/*/*.mk))