]> git.lizzy.rs Git - rust.git/blob - src/bootstrap/bin/llvm-config-wrapper.rs
Rollup merge of #95005 - ssomers:btree_static_assert, r=thomcc
[rust.git] / src / bootstrap / bin / llvm-config-wrapper.rs
1 // The sheer existence of this file is an awful hack. See the comments in
2 // `src/bootstrap/native.rs` for why this is needed when compiling LLD.
3
4 use std::env;
5 use std::io::{self, Write};
6 use std::process::{self, Command, Stdio};
7
8 fn main() {
9     let real_llvm_config = env::var_os("LLVM_CONFIG_REAL").unwrap();
10     let mut cmd = Command::new(real_llvm_config);
11     cmd.args(env::args().skip(1)).stderr(Stdio::piped());
12     let output = cmd.output().expect("failed to spawn llvm-config");
13     let mut stdout = String::from_utf8_lossy(&output.stdout);
14
15     if let Ok(to_replace) = env::var("LLVM_CONFIG_SHIM_REPLACE") {
16         if let Ok(replace_with) = env::var("LLVM_CONFIG_SHIM_REPLACE_WITH") {
17             stdout = stdout.replace(&to_replace, &replace_with).into();
18         }
19     }
20
21     print!("{}", stdout.replace("\\", "/"));
22     io::stdout().flush().unwrap();
23     process::exit(output.status.code().unwrap_or(1));
24 }