build: Reorganize target selection

Architectures here with `musl` available are minority, which is more
suitable for enumeration.

With this change, we are implicitly choosing gnu target for `ppc64le`,
`riscv64` and `s390x`.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
This commit is contained in:
Ruoqing He 2025-02-25 23:23:38 +08:00
parent 562911e170
commit ed50e31625

View File

@ -35,11 +35,11 @@ export PATH="${PATH}:${HOME}/.cargo/bin"
## this command will not take too long to run.
rustup toolchain install ${version}
rustup default ${version}
if [ "${rustarch}" == "powerpc64le" ] || [ "${rustarch}" == "s390x" ] ; then
rustup target add ${rustarch}-unknown-linux-gnu
else
if [ "${rustarch}" == "x86_64" ] || [ "${rustarch}" == "aarch64" ] ; then
rustup target add ${rustarch}-unknown-linux-musl
$([ "$(whoami)" != "root" ] && echo sudo) ln -sf /usr/bin/g++ /bin/musl-g++
else
rustup target add ${rustarch}-unknown-linux-gnu
fi
rustup component add rustfmt
rustup component add clippy