Skip to content

Commit

Permalink
Auto merge of #41577 - Keruspe:master, r=alexcrichton
Browse files Browse the repository at this point in the history
rustbuild improvements

Properly hook up cargo and rls in the build phase, and install them, when extended build is enabled.
  • Loading branch information
bors committed Apr 29, 2017
2 parents 810ed98 + a8c6ba9 commit 95467d3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/bootstrap/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,32 @@ pub fn install(build: &Build, stage: u32, host: &str) {
let empty_dir = build.out.join("tmp/empty_dir");
t!(fs::create_dir_all(&empty_dir));
if build.config.docs {
install_sh(&build, "docs", "rust-docs", stage, host, &prefix,
&docdir, &libdir, &mandir, &empty_dir);
install_sh(&build, "docs", "rust-docs", &build.rust_package_vers(),
stage, host, &prefix, &docdir, &libdir, &mandir, &empty_dir);
}

for target in build.config.target.iter() {
install_sh(&build, "std", "rust-std", stage, target, &prefix,
&docdir, &libdir, &mandir, &empty_dir);
install_sh(&build, "std", "rust-std", &build.rust_package_vers(),
stage, target, &prefix, &docdir, &libdir, &mandir, &empty_dir);
}

install_sh(&build, "rustc", "rustc", stage, host, &prefix,
&docdir, &libdir, &mandir, &empty_dir);
if build.config.extended {
install_sh(&build, "cargo", "cargo", &build.cargo_package_vers(),
stage, host, &prefix, &docdir, &libdir, &mandir, &empty_dir);
install_sh(&build, "rls", "rls", &build.rls_package_vers(),
stage, host, &prefix, &docdir, &libdir, &mandir, &empty_dir);
}

install_sh(&build, "rustc", "rustc", &build.rust_package_vers(),
stage, host, &prefix, &docdir, &libdir, &mandir, &empty_dir);

t!(fs::remove_dir_all(&empty_dir));
}

fn install_sh(build: &Build, package: &str, name: &str, stage: u32, host: &str,
fn install_sh(build: &Build, package: &str, name: &str, version: &str, stage: u32, host: &str,
prefix: &Path, docdir: &Path, libdir: &Path, mandir: &Path, empty_dir: &Path) {
println!("Install {} stage{} ({})", package, stage, host);
let package_name = format!("{}-{}-{}", name, build.rust_package_vers(), host);
let package_name = format!("{}-{}-{}", name, version, host);

let mut cmd = Command::new("sh");
cmd.current_dir(empty_dir)
Expand Down
5 changes: 5 additions & 0 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,11 @@ impl Build {
self.package_vers(&self.release_num("cargo"))
}

/// Returns the value of `package_vers` above for rls
fn rls_package_vers(&self) -> String {
self.package_vers(&self.release_num("rls"))
}

/// Returns the `version` string associated with this compiler for Rust
/// itself.
///
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,8 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
.dep(|s| s.name("libstd-tool"))
.run(move |s| compile::tool(build, s.stage, s.target, "remote-test-client"));
rules.build("tool-cargo", "cargo")
.host(true)
.default(build.config.extended)
.dep(|s| s.name("maybe-clean-tools"))
.dep(|s| s.name("libstd-tool"))
.dep(|s| s.stage(0).host(s.target).name("openssl"))
Expand All @@ -588,6 +590,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
.run(move |s| compile::tool(build, s.stage, s.target, "cargo"));
rules.build("tool-rls", "rls")
.host(true)
.default(build.config.extended)
.dep(|s| s.name("librustc-tool"))
.dep(|s| s.stage(0).host(s.target).name("openssl"))
.dep(move |s| {
Expand Down

0 comments on commit 95467d3

Please sign in to comment.