]> git.lizzy.rs Git - rust.git/blob - src/bootstrap/bin/llvm-config-wrapper.rs
Auto merge of #50105 - mixi:crt-included, r=alexcrichton
[rust.git] / src / bootstrap / bin / llvm-config-wrapper.rs
1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // The sheer existence of this file is an awful hack. See the comments in
12 // `src/bootstrap/native.rs` for why this is needed when compiling LLD.
13
14 use std::env;
15 use std::process::{self, Stdio, Command};
16 use std::io::{self, Write};
17
18 fn main() {
19     let real_llvm_config = env::var_os("LLVM_CONFIG_REAL").unwrap();
20     let mut cmd = Command::new(real_llvm_config);
21     cmd.args(env::args().skip(1)).stderr(Stdio::piped());
22     let output = cmd.output().expect("failed to spawn llvm-config");
23     let stdout = String::from_utf8_lossy(&output.stdout);
24     print!("{}", stdout.replace("\\", "/"));
25     io::stdout().flush().unwrap();
26     process::exit(output.status.code().unwrap_or(1));
27 }