From 63b8d9b6898ec926f9eafa372506b6722d583694 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Wed, 14 Sep 2022 21:54:16 -0500 Subject: Allow using vendoring when running bootstrap from outside the current working directory --- src/bootstrap/bootstrap.py | 3 ++- src/bootstrap/builder.rs | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index cc08ae5f99f..25037bd0faa 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -771,7 +771,8 @@ class RustBuild(object): elif color == "never": args.append("--color=never") - run(args, env=env, verbose=self.verbose) + # Run this from the source directory so cargo finds .cargo/config + run(args, env=env, verbose=self.verbose, cwd=self.rust_root) def build_triple(self): """Build triple as in LLVM diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 14e8ebd6876..6a07ac6b007 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1325,6 +1325,9 @@ impl<'a> Builder<'a> { ) -> Cargo { let mut cargo = Command::new(&self.initial_cargo); let out_dir = self.stage_out(compiler, mode); + // Run cargo from the source root so it can find .cargo/config. + // This matters when using vendoring and the working directory is outside the repository. + cargo.current_dir(&self.src); // Codegen backends are not yet tracked by -Zbinary-dep-depinfo, // so we need to explicitly clear out if they've been updated. -- cgit 1.4.1-3-g733a5 From f0c78ee3dc7c6b99a939e6afb7348ba8b543d7fd Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sat, 17 Sep 2022 11:03:40 -0400 Subject: Revert "fix #101691: copy stage0 binaries into stage0-sysroot" This reverts commit 32f8eb2fee4d6781a79052b560abd10e12ebb34f. --- src/bootstrap/compile.rs | 37 ------------------------------------- 1 file changed, 37 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index f7ab6bf93fb..c13e83f6c86 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -436,43 +436,6 @@ impl Step for StdLink { let libdir = builder.sysroot_libdir(target_compiler, target); let hostdir = builder.sysroot_libdir(target_compiler, compiler.host); add_to_sysroot(builder, &libdir, &hostdir, &libstd_stamp(builder, compiler, target)); - - if compiler.stage == 0 { - // special handling for stage0, to make `rustup toolchain link` and `x dist --stage 0` - // work for stage0-sysroot - - // copy bin files from stage0/bin to stage0-sysroot/bin - let sysroot = builder.out.join(&compiler.host.triple).join("stage0-sysroot"); - - let host = compiler.host.triple; - let stage0_bin_dir = builder.out.join(&host).join("stage0/bin"); - let sysroot_bin_dir = sysroot.join("bin"); - t!(fs::create_dir_all(&sysroot_bin_dir)); - builder.cp_r(&stage0_bin_dir, &sysroot_bin_dir); - - // copy all *.so files from stage0/lib to stage0-sysroot/lib - let stage0_lib_dir = builder.out.join(&host).join("stage0/lib"); - if let Ok(files) = fs::read_dir(&stage0_lib_dir) { - for file in files { - let file = t!(file); - let path = file.path(); - if path.is_file() && is_dylib(&file.file_name().into_string().unwrap()) { - builder.copy(&path, &sysroot.join("lib").join(path.file_name().unwrap())); - } - } - } - - // copy codegen-backends from stage0 - let sysroot_codegen_backends = builder.sysroot_codegen_backends(compiler); - t!(fs::create_dir_all(&sysroot_codegen_backends)); - let stage0_codegen_backends = builder - .out - .join(&host) - .join("stage0/lib/rustlib") - .join(&host) - .join("codegen-backends"); - builder.cp_r(&stage0_codegen_backends, &sysroot_codegen_backends); - } } } -- cgit 1.4.1-3-g733a5