mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-05 03:30:03 +00:00
Fix detect-targets musl fallback for android and alpine (#2076)
Android does not have `-unknown-` in target and alpine uses `-alpine-` instead of `-unknown-`, so the musl fallback must be taken special care when generating Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
a8daf8eb3b
commit
92973c1392
1 changed files with 8 additions and 6 deletions
|
@ -22,7 +22,14 @@ pub(super) async fn detect_targets(target: String) -> Vec<String> {
|
||||||
(postfix, Libc::Unknown)
|
(postfix, Libc::Unknown)
|
||||||
};
|
};
|
||||||
|
|
||||||
let musl_fallback_target = || format!("{prefix}-{}{abi}", "musl");
|
let cpu_arch = target
|
||||||
|
.split_once('-')
|
||||||
|
.expect("unwrap: target always has a - for cpu_arch")
|
||||||
|
.0;
|
||||||
|
|
||||||
|
// For android the `-unknown-` is omitted, for alpine it has `-alpine-`
|
||||||
|
// instead of `-unknown-`.
|
||||||
|
let musl_fallback_target = || format!("{cpu_arch}-unknown-linux-musl{abi}");
|
||||||
|
|
||||||
match libc {
|
match libc {
|
||||||
// guess_host_triple cannot detect whether the system is using glibc,
|
// guess_host_triple cannot detect whether the system is using glibc,
|
||||||
|
@ -33,11 +40,6 @@ pub(super) async fn detect_targets(target: String) -> Vec<String> {
|
||||||
//
|
//
|
||||||
// As such, we need to launch the test ourselves.
|
// As such, we need to launch the test ourselves.
|
||||||
Libc::Gnu | Libc::Musl => {
|
Libc::Gnu | Libc::Musl => {
|
||||||
let cpu_arch = target
|
|
||||||
.split_once('-')
|
|
||||||
.expect("unwrap: target always has a - for cpu_arch")
|
|
||||||
.0;
|
|
||||||
|
|
||||||
let handles: Vec<_> = {
|
let handles: Vec<_> = {
|
||||||
let cpu_arch_suffix = cpu_arch.replace('_', "-");
|
let cpu_arch_suffix = cpu_arch.replace('_', "-");
|
||||||
let filename = format!("ld-linux-{cpu_arch_suffix}.so.2");
|
let filename = format!("ld-linux-{cpu_arch_suffix}.so.2");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue