diff mbox series

[meta-lts-mixins,kirkstone/rust,02/10] cargo.bbclass: do not install libraries by default

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

Commit Message

Scott Murray Feb. 11, 2025, 7:17 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>
---
 classes/cargo.bbclass | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/classes/cargo.bbclass b/classes/cargo.bbclass
index 0829a58..b583f84 100644
--- a/classes/cargo.bbclass
+++ b/classes/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