On Fri, 2025-10-10 at 15:52 +0800, hongxu via lists.openembedded.org wrote: > 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 <[email protected]> > --- > meta/classes-recipe/cargo.bbclass | 4 ++-- > meta/conf/distro/include/debug_build.inc | 4 ++++ > 2 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/meta/classes-recipe/cargo.bbclass > b/meta/classes-recipe/cargo.bbclass > index 2dd28e95d3..c90b8c18f0 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.inc > b/meta/conf/distro/include/debug_build.inc > index c8e2cf90cf..1b399b6f65 100644 > --- a/meta/conf/distro/include/debug_build.inc > +++ b/meta/conf/distro/include/debug_build.inc > @@ -47,3 +47,7 @@ INHIBIT_SYSROOT_STRIP:class-native ?= "1" > > # For meson.bbclass > MESON_BUILDTYPE ?= "debug" > + > +# For cargo.bbclass > +BUILD_MODE ?= "" > +BUILD_DIR ?= "debug"
These worry me as they are generic names not specific to cargo. I'd really like to see a more cargo specific name if we're going to call this from generic code so we may need to do some renaming. Cheers, Richard
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#227734): https://lists.openembedded.org/g/openembedded-core/message/227734 Mute This Topic: https://lists.openembedded.org/mt/115685784/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
