| Message ID | 20250915061743.313230-8-hongxu.jia@windriver.com |
|---|---|
| State | New |
| Headers | show |
| Series | [1/8] yocto-space-optimize.inc: move space optimize from recipe webkitgtk | expand |
> -----Original Message----- > From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of hongxu via lists.openembedded.org > Sent: den 15 september 2025 08:17 > To: openembedded-core@lists.openembedded.org > Cc: randy.macleod@windriver.com; Peter Kjellerstedt <peter.kjellerstedt@axis.com> > Subject: [OE-core] [PATCH 8/8] debug_build.inc: override BUILD_MODE and BUILD_DIR for meson.bbclass Correct "meson.bbclass" to "cargo.bbclass". > > 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> > --- > 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 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.inc b/meta/conf/distro/include/debug_build.inc > index e446a71dd3f..e6f94504945 100644 > --- a/meta/conf/distro/include/debug_build.inc > +++ b/meta/conf/distro/include/debug_build.inc > @@ -51,5 +51,9 @@ INHIBIT_SYSROOT_STRIP:class-native ?= "1" > # For meson.bbclass > MESON_BUILDTYPE ?= "debug" > > +# For cargo.bbclass > +BUILD_MODE ?= "" > +BUILD_DIR ?= "debug" > + > # Allow other layers to add their own debug build configurations > include_all conf/include/debug_build.inc > -- > 2.34.1 //Peter
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.inc b/meta/conf/distro/include/debug_build.inc index e446a71dd3f..e6f94504945 100644 --- a/meta/conf/distro/include/debug_build.inc +++ b/meta/conf/distro/include/debug_build.inc @@ -51,5 +51,9 @@ INHIBIT_SYSROOT_STRIP:class-native ?= "1" # For meson.bbclass MESON_BUILDTYPE ?= "debug" +# For cargo.bbclass +BUILD_MODE ?= "" +BUILD_DIR ?= "debug" + # Allow other layers to add their own debug build configurations include_all conf/include/debug_build.inc
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> --- meta/classes-recipe/cargo.bbclass | 4 ++-- meta/conf/distro/include/debug_build.inc | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-)