package/gcc-bare-metal: add multiple tuple support

Add support to gcc-bare-metal to support multiple architecture tuples
with the BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH string.

To do this, custom configure, build and install commands are needed, so that
each step goes through a loop of the architecture tuples in the list.

To keep consistency with autotools, all the relevant host configurations have
been copied into the HOST_GCC_BARE_METAL_CONF_OPTS while removing any
configurations that do not apply to gcc and removing redundant configs.

autotools redundant configs covered by $(HOST_CONFIGURE_OPTS):
	CFLAGS="$$(HOST_CFLAGS)"
	LDFLAGS="$$(HOST_LDFLAGS)"

autotools configs not applicable to gcc:
	--disable-gtk-doc
	--disable-gtk-doc-html
	--disable-doc
	--disable-docs
	--disable-documentation
	--disable-debug
	--with-xmlto=no
	--with-fop=no
	--disable-nls

While we're at it: the following configuration option was incorrect:
--disable-initfini_array -> --disable-initfini-array
configure converts - to _ anyway so it makes no difference, but it's
better to be consistent.

Signed-off-by: Neal Frager <neal.frager@amd.com>
[Arnout: keep --disable-libstdcxx-pch and better explanation for
--disable-initfini-array]
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
This commit is contained in:
Neal Frager
2025-02-17 12:49:29 +00:00
committed by Arnout Vandecappelle
parent 57d73ec8e0
commit 1ff6caf801

View File

@@ -20,15 +20,9 @@ HOST_GCC_BARE_METAL_DEPENDENCIES = \
host-mpfr \
host-isl
# gcc doesn't support in-tree build, so we create a 'build'
# subdirectory in the gcc sources, and build from there.
define HOST_GCC_BARE_METAL_CONFIGURE_SYMLINK
mkdir -p $(@D)/build
ln -sf ../configure $(@D)/build/configure
endef
HOST_GCC_BARE_METAL_PRE_CONFIGURE_HOOKS += HOST_GCC_BARE_METAL_CONFIGURE_SYMLINK
HOST_GCC_BARE_METAL_SUBDIR = build
# Don't build documentation. It takes up extra space / build time,
# and sometimes needs specific makeinfo versions to work
HOST_GCC_BARE_METAL_CONF_ENV = MAKEINFO=missing
HOST_GCC_BARE_METAL_MAKE_OPTS = \
$(HOST_GCC_COMMON_MAKE_OPTS) \
@@ -38,8 +32,13 @@ HOST_GCC_BARE_METAL_MAKE_OPTS = \
HOST_GCC_BARE_METAL_INSTALL_OPTS = install-gcc install-target-libgcc
HOST_GCC_BARE_METAL_CONF_OPTS = \
--target=$(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE) \
--disable-initfini_array \
--prefix=$(HOST_DIR) \
--sysconfdir=$(HOST_DIR)/etc \
--localstatedir=$(HOST_DIR)/var \
$(if $$($$(PKG)_OVERRIDE_SRCDIR),,--disable-dependency-tracking) \
$(QUIET) \
--disable-shared \
--disable-initfini-array \
--disable-__cxa_atexit \
--disable-libstdcxx-pch \
--with-newlib \
@@ -54,9 +53,38 @@ HOST_GCC_BARE_METAL_CONF_OPTS = \
--with-gmp=$(HOST_DIR) \
--with-mpc=$(HOST_DIR) \
--with-mpfr=$(HOST_DIR) \
--with-isl=$(HOST_DIR) \
--with-sysroot=$(TOOLCHAIN_BARE_METAL_BUILDROOT_SYSROOT) \
AR_FOR_TARGET=$(HOST_DIR)/bin/$(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE)-ar \
RANLIB_FOR_TARGET=$(HOST_DIR)/bin/$(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE)-ranlib
--with-isl=$(HOST_DIR)
define HOST_GCC_BARE_METAL_CONFIGURE_CMDS
$(foreach arch_tuple, $(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE), \
mkdir -p $(@D)/build-$(arch_tuple) && \
cd $(@D)/build-$(arch_tuple) && \
$(HOST_CONFIGURE_OPTS) \
$(HOST_GCC_BARE_METAL_CONF_ENV) \
CONFIG_SITE=/dev/null \
$(@D)/configure \
$(HOST_GCC_BARE_METAL_CONF_OPTS) \
--target=$(arch_tuple) \
--with-sysroot=$(HOST_DIR)/$(arch_tuple)/sysroot \
AR_FOR_TARGET=$(HOST_DIR)/bin/$(arch_tuple)-ar \
RANLIB_FOR_TARGET=$(HOST_DIR)/bin/$(arch_tuple)-ranlib
)
endef
define HOST_GCC_BARE_METAL_BUILD_CMDS
$(foreach arch_tuple, $(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE), \
$(HOST_MAKE_ENV) $(MAKE) \
$(HOST_GCC_BARE_METAL_MAKE_OPTS) \
-C $(@D)/build-$(arch_tuple)
)
endef
define HOST_GCC_BARE_METAL_INSTALL_CMDS
$(foreach arch_tuple, $(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE), \
$(HOST_MAKE_ENV) $(MAKE) \
$(HOST_GCC_BARE_METAL_INSTALL_OPTS) \
-C $(@D)/build-$(arch_tuple)
)
endef
$(eval $(host-autotools-package))