Skip to content

Commit 1e6f9a1

Browse files
committed
Create a RustDevConfig step that stores the LLVM options used to compile LLVM dist archive
1 parent b53fb47 commit 1e6f9a1

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

src/bootstrap/builder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,7 @@ impl<'a> Builder<'a> {
827827
dist::Miri,
828828
dist::LlvmTools,
829829
dist::RustDev,
830+
dist::RustDevConfig,
830831
dist::Bootstrap,
831832
dist::Extended,
832833
// It seems that PlainSourceTarball somehow changes how some of the tools

src/bootstrap/dist.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2297,6 +2297,48 @@ impl Step for RustDev {
22972297
}
22982298
}
22992299

2300+
// Tarball intended for internal consumption to ease rustc/std development.
2301+
//
2302+
// Should not be considered stable by end users.
2303+
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
2304+
pub struct RustDevConfig {
2305+
pub target: TargetSelection,
2306+
}
2307+
2308+
impl Step for RustDevConfig {
2309+
type Output = Option<GeneratedTarball>;
2310+
const DEFAULT: bool = true;
2311+
const ONLY_HOSTS: bool = true;
2312+
2313+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
2314+
run.alias("rust-dev-config")
2315+
}
2316+
2317+
fn make_run(run: RunConfig<'_>) {
2318+
run.builder.ensure(RustDevConfig { target: run.target });
2319+
}
2320+
2321+
fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
2322+
let target = self.target;
2323+
2324+
/* run only if llvm-config isn't used */
2325+
if let Some(config) = builder.config.target_config.get(&target) {
2326+
if let Some(ref _s) = config.llvm_config {
2327+
builder.info(&format!("Skipping RustDevConfig ({}): external LLVM", target));
2328+
return None;
2329+
}
2330+
}
2331+
2332+
let mut tarball = Tarball::new(builder, "rust-dev-config", &target.triple);
2333+
tarball.set_overlay(OverlayKind::LLVM);
2334+
2335+
let config = t!(serde_json::to_string_pretty(&builder.build.config.llvm));
2336+
t!(std::fs::write(tarball.image_dir().join("llvm-opts.json"), config));
2337+
2338+
Some(tarball.generate())
2339+
}
2340+
}
2341+
23002342
// Tarball intended for internal consumption to ease rustc/std development.
23012343
//
23022344
// Should not be considered stable by end users.

0 commit comments

Comments
 (0)