From f5929037cc38aeb6f32b6b95586a2691554d1636 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou Date: Thu, 27 Apr 2017 11:51:02 +0200 Subject: [PATCH 1/6] rustbuild: build cargo and rls as part of extended build Build them directly in the `./x.py build` phase, don't wait for `./x.py dist` Signed-off-by: Marc-Antoine Perennou --- src/bootstrap/step.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bootstrap/step.rs b/src/bootstrap/step.rs index d811e1122c4..35e1b9c6776 100644 --- a/src/bootstrap/step.rs +++ b/src/bootstrap/step.rs @@ -575,6 +575,7 @@ 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, "qemu-test-client")); rules.build("tool-cargo", "cargo") + .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")) @@ -588,6 +589,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| { From c4c3b5a44396907e8689eefe8e517cd7a26ac9af Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou Date: Thu, 27 Apr 2017 11:52:48 +0200 Subject: [PATCH 2/6] rustbuild: pass version number as param in install phase Signed-off-by: Marc-Antoine Perennou --- src/bootstrap/install.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs index d508616e4b1..e99451fd52d 100644 --- a/src/bootstrap/install.rs +++ b/src/bootstrap/install.rs @@ -46,24 +46,24 @@ 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, + 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, + 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) From a2bab1ddf56e080100ccf73e29b161f8122bd5d4 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou Date: Thu, 27 Apr 2017 11:49:03 +0200 Subject: [PATCH 3/6] rustbuild: add rls_package_vers Signed-off-by: Marc-Antoine Perennou --- src/bootstrap/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index bbfab388950..43726ea1c43 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -1048,6 +1048,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. /// From 03c57975525004710b8b6bf61a1431b77ea15b14 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou Date: Thu, 27 Apr 2017 11:53:18 +0200 Subject: [PATCH 4/6] rustbuild: install cargo and rls when extended build is enabled Signed-off-by: Marc-Antoine Perennou --- src/bootstrap/install.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs index e99451fd52d..b8dde1df729 100644 --- a/src/bootstrap/install.rs +++ b/src/bootstrap/install.rs @@ -51,12 +51,20 @@ pub fn install(build: &Build, stage: u32, host: &str) { } for target in build.config.target.iter() { - install_sh(&build, "std", "rust-std", &build.rust_package_vers(), 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", &build.rust_package_vers(), + 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)); } From 7b1fb8964119e01899869d8a2e74896f82ae4be4 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou Date: Thu, 27 Apr 2017 15:05:29 +0200 Subject: [PATCH 5/6] rustbuild: install rustc after cargo and rls This way its files take precedence (e.g. README.md and stuff) Signed-off-by: Marc-Antoine Perennou --- src/bootstrap/install.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs index b8dde1df729..c805522fbf5 100644 --- a/src/bootstrap/install.rs +++ b/src/bootstrap/install.rs @@ -55,9 +55,6 @@ pub fn install(build: &Build, stage: u32, host: &str) { stage, target, &prefix, &docdir, &libdir, &mandir, &empty_dir); } - install_sh(&build, "rustc", "rustc", &build.rust_package_vers(), - 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); @@ -65,6 +62,9 @@ pub fn install(build: &Build, stage: u32, host: &str) { 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)); } From a8c6ba9c6eff834721e0c775de975b8741431fd0 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou Date: Fri, 28 Apr 2017 10:48:49 +0200 Subject: [PATCH 6/6] rustbuild: only build cargo for host Signed-off-by: Marc-Antoine Perennou --- src/bootstrap/step.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bootstrap/step.rs b/src/bootstrap/step.rs index 35e1b9c6776..ecd8a048786 100644 --- a/src/bootstrap/step.rs +++ b/src/bootstrap/step.rs @@ -575,6 +575,7 @@ 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, "qemu-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"))