Use the rust-std manifest file in build_llvm_sysroot_for_triple
This is far more accurate than filtering based on filename and as such allows building the sysroot a bit quicker. In addition the code is a bit simpler.
This commit is contained in:
parent
8ad6e38384
commit
0670b60de3
1 changed files with 10 additions and 27 deletions
|
|
@ -161,35 +161,18 @@ fn build_sysroot_for_triple(
|
|||
fn build_llvm_sysroot_for_triple(compiler: Compiler) -> SysrootTarget {
|
||||
let default_sysroot = crate::rustc_info::get_default_sysroot(&compiler.rustc);
|
||||
|
||||
let mut target_libs = SysrootTarget { triple: compiler.triple, libs: vec![] };
|
||||
let std_manifest_path = default_sysroot
|
||||
.join("lib")
|
||||
.join("rustlib")
|
||||
.join(format!("manifest-rust-std-{}", compiler.triple));
|
||||
|
||||
for entry in fs::read_dir(
|
||||
default_sysroot.join("lib").join("rustlib").join(&target_libs.triple).join("lib"),
|
||||
)
|
||||
.unwrap()
|
||||
{
|
||||
let entry = entry.unwrap();
|
||||
if entry.file_type().unwrap().is_dir() {
|
||||
continue;
|
||||
}
|
||||
let file = entry.path();
|
||||
let file_name_str = file.file_name().unwrap().to_str().unwrap();
|
||||
if (file_name_str.contains("rustc_")
|
||||
&& !file_name_str.contains("rustc_std_workspace_")
|
||||
&& !file_name_str.contains("rustc_demangle")
|
||||
&& !file_name_str.contains("rustc_literal_escaper"))
|
||||
|| file_name_str.contains("chalk")
|
||||
|| file_name_str.contains("tracing")
|
||||
|| file_name_str.contains("regex")
|
||||
{
|
||||
// These are large crates that are part of the rustc-dev component and are not
|
||||
// necessary to run regular programs.
|
||||
continue;
|
||||
}
|
||||
target_libs.libs.push(file);
|
||||
}
|
||||
let libs = fs::read_to_string(std_manifest_path)
|
||||
.unwrap()
|
||||
.lines()
|
||||
.map(|entry| default_sysroot.join(entry.strip_prefix("file:").unwrap()))
|
||||
.collect();
|
||||
|
||||
target_libs
|
||||
SysrootTarget { triple: compiler.triple, libs }
|
||||
}
|
||||
|
||||
fn build_clif_sysroot_for_triple(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue