Skip to content

Commit d2aa754

Browse files
authored
Rollup merge of #144056 - Kobzol:gcc-build-src, r=nikic
Copy GCC sources into the build directory even outside CI It takes ~3.5s on my Linux notebook to perform the copy, but it should only be executed when we actually go build GCC, and that will almost certainly take much longer :) So I think it should be fine. At least we won't be polluting the source directory for local builds. Fixes: #143986 r? ```@nikic```
2 parents 376917b + 6645bf5 commit d2aa754

File tree

1 file changed

+11
-14
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+11
-14
lines changed

src/bootstrap/src/core/build_steps/gcc.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -220,21 +220,18 @@ fn build_gcc(metadata: &Meta, builder: &Builder<'_>, target: TargetSelection) {
220220
t!(fs::create_dir_all(install_dir));
221221

222222
// GCC creates files (e.g. symlinks to the downloaded dependencies)
223-
// in the source directory, which does not work with our CI setup, where we mount
223+
// in the source directory, which does not work with our CI/Docker setup, where we mount
224224
// source directories as read-only on Linux.
225-
// Therefore, as a part of the build in CI, we first copy the whole source directory
226-
// to the build directory, and perform the build from there.
227-
let src_dir = if builder.config.is_running_on_ci {
228-
let src_dir = builder.gcc_out(target).join("src");
229-
if src_dir.exists() {
230-
builder.remove_dir(&src_dir);
231-
}
232-
builder.create_dir(&src_dir);
233-
builder.cp_link_r(root, &src_dir);
234-
src_dir
235-
} else {
236-
root.clone()
237-
};
225+
// And in general, we shouldn't be modifying the source directories if possible, even for local
226+
// builds.
227+
// Therefore, we first copy the whole source directory to the build directory, and perform the
228+
// build from there.
229+
let src_dir = builder.gcc_out(target).join("src");
230+
if src_dir.exists() {
231+
builder.remove_dir(&src_dir);
232+
}
233+
builder.create_dir(&src_dir);
234+
builder.cp_link_r(root, &src_dir);
238235

239236
command(src_dir.join("contrib/download_prerequisites")).current_dir(&src_dir).run(builder);
240237
let mut configure_cmd = command(src_dir.join("configure"));

0 commit comments

Comments
 (0)