diff options
| author | bors <bors@rust-lang.org> | 2023-01-18 19:49:02 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-01-18 19:49:02 +0000 |
| commit | 333ee6c466972185973d5097f8b5fb0f9fb13fa5 (patch) | |
| tree | dd325fd59034fc8165b7c46395379c33774a5b4e /src/bootstrap | |
| parent | 6d46b1ec8769fbbb3ac2a2cb12f0cad527135413 (diff) | |
| parent | 0fb426ace4ed07bc023863ebd8103ac49fba1283 (diff) | |
Auto merge of #105716 - chriswailes:ndk-update-redux, r=pietroalbini
Ndk update redux Blocked on https://github.com/rust-lang/blog.rust-lang.org/pull/1055
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/cc_detect.rs | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/bootstrap/cc_detect.rs b/src/bootstrap/cc_detect.rs index 7128d542acf..65c882fb801 100644 --- a/src/bootstrap/cc_detect.rs +++ b/src/bootstrap/cc_detect.rs @@ -47,6 +47,8 @@ fn cc2ar(cc: &Path, target: TargetSelection) -> Option<PathBuf> { Some(PathBuf::from("ar")) } else if target.contains("vxworks") { Some(PathBuf::from("wr-ar")) + } else if target.contains("android") { + Some(cc.parent().unwrap().join(PathBuf::from("llvm-ar"))) } else { let parent = cc.parent().unwrap(); let file = cc.file_name().unwrap().to_str().unwrap(); @@ -219,12 +221,22 @@ fn set_compiler( } pub(crate) fn ndk_compiler(compiler: Language, triple: &str, ndk: &Path) -> PathBuf { - let triple_translated = triple - .replace("armv7neon", "arm") - .replace("armv7", "arm") - .replace("thumbv7neon", "arm") - .replace("thumbv7", "arm"); - let compiler = format!("{}-{}", triple_translated, compiler.clang()); + let mut triple_iter = triple.split("-"); + let triple_translated = if let Some(arch) = triple_iter.next() { + let arch_new = match arch { + "arm" | "armv7" | "armv7neon" | "thumbv7" | "thumbv7neon" => "armv7a", + other => other, + }; + std::iter::once(arch_new).chain(triple_iter).collect::<Vec<&str>>().join("-") + } else { + triple.to_string() + }; + + // API 19 is the earliest API level supported by NDK r25b but AArch64 and x86_64 support + // begins at API level 21. + let api_level = + if triple.contains("aarch64") || triple.contains("x86_64") { "21" } else { "19" }; + let compiler = format!("{}{}-{}", triple_translated, api_level, compiler.clang()); ndk.join("bin").join(compiler) } |
