package/newlib-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 target configurations
have been copied into the NEWLIB_BARE_METAL_CONF_OPTS while removing any
configurations that do not apply to newlib.

Also, the following configs were not taken because newlib is being built for
each of the bare-metal targets and not the main target of Buildroot.

$$(TARGET_CONFIGURE_OPTS)
$$(TARGET_CONFIGURE_ARGS)
--target=$$(GNU_TARGET_NAME)
--host=$$(GNU_TARGET_NAME)

Signed-off-by: Neal Frager <neal.frager@amd.com>
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
This commit is contained in:
Neal Frager
2025-02-17 12:49:30 +00:00
committed by Arnout Vandecappelle
parent 1ff6caf801
commit 28ae74a134

View File

@@ -22,28 +22,49 @@ NEWLIB_BARE_METAL_INSTALL_STAGING = YES
NEWLIB_BARE_METAL_INSTALL_TARGET = NO
NEWLIB_BARE_METAL_MAKE_OPTS = MAKEINFO=true
NEWLIB_BARE_METAL_CONF_OPTS = \
--build=$(GNU_HOST_NAME) \
--prefix=/usr \
--exec-prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--program-prefix="" \
$(if $$($$(PKG)_OVERRIDE_SRCDIR),,--disable-dependency-tracking) \
$(QUIET) \
--enable-newlib-io-c99-formats \
--enable-newlib-io-long-long \
--enable-newlib-io-float \
--enable-newlib-io-long-double \
--disable-multilib \
--with-tooldir=/usr
define NEWLIB_BARE_METAL_CONFIGURE_CMDS
(cd $(@D) && \
$(foreach arch_tuple, $(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE), \
mkdir -p $(@D)/build-$(arch_tuple) && \
cd $(@D)/build-$(arch_tuple) && \
PATH=$(BR_PATH) \
./configure \
--target=$(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE) \
--prefix=/usr \
--enable-newlib-io-c99-formats \
--enable-newlib-io-long-long \
--enable-newlib-io-float \
--enable-newlib-io-long-double \
--disable-multilib \
--with-tooldir=/usr \
CONFIG_SITE=/dev/null \
$(@D)/configure \
$(NEWLIB_BARE_METAL_CONF_OPTS) \
--target=$(arch_tuple)
)
endef
define NEWLIB_BARE_METAL_BUILD_CMDS
PATH=$(BR_PATH) $(MAKE1) $(NEWLIB_BARE_METAL_MAKE_OPTS) -C $(@D)
$(foreach arch_tuple, $(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE), \
PATH=$(BR_PATH) $(MAKE1) \
$(NEWLIB_BARE_METAL_MAKE_OPTS) \
-C $(@D)/build-$(arch_tuple)
)
endef
define NEWLIB_BARE_METAL_INSTALL_STAGING_CMDS
PATH=$(BR_PATH) $(MAKE1) -C $(@D) $(NEWLIB_BARE_METAL_MAKE_OPTS) \
DESTDIR=$(TOOLCHAIN_BARE_METAL_BUILDROOT_SYSROOT) install
$(foreach arch_tuple, $(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE), \
PATH=$(BR_PATH) $(MAKE1) \
$(NEWLIB_BARE_METAL_MAKE_OPTS) \
-C $(@D)/build-$(arch_tuple) \
DESTDIR=$(HOST_DIR)/$(arch_tuple)/sysroot install
)
endef
$(eval $(generic-package))