diff options
| author | O01eg <o01eg@yandex.ru> | 2020-05-29 10:15:46 +0300 |
|---|---|---|
| committer | O01eg <o01eg@yandex.ru> | 2020-05-29 18:51:38 +0300 |
| commit | c0ac2e86f9d7545594fdb1be27f2fe9336699ca7 (patch) | |
| tree | 6ff39219685acc10c8398ba6e7d9f44b9f38a19a | |
| parent | ce722999ea7a150d57504222e16107ef8a6556e6 (diff) | |
| download | rust-c0ac2e86f9d7545594fdb1be27f2fe9336699ca7.tar.gz rust-c0ac2e86f9d7545594fdb1be27f2fe9336699ca7.zip | |
Get libdir from stage0 compiler
| -rw-r--r-- | src/bootstrap/builder.rs | 1 | ||||
| -rw-r--r-- | src/bootstrap/lib.rs | 24 |
2 files changed, 21 insertions, 4 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 5489b1bc66b..c8a85eae252 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -648,6 +648,7 @@ impl<'a> Builder<'a> { pub fn sysroot_libdir_relative(&self, compiler: Compiler) -> &Path { match self.config.libdir_relative() { Some(relative_libdir) if compiler.stage >= 1 => relative_libdir, + _ if compiler.stage == 0 => &self.build.initial_libdir, _ => Path::new("lib"), } } diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 5328ccb64df..c46c68e4d56 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -243,6 +243,7 @@ pub struct Build { initial_rustc: PathBuf, initial_cargo: PathBuf, initial_lld: PathBuf, + initial_libdir: PathBuf, // Runtime state filled in later on // C/C++ compilers and archiver for all targets @@ -344,8 +345,8 @@ impl Build { // we always try to use git for LLVM builds let in_tree_llvm_info = channel::GitInfo::new(false, &src.join("src/llvm-project")); - let initial_target_libdir = if config.dry_run { - "/dummy/path/to/lib/".to_string() + let initial_target_libdir_str = if config.dry_run { + "/dummy/lib/path/to/lib/".to_string() } else { output( Command::new(&config.initial_rustc) @@ -355,13 +356,28 @@ impl Build { .arg("target-libdir"), ) }; - let initial_lld = - Path::new(&initial_target_libdir).parent().unwrap().join("bin").join("rust-lld"); + let initial_target_dir = Path::new(&initial_target_libdir_str).parent().unwrap(); + let initial_lld = initial_target_dir.join("bin").join("rust-lld"); + + let initial_sysroot = if config.dry_run { + "/dummy".to_string() + } else { + output(Command::new(&config.initial_rustc).arg("--print").arg("sysroot")) + }; + let initial_libdir = initial_target_dir + .parent() + .unwrap() + .parent() + .unwrap() + .strip_prefix(initial_sysroot.trim()) + .unwrap() + .to_path_buf(); let mut build = Build { initial_rustc: config.initial_rustc.clone(), initial_cargo: config.initial_cargo.clone(), initial_lld, + initial_libdir, local_rebuild: config.local_rebuild, fail_fast: config.cmd.fail_fast(), doc_tests: config.cmd.doc_tests(), |
