diff mbox series

[meta-lts-mixins,scarthgap/rust,1/9] cargo.bbclass: do not install libraries by default

Message ID b0e2fb16ddb20f4d5915d9fa13c41788b8bdd3b5.1738173519.git.scott.murray@konsulko.com
State New
Headers show
Series Update to Rust 1.81.0 | expand

Commit Message

Scott Murray Jan. 29, 2025, 6:08 p.m. UTC
From: Alexander Kanavin <alex@linutronix.de>

'cargo install' only installs executables and examples into the system,
and we should follow that. Libraries are vendored into
build trees from the crate registry and then baked directly into executables.

Neverthless, there's now a condition variable, so individual recipes can
opt into installing libraries if there's a use case for it.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(adapted from oe-core commit 68990af9630da16fc75362ca09046ceab71a1106)
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
---
 classes-recipe/cargo.bbclass | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/classes-recipe/cargo.bbclass b/classes-recipe/cargo.bbclass
index 0829a58..b583f84 100644
--- a/classes-recipe/cargo.bbclass
+++ b/classes-recipe/cargo.bbclass
@@ -61,9 +61,11 @@  cargo_do_install () {
 	for tgt in "${B}/target/${CARGO_TARGET_SUBDIR}/"*; do
 		case $tgt in
 		*.so|*.rlib)
-			install -d "${D}${rustlibdir}"
-			install -m755 "$tgt" "${D}${rustlibdir}"
-			have_installed=true
+                        if [ -n "${CARGO_INSTALL_LIBRARIES}" ]; then
+				install -d "${D}${rustlibdir}"
+				install -m755 "$tgt" "${D}${rustlibdir}"
+				have_installed=true
+			fi
 			;;
 		*examples)
 			if [ -d "$tgt" ]; then