diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-11-21 14:11:12 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-21 14:11:12 +0100 |
| commit | 5b9289215e0afb73efbf882e8d6f0af461fc99f2 (patch) | |
| tree | 4794afab68078b80105749b4f5a81d12468f7927 /src/bootstrap | |
| parent | ed22bdc18f466f03737b4cdd8dba6d5524fb5389 (diff) | |
| parent | 6f1c7b24705d8e744ddea9b445cb70e0a0d328cb (diff) | |
| download | rust-5b9289215e0afb73efbf882e8d6f0af461fc99f2.tar.gz rust-5b9289215e0afb73efbf882e8d6f0af461fc99f2.zip | |
Rollup merge of #104628 - alex-pinkus:revert-android-ndk-upgrade, r=pietroalbini
Revert "Update CI to use Android NDK r25b" This reverts commit bf7f1ca316a249cf99d722d79a0db12fef687142 (pull request #102332). The relevant discussion can be found in #103673, where it was agreed that more time is needed to warn the community of the upcoming breakage. This PR is for the `master` branch, where a conflict was recently introduced due to 6d8160261ff3aee3b6eaacc37ac96cafff530980. The conflict is in `cc_detect.rs`, where the code that corrects the target triple was moved to a new function called `ndk_compiler()`. This puts the old logic in the `ndk_compiler` function, and assumes that it works properly in the other location where that code is being called. I would appreciate review from ``@pietroalbini`` to understand how we can test that the reverted logic is also suitable for the additional use case (seems to be related to setting `cc` and `cxx`). I've confirmed already that with these changes I can compile for `armv7-linux-androideabi`, `aarch64-linux-android`, `i686-linux-android`, and `x86_64-linux-android` using `x.py`. A separate revert for the `beta` branch will be required, since the original change has already made it to beta. The beta revert is available at https://github.com/alex-pinkus/rust/commit/3fa0d94674fbe37090ebe44ac1f06e2233f3121e, but I'm not sure of the process for staging that PR.
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/cc_detect.rs | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/bootstrap/cc_detect.rs b/src/bootstrap/cc_detect.rs index 65c882fb801..7128d542acf 100644 --- a/src/bootstrap/cc_detect.rs +++ b/src/bootstrap/cc_detect.rs @@ -47,8 +47,6 @@ 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(); @@ -221,22 +219,12 @@ fn set_compiler( } pub(crate) fn ndk_compiler(compiler: Language, triple: &str, ndk: &Path) -> PathBuf { - 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()); + let triple_translated = triple + .replace("armv7neon", "arm") + .replace("armv7", "arm") + .replace("thumbv7neon", "arm") + .replace("thumbv7", "arm"); + let compiler = format!("{}-{}", triple_translated, compiler.clang()); ndk.join("bin").join(compiler) } |
