about summary refs log tree commit diff
path: root/src/bootstrap/config.rs
diff options
context:
space:
mode:
authorPietro Albini <pietro.albini@ferrous-systems.com>2022-11-03 15:01:39 +0100
committerPietro Albini <pietro.albini@ferrous-systems.com>2022-11-17 09:37:39 +0100
commit6d8160261ff3aee3b6eaacc37ac96cafff530980 (patch)
tree168fdd331e0ca2ef3853acade4173f078231fa34 /src/bootstrap/config.rs
parent09340e3c575d6bd5c4137ef5f31807c4f2c787d7 (diff)
downloadrust-6d8160261ff3aee3b6eaacc37ac96cafff530980.tar.gz
rust-6d8160261ff3aee3b6eaacc37ac96cafff530980.zip
set correct default value for cc and cxx on android
Diffstat (limited to 'src/bootstrap/config.rs')
-rw-r--r--src/bootstrap/config.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index af004aa5098..a1d0dac7e98 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -16,6 +16,7 @@ use std::str::FromStr;
 use crate::builder::TaskPath;
 use crate::cache::{Interned, INTERNER};
 use crate::channel::{self, GitInfo};
+use crate::cc_detect::{ndk_compiler, Language};
 pub use crate::flags::Subcommand;
 use crate::flags::{Color, Flags};
 use crate::util::{exe, output, t};
@@ -1237,8 +1238,12 @@ impl Config {
                 if let Some(s) = cfg.no_std {
                     target.no_std = s;
                 }
-                target.cc = cfg.cc.map(PathBuf::from);
-                target.cxx = cfg.cxx.map(PathBuf::from);
+                target.cc = cfg.cc.map(PathBuf::from).or_else(|| {
+                    target.ndk.as_ref().map(|ndk| ndk_compiler(Language::C, &triple, ndk))
+                });
+                target.cxx = cfg.cxx.map(PathBuf::from).or_else(|| {
+                    target.ndk.as_ref().map(|ndk| ndk_compiler(Language::CPlusPlus, &triple, ndk))
+                });
                 target.ar = cfg.ar.map(PathBuf::from);
                 target.ranlib = cfg.ranlib.map(PathBuf::from);
                 target.linker = cfg.linker.map(PathBuf::from);