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 when we install the compiller as well. Signed-off-by: Alistair Francis <[email protected]> --- v2: - Update patch with new upstream submission ...l-fix-for-.-x-install-src-with-build.patch | 45 +++++++++++++++++++ meta/recipes-devtools/rust/rust-source.inc | 1 + meta/recipes-devtools/rust/rust_1.93.0.bb | 4 +- 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-devtools/rust/files/0001-bootstrap-minimal-fix-for-.-x-install-src-with-build.patch diff --git a/meta/recipes-devtools/rust/files/0001-bootstrap-minimal-fix-for-.-x-install-src-with-build.patch b/meta/recipes-devtools/rust/files/0001-bootstrap-minimal-fix-for-.-x-install-src-with-build.patch new file mode 100644 index 0000000000..aeb59ff567 --- /dev/null +++ b/meta/recipes-devtools/rust/files/0001-bootstrap-minimal-fix-for-.-x-install-src-with-build.patch @@ -0,0 +1,45 @@ +From e26974ca33aa322bbc60db5d1010899e40f6d624 Mon Sep 17 00:00:00 2001 +From: Alistair Francis <[email protected]> +Date: Fri, 9 Jan 2026 08:35:43 +1000 +Subject: [PATCH] bootstrap: minimal fix for ./x install src with build.docs = + false + +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 ensures that the builder.doc_out(host) directory exists. + +This fixes installing the Rust source when `build.docs = false`. + +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]> +Signed-off-by: Jieyou Xu <[email protected]> +--- + src/bootstrap/src/core/build_steps/dist.rs | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs +index 2e291f7c2c3..28a7afd6c61 100644 +--- a/src/bootstrap/src/core/build_steps/dist.rs ++++ b/src/bootstrap/src/core/build_steps/dist.rs +@@ -87,6 +87,12 @@ fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> { + // from a shared directory. + builder.run_default_doc_steps(); + ++ // In case no default doc steps are run for host, it is possible that `<host>/doc` directory ++ // is never created. ++ if !builder.config.dry_run() { ++ t!(fs::create_dir_all(builder.doc_out(host))); ++ } ++ + let dest = "share/doc/rust/html"; + + let mut tarball = Tarball::new(builder, "rust-docs", &host.triple); +-- +2.53.0 + diff --git a/meta/recipes-devtools/rust/rust-source.inc b/meta/recipes-devtools/rust/rust-source.inc index 514f3fec1e..65c6dc2857 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-minimal-fix-for-.-x-install-src-with-build.patch;patchdir=${RUSTSRC} \ " SRC_URI[rust.sha256sum] = "e30d898272c587a22f77679f03c5e8192b5645c7c9ccc3407ad1106761507cea" diff --git a/meta/recipes-devtools/rust/rust_1.93.0.bb b/meta/recipes-devtools/rust/rust_1.93.0.bb index 2be0bd8d89..9c3efc7453 100644 --- a/meta/recipes-devtools/rust/rust_1.93.0.bb +++ b/meta/recipes-devtools/rust/rust_1.93.0.bb @@ -6,8 +6,9 @@ LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=11a3899825f4376896e438c8c753f8dc" inherit rust inherit cargo_common +inherit pkgconfig -DEPENDS += "llvm" +DEPENDS += "llvm openssl" # native rust uses cargo/rustc from binary snapshots to bootstrap # but everything else should use our native builds DEPENDS:append:class-target = " cargo-native rust-native" @@ -284,6 +285,7 @@ do_install () { rust_do_install() { rust_runx install + rust_runx install src } rust_do_install:class-nativesdk() { -- 2.53.0
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#232446): https://lists.openembedded.org/g/openembedded-core/message/232446 Mute This Topic: https://lists.openembedded.org/mt/118147983/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
