diff mbox series

[5/5] debug_build_tune.inc: override BUILD_MODE and BUILD_DIR for meson.bbclass

Message ID 20250912160741.346809-5-hongxu.jia@windriver.com
State New
Headers show
Series [1/5] yocto-space-optimize.inc: move space optimize from recipe webkitgtk | expand

Commit Message

Hongxu Jia Sept. 12, 2025, 4:07 p.m. UTC
The debug_build_tune.inc is used to collect debug tuning configuration,
override BUILD_MODE and BUILD_DIR for cargo.bbclass when DEBUG_BUILD is enabled

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/classes-recipe/cargo.bbclass             | 4 ++--
 meta/conf/distro/include/debug_build_tune.inc | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/meta/classes-recipe/cargo.bbclass b/meta/classes-recipe/cargo.bbclass
index 2dd28e95d33..c90b8c18f0d 100644
--- a/meta/classes-recipe/cargo.bbclass
+++ b/meta/classes-recipe/cargo.bbclass
@@ -31,7 +31,7 @@  B = "${WORKDIR}/build"
 export RUST_BACKTRACE = "1"
 
 RUSTFLAGS ??= ""
-BUILD_MODE = "${@['--release', ''][d.getVar('DEBUG_BUILD') == '1']}"
+BUILD_MODE ??= "--release"
 # --frozen flag will prevent network access (which is required since only
 # the do_fetch step is authorized to access network)
 # and will require an up to date Cargo.lock file.
@@ -41,7 +41,7 @@  CARGO_BUILD_FLAGS = "-v --frozen --target ${RUST_HOST_SYS} ${BUILD_MODE} --manif
 
 # This is based on the content of CARGO_BUILD_FLAGS and generally will need to
 # change if CARGO_BUILD_FLAGS changes.
-BUILD_DIR = "${@['release', 'debug'][d.getVar('DEBUG_BUILD') == '1']}"
+BUILD_DIR ??= "release"
 CARGO_TARGET_SUBDIR = "${RUST_HOST_SYS}/${BUILD_DIR}"
 oe_cargo_build () {
 	export RUSTFLAGS="${RUSTFLAGS}"
diff --git a/meta/conf/distro/include/debug_build_tune.inc b/meta/conf/distro/include/debug_build_tune.inc
index 69cdbc84505..34cb3f1ecc8 100644
--- a/meta/conf/distro/include/debug_build_tune.inc
+++ b/meta/conf/distro/include/debug_build_tune.inc
@@ -38,6 +38,10 @@  INHIBIT_SYSROOT_STRIP:class-native ?= "1"
 # For meson.bbclass
 MESON_BUILDTYPE ?= "debug"
 
+# For cargo.bbclass
+BUILD_MODE ?= ""
+BUILD_DIR ?= "debug"
+
 CPPFLAGS:append:arm::pn-lttng-ust = " -DUATOMIC_NO_LINK_ERROR"
 
 EXTRA_OECMAKE:remove:pn-webkitgtk = "-DWEBKIT_NO_INLINE_HINTS=OFF"