]> git.proxmox.com Git - rustc.git/blame - src/bootstrap/bin/llvm-config-wrapper.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / bootstrap / bin / llvm-config-wrapper.rs
CommitLineData
94b46f34
XL
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
4use std::env;
94b46f34 5use std::io::{self, Write};
dfeec247 6use std::process::{self, Command, Stdio};
94b46f34
XL
7
8fn 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");
f9f354fc
XL
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
94b46f34
XL
21 print!("{}", stdout.replace("\\", "/"));
22 io::stdout().flush().unwrap();
23 process::exit(output.status.code().unwrap_or(1));
24}