From patchwork Mon Nov 30 00:52:21 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Murray X-Patchwork-Id: 106326 Received: from mail-qv1-f53.google.com (mail-qv1-f53.google.com [209.85.219.53]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.23417.1795999965409287833 for ; Sun, 29 Nov 2026 16:52:45 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@konsulko.com header.s=google header.b=mOeGlJxt; spf=pass (domain: konsulko.com, ip: 209.85.219.53, mailfrom: scott.murray@konsulko.com) Received: by mail-qv1-f53.google.com with SMTP id 6a1803df08f44-91c847584b8so105662446d6.0 for ; Sun, 29 Nov 2026 16:52:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1795999964; x=1796604764; darn=lists.yoctoproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=nFLDCZWxxqpGR70qElHFKsQCTr4qr98l1shdU7xxw6k=; b=mOeGlJxtxE0N6jtzZrdqhnlTdF0IOrG2NYsDbCWRCHdhFQKl3lkuwoJX8+Rohpqmy9 BOYpbHnQy3edp9ItFkoygcGnW1hSnEEcVpdMTWSlcczesRkU64WbmD+Knlgk7kCdzstl k2cR4hL3g9012E5Z9xp23jBWTrtScM23l73QQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795999964; x=1796604764; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=nFLDCZWxxqpGR70qElHFKsQCTr4qr98l1shdU7xxw6k=; b=22E11UwWJLVWg5Lfhe2W9n0OWT77N93m93o11FUNuvxHUZhsxhllsqXx3zIUmO2p7l V1mAQkav6Ds1XMlkDxUwqCLTTs7lH5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hHjP5UflYZ AhXRKERUwLPhGnaO70te15nENX6O0r9FgWNUhy0nazWWSevJ5SZUo9wFTDMWfnSgeUw== X-Received: by 2002:a05:6214:124e:b0:921:1542:c8a6 with SMTP id 6a1803df08f44-92134b7875amr580602216d6.21.1795999964134; Sun, 29 Nov 2026 16:52:44 -0800 (PST) Return-Path: Received: from ghidorah.spiteful.org (107-179-213-3.cpe.teksavvy.com. [107.179.213.3]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-921787fd72asm141946796d6.12.2026.11.29.16.52.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 16:52:43 -0800 (PST) From: Scott Murray To: yocto-patches@lists.yoctoproject.org Subject: [meta-lts-mixins][wrynose/rust][PATCH 03/10] rust: add rust-analyzer to the SDK behind a PACKAGECONFIG Date: Sun, 29 Nov 2026 19:52:21 -0500 Message-ID: X-Mailer: git-send-email 2.56.1 In-Reply-To: References: MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Mon, 30 Nov 2026 00:52:51 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/5590 From: Benhur Tessele Add a rust-analyzer PACKAGECONFIG option which, when enabled, installs it for the nativesdk variant and packages it as rust-tools-analyzer. The option is disabled by default. Two additional pieces are required for the tool to be usable: - The proc-macro server, rust-analyzer-proc-macro-srv, which rust-analyzer looks up under /libexec. Install it into ${libexecdir}; without it, analysis of any crate using a derive or attribute macro fails with "cannot find proc-macro server in sysroot". - The standard library sources, which rust-analyzer analyses from source rather than from the compiled rlibs. Add an RDEPENDS on ${PN}-src-lib so that core/std items resolve. Both binaries link against librustc_driver from the main package, so the package also RDEPENDS on ${PN}. rust-analyzer is only installed for nativesdk, as a language server is used on the SDK host rather than on a target device. To get it into an SDK: SDK_FEATURES:append = " rust" PACKAGECONFIG:append:pn-nativesdk-rust = " rust-analyzer" TOOLCHAIN_HOST_TASK:append = " nativesdk-rust-tools-analyzer" Tested by building an SDK with the option enabled and confirming rust-analyzer resolves the standard library and expands proc-macros, and by building with the option disabled to confirm the default configuration is unaffected. AI-Generated: Kiro with Claude Opus 5 Signed-off-by: Benhur Tessele Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie (adapted from oe-core commit bfeb93bd978c1f03947a90b137bb9237807cc842) Signed-off-by: Scott Murray --- recipes-devtools/rust/rust_1.99.1.bb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/recipes-devtools/rust/rust_1.99.1.bb b/recipes-devtools/rust/rust_1.99.1.bb index 4fa6f1a..5933578 100644 --- a/recipes-devtools/rust/rust_1.99.1.bb +++ b/recipes-devtools/rust/rust_1.99.1.bb @@ -24,6 +24,8 @@ RDEPENDS:${PN}:append:class-target = " gcc g++ binutils" PACKAGECONFIG ??= "llvm-shared" PACKAGECONFIG[llvm-shared] = ",,," +# Only used by the nativesdk variant; rust-analyzer runs on the SDK host +PACKAGECONFIG[rust-analyzer] = ",,," S = "${RUSTSRC}" # Separate build directory from the shared source tree so that multiple @@ -282,17 +284,21 @@ do_test_compile () { ALLOW_EMPTY:${PN} = "1" PACKAGES =+ "${PN}-rustdoc ${PN}-tools-clippy ${PN}-tools-rustfmt ${PN}-src-lib" +PACKAGES:prepend:class-nativesdk = "${@bb.utils.contains('PACKAGECONFIG', 'rust-analyzer', '${PN}-tools-analyzer ', '', d)}" FILES:${PN}-rustdoc = "${bindir}/rustdoc" FILES:${PN}-tools-clippy = "${bindir}/cargo-clippy ${bindir}/clippy-driver" FILES:${PN}-tools-rustfmt = "${bindir}/rustfmt" +FILES:${PN}-tools-analyzer = "${bindir}/rust-analyzer ${libexecdir}/rust-analyzer-proc-macro-srv" FILES:${PN}-src-lib = "${libdir}/rustlib/src/rust" RDEPENDS:${PN}-rustdoc = "${PN}" RDEPENDS:${PN}-tools-clippy = "${PN}" RDEPENDS:${PN}-tools-rustfmt = "${PN}" +RDEPENDS:${PN}-tools-analyzer = "${PN} ${PN}-src-lib" SUMMARY:${PN}-tools-clippy = "A collection of lints to catch common mistakes and improve your Rust code" SUMMARY:${PN}-tools-rustfmt = "A tool for formatting Rust code according to style guidelines" +SUMMARY:${PN}-tools-analyzer = "A language server providing IDE features for Rust" do_install () { rust_do_install @@ -314,6 +320,10 @@ rust_do_install:class-nativesdk() { rust_runx install rust_runx install clippy rust_runx install rustfmt + if ${@bb.utils.contains('PACKAGECONFIG', 'rust-analyzer', 'true', 'false', d)}; then + rust_runx install rust-analyzer + rust_runx build rust-analyzer-proc-macro-srv + fi unset PSEUDO_UNLOAD install -d ${D}${bindir} @@ -322,6 +332,14 @@ rust_do_install:class-nativesdk() { patchelf --set-rpath "\$ORIGIN/../lib" ${D}${bindir}/$i done + if ${@bb.utils.contains('PACKAGECONFIG', 'rust-analyzer', 'true', 'false', d)}; then + install -d ${D}${libexecdir} + cp rust-build/${RUST_BUILD_SYS}/stage2-tools/${RUST_HOST_SYS}/release/rust-analyzer ${D}${bindir} + patchelf --set-rpath "\$ORIGIN/../lib" ${D}${bindir}/rust-analyzer + cp rust-build/${RUST_BUILD_SYS}/stage2-tools/${RUST_HOST_SYS}/release/rust-analyzer-proc-macro-srv ${D}${libexecdir} + patchelf --set-rpath "\$ORIGIN/../lib" ${D}${libexecdir}/rust-analyzer-proc-macro-srv + fi + chown root:root ${D}/ -R rm ${D}${libdir}/rustlib/uninstall.sh rm ${D}${libdir}/rustlib/install.log