kumquat-buildroot/package/rustc/rustc.mk
Nathaniel Husted cf30776057 package/rustc: prepare for musl-based platforms support
The current rustc package only supports configurations based on glibc
and hardcodes this requirement. This patch prepares the addition of
support for musl-based platforms by using $(LIBC) instead of
hardcoding "gnu" as the C library specifier when defining
RUSTC_TARGET_NAME.

Signed-off-by: Nathaniel Husted <nathaniel.husted@outlook.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-05-18 23:19:47 +02:00

35 lines
1.0 KiB
Makefile

################################################################################
#
# rustc
#
################################################################################
RUSTC_ARCH = $(call qstrip,$(BR2_PACKAGE_HOST_RUSTC_ARCH))
RUSTC_ABI = $(call qstrip,$(BR2_PACKAGE_HOST_RUSTC_ABI))
ifeq ($(BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS),y)
RUSTC_TARGET_NAME = $(RUSTC_ARCH)-unknown-linux-$(LIBC)$(RUSTC_ABI)
endif
ifeq ($(HOSTARCH),x86)
RUSTC_HOST_ARCH = i686
else
RUSTC_HOST_ARCH = $(HOSTARCH)
endif
RUSTC_HOST_NAME = $(RUSTC_HOST_ARCH)-unknown-linux-gnu
$(eval $(host-virtual-package))
ifeq ($(BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS),y)
define RUSTC_INSTALL_CARGO_CONFIG
mkdir -p $(HOST_DIR)/share/cargo
sed -e 's/@RUSTC_TARGET_NAME@/$(RUSTC_TARGET_NAME)/' \
-e 's/@CROSS_PREFIX@/$(notdir $(TARGET_CROSS))/' \
package/rustc/cargo-config.in \
> $(HOST_DIR)/share/cargo/config
endef
# check-package disable TypoInPackageVariable - TOOLCHAIN intended
TOOLCHAIN_POST_INSTALL_STAGING_HOOKS += RUSTC_INSTALL_CARGO_CONFIG
endif