cargo.env("CFG_DEFAULT_AR", s);
}
build.run(&mut cargo);
+ update_mtime(build, &librustc_stamp(build, compiler, target));
}
/// Same as `std_link`, only for librustc
build.cargo_out(compiler, Mode::Libtest, target).join(".libtest.stamp")
}
+/// Cargo's output path for librustc in a given stage, compiled by a particular
+/// compiler for the specified target.
+fn librustc_stamp(build: &Build, compiler: &Compiler, target: &str) -> PathBuf {
+ build.cargo_out(compiler, Mode::Librustc, target).join(".librustc.stamp")
+}
+
fn compiler_file(compiler: &Path, file: &str) -> PathBuf {
let out = output(Command::new(compiler)
.arg(format!("-print-file-name={}", file)));
}
}
+/// Build a tool in `src/tools`
+///
+/// This will build the specified tool with the specified `host` compiler in
+/// `stage` into the normal cargo output directory.
+pub fn maybe_clean_tools(build: &Build, stage: u32, target: &str, mode: Mode) {
+ let compiler = Compiler::new(stage, &build.config.build);
+
+ let stamp = match mode {
+ Mode::Libstd => libstd_stamp(build, &compiler, target),
+ Mode::Libtest => libtest_stamp(build, &compiler, target),
+ Mode::Librustc => librustc_stamp(build, &compiler, target),
+ _ => panic!(),
+ };
+ let out_dir = build.cargo_out(&compiler, Mode::Tool, target);
+ build.clear_if_dirty(&out_dir, &stamp);
+}
+
/// Build a tool in `src/tools`
///
/// This will build the specified tool with the specified `host` compiler in
let compiler = Compiler::new(stage, &build.config.build);
- // FIXME: need to clear out previous tool and ideally deps, may require
- // isolating output directories or require a pseudo shim step to
- // clear out all the info.
- //
- // Maybe when libstd is compiled it should clear out the rustc of the
- // corresponding stage?
- // let out_dir = build.cargo_out(stage, &host, Mode::Librustc, target);
- // build.clear_if_dirty(&out_dir, &libstd_stamp(build, stage, &host, target));
-
let mut cargo = build.cargo(&compiler, Mode::Tool, target, "build");
let mut dir = build.src.join(tool);
if !dir.exists() {