Skip to content

Commit 675af3c

Browse files
authored
Rollup merge of #149655 - Nadrieril:install-rustc-dev, r=Kobzol
bootstrap: add rustc-dev install target I'm entirely new to bootstrap but there seemed to be no easy way to construct a sysroot with tools and librustc_driver.so. `./x install` is the command for that but as far as I can tell it doesn't include the rustc-dev files. This is my attempt at adding that. `./x install rustc-dev` now does what you expect (at least on my machine™). If I'm understanding correctly this also means that `./x install` will now include rustc-dev files if `build.tools` contains `"rustc-dev"`.
2 parents c4dc70e + a96d486 commit 675af3c

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

src/bootstrap/src/core/build_steps/dist.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -892,8 +892,8 @@ impl Step for Std {
892892
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
893893
pub struct RustcDev {
894894
/// The compiler that will build rustc which will be shipped in this component.
895-
build_compiler: Compiler,
896-
target: TargetSelection,
895+
pub build_compiler: Compiler,
896+
pub target: TargetSelection,
897897
}
898898

899899
impl RustcDev {

src/bootstrap/src/core/build_steps/install.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,17 @@ install!((self, builder, _config),
279279
});
280280
install_sh(builder, "rustc", self.build_compiler, Some(self.target), &tarball);
281281
};
282+
RustcDev, alias = "rustc-dev", Self::should_build(_config), IS_HOST: true, {
283+
if let Some(tarball) = builder.ensure(dist::RustcDev {
284+
build_compiler: self.build_compiler, target: self.target
285+
}) {
286+
install_sh(builder, "rustc-dev", self.build_compiler, Some(self.target), &tarball);
287+
} else {
288+
builder.info(
289+
&format!("skipping Install RustcDev stage{} ({})", self.build_compiler.stage + 1, self.target),
290+
);
291+
}
292+
};
282293
RustcCodegenCranelift, alias = "rustc-codegen-cranelift", Self::should_build(_config), IS_HOST: true, {
283294
if let Some(tarball) = builder.ensure(dist::CraneliftCodegenBackend {
284295
compilers: RustcPrivateCompilers::from_build_compiler(builder, self.build_compiler, self.target),

src/bootstrap/src/core/builder/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,7 @@ impl<'a> Builder<'a> {
998998
// binary path, we must install rustc before the tools. Otherwise, the rust-installer will
999999
// install the same binaries twice for each tool, leaving backup files (*.old) as a result.
10001000
install::Rustc,
1001+
install::RustcDev,
10011002
install::Cargo,
10021003
install::RustAnalyzer,
10031004
install::Rustfmt,

src/bootstrap/src/core/builder/tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2912,6 +2912,7 @@ mod snapshot {
29122912
[build] rustc 1 <x86_64-unknown-linux-gnu> -> rust-analyzer-proc-macro-srv 2 <x86_64-unknown-linux-gnu>
29132913
[build] rustc 0 <x86_64-unknown-linux-gnu> -> GenerateCopyright 1 <x86_64-unknown-linux-gnu>
29142914
[dist] rustc <x86_64-unknown-linux-gnu>
2915+
[dist] rustc 1 <x86_64-unknown-linux-gnu> -> rustc-dev 2 <x86_64-unknown-linux-gnu>
29152916
[build] rustc 1 <x86_64-unknown-linux-gnu> -> cargo 2 <x86_64-unknown-linux-gnu>
29162917
[dist] rustc 1 <x86_64-unknown-linux-gnu> -> cargo 2 <x86_64-unknown-linux-gnu>
29172918
[build] rustc 1 <x86_64-unknown-linux-gnu> -> rust-analyzer 2 <x86_64-unknown-linux-gnu>

0 commit comments

Comments
 (0)