diff options
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/bin/rustc.rs | 4 | ||||
| -rw-r--r-- | src/bootstrap/check.rs | 28 | ||||
| -rw-r--r-- | src/bootstrap/compile.rs | 5 | ||||
| -rw-r--r-- | src/bootstrap/doc.rs | 12 | ||||
| -rw-r--r-- | src/bootstrap/lib.rs | 12 | ||||
| -rw-r--r-- | src/bootstrap/mk/Makefile.in | 2 | ||||
| -rw-r--r-- | src/bootstrap/step.rs | 32 |
7 files changed, 57 insertions, 38 deletions
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index 129798836e0..90fd31ecbdd 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -89,7 +89,9 @@ fn main() { // When we build Rust dylibs they're all intended for intermediate // usage, so make sure we pass the -Cprefer-dynamic flag instead of // linking all deps statically into the dylib. - cmd.arg("-Cprefer-dynamic"); + if env::var_os("RUSTC_NO_PREFER_DYNAMIC").is_none() { + cmd.arg("-Cprefer-dynamic"); + } // Help the libc crate compile by assisting it in finding the MUSL // native libraries. diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index ec0243908ed..a73498160c5 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -62,9 +62,9 @@ impl fmt::Display for TestKind { /// /// This tool in `src/tools` will verify the validity of all our links in the /// documentation to ensure we don't have a bunch of dead ones. -pub fn linkcheck(build: &Build, stage: u32, host: &str) { - println!("Linkcheck stage{} ({})", stage, host); - let compiler = Compiler::new(stage, host); +pub fn linkcheck(build: &Build, host: &str) { + println!("Linkcheck ({})", host); + let compiler = Compiler::new(0, host); let _time = util::timeit(); build.run(build.tool_cmd(&compiler, "linkchecker") @@ -93,10 +93,11 @@ pub fn cargotest(build: &Build, stage: u32, host: &str) { t!(fs::create_dir_all(&out_dir)); let _time = util::timeit(); - build.run(build.tool_cmd(compiler, "cargotest") - .env("PATH", newpath) - .arg(&build.cargo) - .arg(&out_dir)); + let mut cmd = Command::new(build.tool(&Compiler::new(0, host), "cargotest")); + build.prepare_tool_cmd(compiler, &mut cmd); + build.run(cmd.env("PATH", newpath) + .arg(&build.cargo) + .arg(&out_dir)); } /// Runs the `tidy` tool as compiled in `stage` by the `host` compiler. @@ -104,9 +105,9 @@ pub fn cargotest(build: &Build, stage: u32, host: &str) { /// This tool in `src/tools` checks up on various bits and pieces of style and /// otherwise just implements a few lint-like checks that are specific to the /// compiler itself. -pub fn tidy(build: &Build, stage: u32, host: &str) { - println!("tidy check stage{} ({})", stage, host); - let compiler = Compiler::new(stage, host); +pub fn tidy(build: &Build, host: &str) { + println!("tidy check ({})", host); + let compiler = Compiler::new(0, host); build.run(build.tool_cmd(&compiler, "tidy") .arg(build.src.join("src"))); } @@ -127,7 +128,9 @@ pub fn compiletest(build: &Build, suite: &str) { println!("Check compiletest suite={} mode={} ({} -> {})", suite, mode, compiler.host, target); - let mut cmd = build.tool_cmd(compiler, "compiletest"); + let mut cmd = Command::new(build.tool(&Compiler::new(0, compiler.host), + "compiletest")); + build.prepare_tool_cmd(compiler, &mut cmd); // compiletest currently has... a lot of arguments, so let's just pass all // of them! @@ -287,7 +290,8 @@ pub fn error_index(build: &Build, compiler: &Compiler) { let output = dir.join("error-index.md"); let _time = util::timeit(); - build.run(build.tool_cmd(compiler, "error_index_generator") + build.run(build.tool_cmd(&Compiler::new(0, compiler.host), + "error_index_generator") .arg("markdown") .arg(&output) .env("CFG_BUILD", &build.config.build)); diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index dcccf788935..a7633998aad 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -379,6 +379,11 @@ pub fn tool(build: &Build, stage: u32, host: &str, tool: &str) { let mut cargo = build.cargo(&compiler, Mode::Tool, host, "build"); cargo.arg("--manifest-path") .arg(build.src.join(format!("src/tools/{}/Cargo.toml", tool))); + + // We don't want to build tools dynamically as they'll be running across + // stages and such and it's just easier if they're not dynamically linked. + cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1"); + build.run(&mut cargo); } diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 4c4462bf122..b4f14863fd4 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -29,19 +29,19 @@ use util::{up_to_date, cp_r}; /// /// This will not actually generate any documentation if the documentation has /// already been generated. -pub fn rustbook(build: &Build, stage: u32, target: &str, name: &str) { +pub fn rustbook(build: &Build, target: &str, name: &str) { let out = build.doc_out(target); t!(fs::create_dir_all(&out)); let out = out.join(name); - let compiler = Compiler::new(stage, &build.config.build); + let compiler = Compiler::new(0, &build.config.build); let src = build.src.join("src/doc").join(name); let index = out.join("index.html"); let rustbook = build.tool(&compiler, "rustbook"); if up_to_date(&src, &index) && up_to_date(&rustbook, &index) { return } - println!("Rustbook stage{} ({}) - {}", stage, target, name); + println!("Rustbook ({}) - {}", target, name); let _ = fs::remove_dir_all(&out); build.run(build.tool_cmd(&compiler, "rustbook") .arg("build") @@ -213,11 +213,11 @@ pub fn rustc(build: &Build, stage: u32, target: &str) { /// Generates the HTML rendered error-index by running the /// `error_index_generator` tool. -pub fn error_index(build: &Build, stage: u32, target: &str) { - println!("Documenting stage{} error index ({})", stage, target); +pub fn error_index(build: &Build, target: &str) { + println!("Documenting error index ({})", target); let out = build.doc_out(target); t!(fs::create_dir_all(&out)); - let compiler = Compiler::new(stage, &build.config.build); + let compiler = Compiler::new(0, &build.config.build); let mut index = build.tool_cmd(&compiler, "error_index_generator"); index.arg("html"); index.arg(out.join("error-index.html")); diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 49eaed4c67a..a65511efeb0 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -570,6 +570,15 @@ impl Build { /// `host`. fn tool_cmd(&self, compiler: &Compiler, tool: &str) -> Command { let mut cmd = Command::new(self.tool(&compiler, tool)); + self.prepare_tool_cmd(compiler, &mut cmd); + return cmd + } + + /// Prepares the `cmd` provided to be able to run the `compiler` provided. + /// + /// Notably this munges the dynamic library lookup path to point to the + /// right location to run `compiler`. + fn prepare_tool_cmd(&self, compiler: &Compiler, cmd: &mut Command) { let host = compiler.host; let mut paths = vec