Skip to content

Commit fde0448

Browse files
authored
Unrolled build for rust-lang#130536
Rollup merge of rust-lang#130536 - cuviper:rustbook-dylib-path, r=Mark-Simulacrum bootstrap: Set the dylib path when building books with rustdoc The library path is needed when the toolchain has been configured with `[rust] rpath = false`. Otherwise, building the reference book will get an error when it tries to run rustdoc, like: rustdoc: error while loading shared libraries: librustc_driver-2ec457c3b8826b72.so
2 parents 648d024 + de4c897 commit fde0448

File tree

1 file changed

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

1 file changed

+11
-9
lines changed

Diff for: src/bootstrap/src/core/build_steps/doc.rs

+11-9
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ macro_rules! book {
6363
src: builder.src.join($path),
6464
parent: Some(self),
6565
languages: $lang.into(),
66-
rustdoc: None,
66+
rustdoc_compiler: None,
6767
})
6868
}
6969
}
@@ -113,7 +113,7 @@ impl Step for UnstableBook {
113113
src: builder.md_doc_out(self.target).join("unstable-book"),
114114
parent: Some(self),
115115
languages: vec![],
116-
rustdoc: None,
116+
rustdoc_compiler: None,
117117
})
118118
}
119119
}
@@ -125,7 +125,7 @@ struct RustbookSrc<P: Step> {
125125
src: PathBuf,
126126
parent: Option<P>,
127127
languages: Vec<&'static str>,
128-
rustdoc: Option<PathBuf>,
128+
rustdoc_compiler: Option<Compiler>,
129129
}
130130

131131
impl<P: Step> Step for RustbookSrc<P> {
@@ -157,14 +157,17 @@ impl<P: Step> Step for RustbookSrc<P> {
157157
let _ = fs::remove_dir_all(&out);
158158

159159
let mut rustbook_cmd = builder.tool_cmd(Tool::Rustbook);
160-
if let Some(mut rustdoc) = self.rustdoc {
160+
161+
if let Some(compiler) = self.rustdoc_compiler {
162+
let mut rustdoc = builder.rustdoc(compiler);
161163
rustdoc.pop();
162164
let old_path = env::var_os("PATH").unwrap_or_default();
163165
let new_path =
164166
env::join_paths(std::iter::once(rustdoc).chain(env::split_paths(&old_path)))
165167
.expect("could not add rustdoc to PATH");
166168

167169
rustbook_cmd.env("PATH", new_path);
170+
builder.add_rustc_lib_path(compiler, &mut rustbook_cmd);
168171
}
169172

170173
rustbook_cmd.arg("build").arg(&src).arg("-d").arg(&out).run(builder);
@@ -240,7 +243,7 @@ impl Step for TheBook {
240243
src: absolute_path.clone(),
241244
parent: Some(self),
242245
languages: vec![],
243-
rustdoc: None,
246+
rustdoc_compiler: None,
244247
});
245248

246249
// building older edition redirects
@@ -253,7 +256,7 @@ impl Step for TheBook {
253256
// treat the other editions as not having a parent.
254257
parent: Option::<Self>::None,
255258
languages: vec![],
256-
rustdoc: None,
259+
rustdoc_compiler: None,
257260
});
258261
}
259262

@@ -1236,7 +1239,7 @@ impl Step for RustcBook {
12361239
src: out_base,
12371240
parent: Some(self),
12381241
languages: vec![],
1239-
rustdoc: None,
1242+
rustdoc_compiler: None,
12401243
});
12411244
}
12421245
}
@@ -1270,16 +1273,15 @@ impl Step for Reference {
12701273
// This is needed for generating links to the standard library using
12711274
// the mdbook-spec plugin.
12721275
builder.ensure(compile::Std::new(self.compiler, builder.config.build));
1273-
let rustdoc = builder.rustdoc(self.compiler);
12741276

12751277
// Run rustbook/mdbook to generate the HTML pages.
12761278
builder.ensure(RustbookSrc {
12771279
target: self.target,
12781280
name: "reference".to_owned(),
12791281
src: builder.src.join("src/doc/reference"),
1282+
rustdoc_compiler: Some(self.compiler),
12801283
parent: Some(self),
12811284
languages: vec![],
1282-
rustdoc: Some(rustdoc),
12831285
});
12841286
}
12851287
}

0 commit comments

Comments
 (0)