mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-24 14:28:42 +00:00
Fix aarch64-apple-darwin
fallback to x86_64h
(#1278)
Run `arch -arch x86_64h /usr/bin/true` to decides whether fallback is feasible. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
ea1a34b4a1
commit
a84844938d
1 changed files with 9 additions and 3 deletions
|
@ -36,14 +36,20 @@ async fn is_arch_supported(arch_name: &str) -> bool {
|
|||
pub(super) async fn detect_alternative_targets(target: &str) -> impl Iterator<Item = String> {
|
||||
match target {
|
||||
AARCH64 => {
|
||||
let is_x86_64_supported = is_arch_supported("x86_64").await;
|
||||
// Spawn `arch` in parallel (probably from different threads if
|
||||
// mutlti-thread runtime is used).
|
||||
//
|
||||
// These two tasks are never cancelled, so it can only fail due to
|
||||
// panic, in which cause we would propagate by also panic here.
|
||||
let x86_64h_task = tokio::spawn(is_arch_supported("x86_64h"));
|
||||
let x86_64_task = tokio::spawn(is_arch_supported("x86_64"));
|
||||
[
|
||||
// Prefer universal as it provides native arm executable
|
||||
Some(UNIVERSAL),
|
||||
Some(UNIVERSAL2),
|
||||
// Prefer x86h since it is more optimized
|
||||
is_x86_64_supported.then_some(X86H),
|
||||
is_x86_64_supported.then_some(X86),
|
||||
x86_64h_task.await.unwrap().then_some(X86H),
|
||||
x86_64_task.await.unwrap().then_some(X86),
|
||||
]
|
||||
}
|
||||
X86 => [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue