1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
Date: Thu, 14 Jul 2022 13:17:39 +0200
Subject: d-bootstrap-use-local-css
Forwarded: not-needed
===================================================================
---
src/bootstrap/src/core/build_steps/doc.rs | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs
index 1e9f7cb..c4d8b2f 100644
--- a/src/bootstrap/src/core/build_steps/doc.rs
+++ b/src/bootstrap/src/core/build_steps/doc.rs
@@ -390,7 +390,27 @@ impl Step for Standalone {
.arg("--index-page")
.arg(builder.src.join("src/doc/index.md"))
.arg("--markdown-playground-url")
- .arg("https://play.rust-lang.org/")
+ .arg("https://play.rust-lang.org/");
+
+ // Debian: librustdoc now generates a resource-suffix for static
+ // files with rustc_hash::FxHasher, so we need to find it.
+ let _dir = out.join("static.files");
+ if _dir.is_dir() {
+ let _css = _dir.read_dir().expect("Debian: failed to read static.files/ when is_dir() == true")
+ .find_map(|entry| entry.ok().map(|entry| {
+ let name = entry.file_name().into_string()
+ .expect("Debian: rustc files should have UTF-8 name");
+ if name.starts_with("rustdoc-") && name.ends_with(".css") {
+ Some(format!("static.files/{name}"))
+ } else { None }
+ })).flatten();
+ if let Some(name) = _css {
+ cmd.arg("--markdown-css").arg(name);
+ }
+ }
+
+ cmd.arg("--markdown-css")
+ .arg("rust.css")
.arg("-o")
.arg(&out)
.arg(&path);
@@ -399,11 +419,6 @@ impl Step for Standalone {
cmd.arg("--disable-minification");
}
- if filename == "not_found.md" {
- cmd.arg("--markdown-css").arg("https://doc.rust-lang.org/rust.css");
- } else {
- cmd.arg("--markdown-css").arg("rust.css");
- }
cmd.run(builder);
}
|