From ee8b5783af75a8f5617eec24f2440c6649d4ecae Mon Sep 17 00:00:00 2001 From: O01eg Date: Wed, 29 Nov 2017 12:32:03 +0300 Subject: [PATCH 1/7] Fix #45345. Re-implement ```bash CFG_LIBDIR_RELATIVE=`echo ${CFG_LIBDIR} | cut -c$((${#CFG_PREFIX}+${CAT_INC}))-` ``` from old `configure` script. --- src/bootstrap/config.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index f3ffe9a276111..081425cc47425 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -403,6 +403,7 @@ impl Config { config.docdir = install.docdir.clone().map(PathBuf::from); config.bindir = install.bindir.clone().map(PathBuf::from); config.libdir = install.libdir.clone().map(PathBuf::from); + config.libdir_relative = install.libdir.clone().map(PathBuf::from); config.mandir = install.mandir.clone().map(PathBuf::from); } From 27b4f225eac725dd22812b64a50d078b5edcc830 Mon Sep 17 00:00:00 2001 From: O01eg Date: Sun, 3 Dec 2017 14:09:12 +0300 Subject: [PATCH 2/7] Accept verbosity in rustdoc. --- src/bootstrap/bin/rustdoc.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs index 62037590853c7..6d64248b42381 100644 --- a/src/bootstrap/bin/rustdoc.rs +++ b/src/bootstrap/bin/rustdoc.rs @@ -27,6 +27,13 @@ fn main() { let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set"); let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set"); + use std::str::FromStr; + + let verbose = match env::var("RUSTC_VERBOSE") { + Ok(s) => usize::from_str(&s).expect("RUSTC_VERBOSE should be an integer"), + Err(_) => 0, + }; + let mut dylib_path = bootstrap::util::dylib_path(); dylib_path.insert(0, PathBuf::from(libdir)); @@ -63,6 +70,10 @@ fn main() { cmd.arg("--deny-render-differences"); } + if verbose > 1 { + eprintln!("rustdoc command: {:?}", cmd); + } + std::process::exit(match cmd.status() { Ok(s) => s.code().unwrap_or(1), Err(e) => panic!("\n\nfailed to run {:?}: {}\n\n", cmd, e), From 0f5110ea4937e88e88c2192f3fa192717cb405c1 Mon Sep 17 00:00:00 2001 From: O01eg Date: Mon, 4 Dec 2017 00:51:59 +0300 Subject: [PATCH 3/7] Stage 1 and later use relative libdir. --- src/bootstrap/builder.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index ce30d1f4cec42..49d3c87d599b6 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -357,7 +357,7 @@ impl<'a> Builder<'a> { fn run(self, builder: &Builder) -> Interned { let compiler = self.compiler; - let lib = if compiler.stage >= 2 && builder.build.config.libdir_relative.is_some() { + let lib = if compiler.stage >= 1 && builder.build.config.libdir_relative.is_some() { builder.build.config.libdir_relative.clone().unwrap() } else { PathBuf::from("lib") From c87a1086dcca15bf7d6d6209b9bfa0893649202e Mon Sep 17 00:00:00 2001 From: O01eg Date: Thu, 7 Dec 2017 12:27:12 +0300 Subject: [PATCH 4/7] Build all stages with relative libdirs. --- src/bootstrap/compile.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index c8e500a4f68c0..1db39361aef91 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -500,7 +500,7 @@ impl Step for Rustc { /// Same as `std_cargo`, but for libtest pub fn rustc_cargo(build: &Build, - compiler: &Compiler, + _compiler: &Compiler, target: Interned, cargo: &mut Command) { cargo.arg("--features").arg(build.rustc_features()) @@ -514,13 +514,9 @@ pub fn rustc_cargo(build: &Build, .env("CFG_VERSION", build.rust_version()) .env("CFG_PREFIX", build.config.prefix.clone().unwrap_or_default()); - if compiler.stage == 0 { - cargo.env("CFG_LIBDIR_RELATIVE", "lib"); - } else { - let libdir_relative = - build.config.libdir_relative.clone().unwrap_or(PathBuf::from("lib")); - cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative); - } + let libdir_relative = + build.config.libdir_relative.clone().unwrap_or(PathBuf::from("lib")); + cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative); // If we're not building a compiler with debugging information then remove // these two env vars which would be set otherwise. From f05282f03601ea0d7cd0a9bc5b0ee46de6600de0 Mon Sep 17 00:00:00 2001 From: O01eg Date: Fri, 12 Jan 2018 10:04:02 +0300 Subject: [PATCH 5/7] Add library path for real rustdoc with `RUSTDOC_LIBDIR` environment variable. --- src/bootstrap/bin/rustdoc.rs | 2 +- src/bootstrap/builder.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs index 6d64248b42381..389b504c64cdc 100644 --- a/src/bootstrap/bin/rustdoc.rs +++ b/src/bootstrap/bin/rustdoc.rs @@ -23,7 +23,7 @@ use std::path::PathBuf; fn main() { let args = env::args_os().skip(1).collect::>(); let rustdoc = env::var_os("RUSTDOC_REAL").expect("RUSTDOC_REAL was not set"); - let libdir = env::var_os("RUSTC_LIBDIR").expect("RUSTC_LIBDIR was not set"); + let libdir = env::var_os("RUSTDOC_LIBDIR").expect("RUSTDOC_LIBDIR was not set"); let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set"); let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set"); diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 49d3c87d599b6..a8ef84ff1e980 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -416,7 +416,7 @@ impl<'a> Builder<'a> { let compiler = self.compiler(self.top_stage, host); cmd.env("RUSTC_STAGE", compiler.stage.to_string()) .env("RUSTC_SYSROOT", self.sysroot(compiler)) - .env("RUSTC_LIBDIR", self.sysroot_libdir(compiler, self.build.build)) + .env("RUSTDOC_LIBDIR", self.sysroot_libdir(compiler, self.build.build)) .env("CFG_RELEASE_CHANNEL", &self.build.config.channel) .env("RUSTDOC_REAL", self.rustdoc(host)) .env("RUSTDOC_CRATE_VERSION", self.build.rust_version()) @@ -496,6 +496,9 @@ impl<'a> Builder<'a> { if let Some(target_linker) = self.build.linker(target) { cargo.env("RUSTC_TARGET_LINKER", target_linker); } + if cmd != "build" { + cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(self.compiler(2, self.build.build))); + } if mode != Mode::Tool { // Tools don't get debuginfo right now, e.g. cargo and rls don't From 83e76d6f29119cf997840fb8d38b4941ba68b748 Mon Sep 17 00:00:00 2001 From: O01eg Date: Tue, 26 Dec 2017 00:00:09 +0300 Subject: [PATCH 6/7] Remove unused argument `rustc_cargo`. --- src/bootstrap/check.rs | 2 +- src/bootstrap/compile.rs | 3 +-- src/bootstrap/doc.rs | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index cc9be3cec3476..ed110762cb3c0 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -1166,7 +1166,7 @@ impl Step for Crate { } Mode::Librustc => { builder.ensure(compile::Rustc { compiler, target }); - compile::rustc_cargo(build, &compiler, target, &mut cargo); + compile::rustc_cargo(build, target, &mut cargo); ("librustc", "rustc-main") } _ => panic!("can only test libraries"), diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 1db39361aef91..91a4f7e23bab4 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -485,7 +485,7 @@ impl Step for Rustc { build.clear_if_dirty(&stage_out, &libtest_stamp(build, compiler, target)); let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "build"); - rustc_cargo(build, &compiler, target, &mut cargo); + rustc_cargo(build, target, &mut cargo); run_cargo(build, &mut cargo, &librustc_stamp(build, compiler, target)); @@ -500,7 +500,6 @@ impl Step for Rustc { /// Same as `std_cargo`, but for libtest pub fn rustc_cargo(build: &Build, - _compiler: &Compiler, target: Interned, cargo: &mut Command) { cargo.arg("--features").arg(build.rustc_features()) diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 832da24c994db..178d60dd7df73 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -616,7 +616,7 @@ impl Step for Rustc { t!(symlink_dir_force(&my_out, &out_dir)); let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "doc"); - compile::rustc_cargo(build, &compiler, target, &mut cargo); + compile::rustc_cargo(build, target, &mut cargo); if build.config.compiler_docs { // src/rustc/Cargo.toml contains a bin crate called rustc which From 472f4e1cc8c3a94f97a127334a82aeee43909577 Mon Sep 17 00:00:00 2001 From: O01eg Date: Sat, 16 Dec 2017 22:48:45 +0300 Subject: [PATCH 7/7] Remove unused configuration parameter `libdir_relative`. --- src/bootstrap/builder.rs | 4 ++-- src/bootstrap/compile.rs | 2 +- src/bootstrap/config.rs | 2 -- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index a8ef84ff1e980..a660b5cf852aa 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -357,8 +357,8 @@ impl<'a> Builder<'a> { fn run(self, builder: &Builder) -> Interned { let compiler = self.compiler; - let lib = if compiler.stage >= 1 && builder.build.config.libdir_relative.is_some() { - builder.build.config.libdir_relative.clone().unwrap() + let lib = if compiler.stage >= 1 && builder.build.config.libdir.is_some() { + builder.build.config.libdir.clone().unwrap() } else { PathBuf::from("lib") }; diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 91a4f7e23bab4..c6adfc7ffae47 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -514,7 +514,7 @@ pub fn rustc_cargo(build: &Build, .env("CFG_PREFIX", build.config.prefix.clone().unwrap_or_default()); let libdir_relative = - build.config.libdir_relative.clone().unwrap_or(PathBuf::from("lib")); + build.config.libdir.clone().unwrap_or(PathBuf::from("lib")); cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative); // If we're not building a compiler with debugging information then remove diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 081425cc47425..72e75fddc1942 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -121,7 +121,6 @@ pub struct Config { pub docdir: Option, pub bindir: Option, pub libdir: Option, - pub libdir_relative: Option, pub mandir: Option, pub codegen_tests: bool, pub nodejs: Option, @@ -403,7 +402,6 @@ impl Config { config.docdir = install.docdir.clone().map(PathBuf::from); config.bindir = install.bindir.clone().map(PathBuf::from); config.libdir = install.libdir.clone().map(PathBuf::from); - config.libdir_relative = install.libdir.clone().map(PathBuf::from); config.mandir = install.mandir.clone().map(PathBuf::from); }