From: Alistair Francis <[email protected]> When building the Linux kernel with Rust support enabled the kernel expects to find the Rust source as the kernel build system will cross compile the core library.
This patch uses the Rust tooling to install the Rust source (of size ~50MB) when we install the compiller as well. Signed-off-by: Alistair Francis <[email protected]> Signed-off-by: Harish Sadineni <[email protected]> --- ...-host-documentation-is-built-before-.patch | 60 +++++++++++++++++++ meta/recipes-devtools/rust/rust-source.inc | 1 + meta/recipes-devtools/rust/rust_1.92.0.bb | 2 + 3 files changed, 63 insertions(+) create mode 100644 meta/recipes-devtools/rust/files/0001-bootstrap-Ensure-host-documentation-is-built-before-.patch diff --git a/meta/recipes-devtools/rust/files/0001-bootstrap-Ensure-host-documentation-is-built-before-.patch b/meta/recipes-devtools/rust/files/0001-bootstrap-Ensure-host-documentation-is-built-before-.patch new file mode 100644 index 0000000000..e561266d70 --- /dev/null +++ b/meta/recipes-devtools/rust/files/0001-bootstrap-Ensure-host-documentation-is-built-before-.patch @@ -0,0 +1,60 @@ +From 2e89bf7969ac6d77b7c6a38265b1eabc8ec6df7a Mon Sep 17 00:00:00 2001 +From: Alistair Francis <[email protected]> +Date: Fri, 9 Jan 2026 08:35:43 +1000 +Subject: [PATCH] bootstrap: Ensure host documentation is built before tarball + is created + +`run_default_doc_steps()` is called to ensure the documentation is built +by `Docs::run()` and it should build the documentation if it isn't +already built. + +When running the `install src` command I'm seeing failures as the +`builder.doc_out(host)` directory does not exist. This is because +`match_paths_to_steps_and_run()` doesn't actually build any +documentation as the `paths.is_empty()` causes an early return. This +results in install failures as the `*/doc` src directory doesn't exist. + +This patch passes the paths to `run_host_step_descriptions()` when building +documentation to ensure it is correctly built. + +This fixes installing the Rust source code in OpenEmbedded. + +Upstream-Status: Submitted [https://github.com/rust-lang/rust/pull/150845] +Signed-off-by: Alistair Francis <[email protected]> +--- + src/bootstrap/src/core/build_steps/dist.rs | 2 +- + src/bootstrap/src/core/builder/mod.rs | 5 +++++ + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs +index f47b0c0b007..2fbb068632e 100644 +--- a/src/bootstrap/src/core/build_steps/dist.rs ++++ b/src/bootstrap/src/core/build_steps/dist.rs +@@ -83,7 +83,7 @@ fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> { + // FIXME: explicitly enumerate the steps that should be executed here, and gather their + // documentation, rather than running all default steps and then read their output + // from a shared directory. +- builder.run_default_doc_steps(); ++ builder.run_host_default_doc_steps(); + + let dest = "share/doc/rust/html"; + +diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs +index 4a04b97c549..16c1c324be0 100644 +--- a/src/bootstrap/src/core/builder/mod.rs ++++ b/src/bootstrap/src/core/builder/mod.rs +@@ -1117,6 +1117,11 @@ pub fn execute_cli(&self) { + self.run_step_descriptions(&Builder::get_step_descriptions(self.kind), &self.paths); + } + ++ /// Run all default documentation steps to build documentation. ++ pub fn run_host_default_doc_steps(&self) { ++ self.run_step_descriptions(&Builder::get_step_descriptions(Kind::Doc), &self.paths); ++ } ++ + /// Run all default documentation steps to build documentation. + pub fn run_default_doc_steps(&self) { + self.run_step_descriptions(&Builder::get_step_descriptions(Kind::Doc), &[]); +-- +2.52.0 + diff --git a/meta/recipes-devtools/rust/rust-source.inc b/meta/recipes-devtools/rust/rust-source.inc index d7d44510e4..2c1caed858 100644 --- a/meta/recipes-devtools/rust/rust-source.inc +++ b/meta/recipes-devtools/rust/rust-source.inc @@ -8,6 +8,7 @@ SRC_URI += "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;n file://0001-src-core-build_steps-tool.rs-switch-off-lto-for-rust.patch;patchdir=${RUSTSRC} \ file://revert-link-std-statically-in-rustc_driver-feature.patch;patchdir=${RUSTSRC} \ file://0001-riscv32-Define-plain-syscalls-as-their-time64-varian.patch;patchdir=${RUSTSRC} \ + file://0001-bootstrap-Ensure-host-documentation-is-built-before-.patch;patchdir=${RUSTSRC} \ " SRC_URI[rust.sha256sum] = "ebee170bfe4c4dfc59521a101de651e5534f4dae889756a5c97ca9ea40d0c307" diff --git a/meta/recipes-devtools/rust/rust_1.92.0.bb b/meta/recipes-devtools/rust/rust_1.92.0.bb index a25f65f674..af739df88a 100644 --- a/meta/recipes-devtools/rust/rust_1.92.0.bb +++ b/meta/recipes-devtools/rust/rust_1.92.0.bb @@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=11a3899825f4376896e438c8c753f8dc" inherit rust inherit cargo_common +inherit pkgconfig DEPENDS += "llvm" # native rust uses cargo/rustc from binary snapshots to bootstrap @@ -282,6 +283,7 @@ do_install () { rust_do_install() { rust_runx install + rust_runx install src } rust_do_install:class-nativesdk() { -- 2.49.0
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#229769): https://lists.openembedded.org/g/openembedded-core/message/229769 Mute This Topic: https://lists.openembedded.org/mt/117368062/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
