diff mbox series

[meta-lts-mixins,scarthgap/rust,24/37] classes/cargo-c: pass flags via CARGO_BUILD_FLAGS

Message ID 09042a422364e3eef9e1b3edea7da48e1b0ea0c0.1789156653.git.scott.murray@konsulko.com
State New
Headers show
Series Update to 1.98.1 | expand

Commit Message

Scott Murray Sept. 11, 2026, 8:13 p.m. UTC
From: Ross Burton <ross.burton@arm.com>

We need to pass the same flags to cbuild and cinstall, as otherwise it
will build in do_compile and then rebuild with the right paths in
do_install.

Add the flags to CARGO_BUILD_FLAGS so that they get used in all calls
and do_install no longer does any building. Example from buildstats:

PKG                        TASK        ABSDIFF  RELDIFF  WALLTIME1 -> WALLTIME2
gstreamer1.0-plugins-rs    do_install  -263.6s   -99.0%     266.2s -> 2.7s

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(adapted from oe-core commit 9079283776997287d455ef32696895d756bc37b3)
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
---
 classes-recipe/cargo_c.bbclass | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/classes-recipe/cargo_c.bbclass b/classes-recipe/cargo_c.bbclass
index e68ac93..cd486b2 100644
--- a/classes-recipe/cargo_c.bbclass
+++ b/classes-recipe/cargo_c.bbclass
@@ -16,6 +16,13 @@  BASEDEPENDS:append = " cargo-c-native"
 
 B = "${WORKDIR}/build"
 
+CARGO_BUILD_FLAGS += "\
+    --destdir ${D} \
+    --prefix ${prefix} \
+    --libdir ${libdir} \
+    --library-type cdylib \
+    "
+
 do_compile[progress] = "outof:\s+(\d+)/(\d+)"
 cargo_c_do_compile() {
     oe_cargo_fix_env
@@ -27,11 +34,7 @@  cargo_c_do_compile() {
 cargo_c_do_install() {
     oe_cargo_fix_env
     export RUSTFLAGS="${RUSTFLAGS}"
-    cargo-cinstall cinstall ${CARGO_BUILD_FLAGS} \
-        --destdir ${D} \
-        --prefix ${prefix} \
-        --libdir ${libdir} \
-        --library-type cdylib
+    cargo-cinstall cinstall ${CARGO_BUILD_FLAGS}
 }
 
 EXPORT_FUNCTIONS do_compile do_install