I'm working on a package (rustup) and need help with the logic portion pertaining to the rustc triple toolchain target.
RustC/Cargo is a toolchain used to compile some applications, nothing is installed on the device and is entirely host based.
RUSTC_ALL_TARGET:= \
aarch64-unknown-linux-gnu aarch64-unknown-linux-musl arm-unknown-linux-gnueabi \
arm-unknown-linux-gnueabihf arm-unknown-linux-musleabi arm-unknown-linux-musleabihf \
armv4t-unknown-linux-gnueabi armv5te-unknown-linux-gnueabi armv5te-unknown-linux-musleabi \
armv7-unknown-linux-gnueabi armv7-unknown-linux-gnueabihf armv7-unknown-linux-musleabi \
armv7-unknown-linux-musleabihf i586-unknown-linux-gnu i586-unknown-linux-musl \
i686-unknown-linux-gnu i686-unknown-linux-musl mips-unknown-linux-gnu \
mips-unknown-linux-musl mips-unknown-linux-uclibc mips64-unknown-linux-gnuabi64 \
mips64-unknown-linux-muslabi64 mips64el-unknown-linux-gnuabi64 mips64el-unknown-linux-muslabi64 \
mipsel-unknown-linux-gnu mipsel-unknown-linux-musl mipsel-unknown-linux-uclibc \
mipsisa32r6-unknown-linux-gnu mipsisa32r6el-unknown-linux-gnu mipsisa64r6-unknown-linux-gnuabi64 \
mipsisa64r6el-unknown-linux-gnuabi64 powerpc-unknown-linux-gnu powerpc-unknown-linux-musl \
powerpc64-unknown-linux-gnu powerpc64-unknown-linux-musl powerpc64le-unknown-linux-gnu \
powerpc64le-unknown-linux-musl riscv64gc-unknown-linux-gnu s390x-unknown-linux-gnu \
sparc-unknown-linux-gnu sparc64-unknown-linux-gnu thumbv7neon-unknown-linux-gnueabihf \
thumbv7neon-unknown-linux-musleabihf x86_64-unknown-linux-gnu x86_64-unknown-linux-musl
# Filter by Arch
RUSTC_TARGET:=$(filter $(ARCH)%,$(RUSTC_ALL_TARGET))
$(info Filtered by Arch: $(RUSTC_TARGET))
# Filter by libc
ifeq ($(CONFIG_USE_MUSL),y)
RUSTC_TARGET_COMPILER:=$(filter %musl%,$(RUSTC_TARGET))
$(info Filtered by MUSL Compiler: $(RUSTC_TARGET_COMPILER))
else
RUSTC_TARGET_COMPILER:=$(filter %gnu%,$(RUSTC_TARGET))
$(info Filtered by GNU Compiler: $(RUSTC_TARGET_COMPILER))
endif
# If more than one choice is remaining, filter by 64bit support
ifeq ($(word 2,$(RUSTC_TARGET_COMPILER)),)
RUSTC_TARGET_ARCH:=$(RUSTC_TARGET_COMPILER)
else
ifdef CONFIG_ARCH_64BIT
RUSTC_TARGET_ARCH:=$(filter %64,$(RUSTC_TARGET_COMPILER))
$(info Filter by 64bit: $(RUSTC_TARGET_ARCH))
else
RUSTC_TARGET_ARCH:=$(filter-out %64,$(RUSTC_TARGET_COMPILER))
$(info Filter by 64bit: $(RUSTC_TARGET_ARCH))
endif
endif
The trouble I'm having is, I have a list of "acceptable" toolchain targets defined, I winnow the first batch down by $(ARCH) and it is fine.
Filtered by Arch: mips64-unknown-linux-gnuabi64 mips64-unknown-linux-muslabi64 mips64el-unknown-linux-gnuabi64 mips64el-unknown-linux-muslabi64
But the second filter fails to produce any output, which of course, fails down to the third filter.
Filtered by MUSL Compiler:
In my case, I'm need it to identify mips64-unknown-linux-muslabi64
I already can see I need a check for CONFIG_BIG_ENDIAN
just for the mips64 segment, and probably others.
Any help and suggestions are much appreciated!