]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
debug_build.inc: override BUILD_MODE and BUILD_DIR for cargo.bbclass
authorHongxu Jia <hongxu.jia@windriver.com>
Fri, 10 Oct 2025 07:52:58 +0000 (15:52 +0800)
committerMathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Wed, 5 Nov 2025 12:05:08 +0000 (13:05 +0100)
The debug_build.inc is used to collect debug build configuration,
override BUILD_MODE and BUILD_DIR for cargo.bbclass when DEBUG_BUILD is enabled

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
meta/classes-recipe/cargo.bbclass
meta/conf/distro/include/debug_build.inc

index 2dd28e95d33c4187f6f479d3668b5fbea31c475a..c90b8c18f0d583a5f1e268662c5f186783b4a923 100644 (file)
@@ -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}"
index c8e2cf90cf3157b6e3db60705be50f82249720d5..1b399b6f65534cdc8853f80320e460285082b0a3 100644 (file)
@@ -47,3 +47,7 @@ INHIBIT_SYSROOT_STRIP:class-native ?= "1"
 
 # For meson.bbclass
 MESON_BUILDTYPE ?= "debug"
+
+# For cargo.bbclass
+BUILD_MODE ?= ""
+BUILD_DIR ?= "debug"