mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
bootstrap: Allow to specify ranlib tool used when compiling C++ code.
This commit is contained in:
parent
758239c9c9
commit
80e27cdd02
@ -388,6 +388,10 @@
|
||||
# Note: an absolute path should be used, otherwise LLVM build will break.
|
||||
#ar = "ar"
|
||||
|
||||
# Ranlib to be used to assemble static libraries compiled from C/C++ code.
|
||||
# Note: an absolute path should be used, otherwise LLVM build will break.
|
||||
#ranlib = "ranlib"
|
||||
|
||||
# Linker to be used to link Rust code. Note that the
|
||||
# default value is platform specific, and if not specified it may also depend on
|
||||
# what platform is crossing to what platform.
|
||||
|
@ -163,6 +163,7 @@ pub struct Target {
|
||||
pub cc: Option<PathBuf>,
|
||||
pub cxx: Option<PathBuf>,
|
||||
pub ar: Option<PathBuf>,
|
||||
pub ranlib: Option<PathBuf>,
|
||||
pub linker: Option<PathBuf>,
|
||||
pub ndk: Option<PathBuf>,
|
||||
pub crt_static: Option<bool>,
|
||||
@ -327,6 +328,7 @@ struct TomlTarget {
|
||||
cc: Option<String>,
|
||||
cxx: Option<String>,
|
||||
ar: Option<String>,
|
||||
ranlib: Option<String>,
|
||||
linker: Option<String>,
|
||||
android_ndk: Option<String>,
|
||||
crt_static: Option<bool>,
|
||||
@ -581,6 +583,7 @@ impl Config {
|
||||
target.cc = cfg.cc.clone().map(PathBuf::from);
|
||||
target.cxx = cfg.cxx.clone().map(PathBuf::from);
|
||||
target.ar = cfg.ar.clone().map(PathBuf::from);
|
||||
target.ranlib = cfg.ranlib.clone().map(PathBuf::from);
|
||||
target.linker = cfg.linker.clone().map(PathBuf::from);
|
||||
target.crt_static = cfg.crt_static.clone();
|
||||
target.musl_root = cfg.musl_root.clone().map(PathBuf::from);
|
||||
|
@ -281,6 +281,7 @@ pub struct Build {
|
||||
cc: HashMap<Interned<String>, cc::Tool>,
|
||||
cxx: HashMap<Interned<String>, cc::Tool>,
|
||||
ar: HashMap<Interned<String>, PathBuf>,
|
||||
ranlib: HashMap<Interned<String>, PathBuf>,
|
||||
// Misc
|
||||
crates: HashMap<Interned<String>, Crate>,
|
||||
is_sudo: bool,
|
||||
@ -406,6 +407,7 @@ impl Build {
|
||||
cc: HashMap::new(),
|
||||
cxx: HashMap::new(),
|
||||
ar: HashMap::new(),
|
||||
ranlib: HashMap::new(),
|
||||
crates: HashMap::new(),
|
||||
lldb_version: None,
|
||||
lldb_python_dir: None,
|
||||
@ -772,6 +774,11 @@ impl Build {
|
||||
self.ar.get(&target).map(|p| &**p)
|
||||
}
|
||||
|
||||
/// Returns the path to the `ranlib` utility for the target specified.
|
||||
fn ranlib(&self, target: Interned<String>) -> Option<&Path> {
|
||||
self.ranlib.get(&target).map(|p| &**p)
|
||||
}
|
||||
|
||||
/// Returns the path to the C++ compiler for the target specified.
|
||||
fn cxx(&self, target: Interned<String>) -> Result<&Path, String> {
|
||||
match self.cxx.get(&target) {
|
||||
|
@ -379,6 +379,14 @@ fn configure_cmake(builder: &Builder,
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(ranlib) = builder.ranlib(target) {
|
||||
if ranlib.is_absolute() {
|
||||
// LLVM build breaks if `CMAKE_RANLIB` is a relative path, for some reason it
|
||||
// tries to resolve this path in the LLVM build directory.
|
||||
cfg.define("CMAKE_RANLIB", sanitize_cc(ranlib));
|
||||
}
|
||||
}
|
||||
|
||||
if env::var_os("SCCACHE_ERROR_LOG").is_some() {
|
||||
cfg.env("RUST_LOG", "sccache=warn");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user