diff mbox series

[v2,9/9] debug_build: defer inherit bblcass debug_build when DEBUG_BUILD is true

Message ID 20250922065431.3782711-1-hongxu.jia@windriver.com
State New
Headers show
Series None | expand

Commit Message

Hongxu Jia Sept. 22, 2025, 6:54 a.m. UTC
While setting DEBUG_BUILD = "1" in local.conf, the debug build is
enabled globally. For the recipe (such as qemu) which doesn't work
without optimization, we have to set DEBUG_BUILD = "0" in the recipe.
In this situation, conf/distro/include/debug_build.inc is included,
although set DEBUG_BUILD = "0" in qemu recipe, the debug build is still
enabled for qemu and break qemu build.

This commit defer inherit bblcass debug_build when DEBUG_BUILD is true,
then include_all so that debug_build.inc is only included if DEBUG_BUILD
is actually set for a given recip

Suggested-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/classes-global/base.bbclass        | 3 +++
 meta/classes-recipe/debug_build.bbclass | 8 ++++++++
 meta/conf/bitbake.conf                  | 2 --
 3 files changed, 11 insertions(+), 2 deletions(-)
 create mode 100644 meta/classes-recipe/debug_build.bbclass
diff mbox series

Patch

diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass
index 6de17d1bb5..0f4398e26f 100644
--- a/meta/classes-global/base.bbclass
+++ b/meta/classes-global/base.bbclass
@@ -35,6 +35,9 @@  TOOLCHAIN_NATIVE ??= "${PREFERRED_TOOLCHAIN_NATIVE}"
 inherit_defer toolchain/${TOOLCHAIN_NATIVE}-native
 inherit_defer toolchain/${TOOLCHAIN}
 
+DEBUG_BUILD ??= "0"
+inherit_defer ${@oe.utils.vartrue('DEBUG_BUILD', 'debug_build', '', d)}
+
 def lsb_distro_identifier(d):
     adjust = d.getVar('LSB_DISTRO_ADJUST')
     adjust_func = None
diff --git a/meta/classes-recipe/debug_build.bbclass b/meta/classes-recipe/debug_build.bbclass
new file mode 100644
index 0000000000..a917e9cbc9
--- /dev/null
+++ b/meta/classes-recipe/debug_build.bbclass
@@ -0,0 +1,8 @@ 
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+# Allow other layers to add their own debug build configurations
+include_all conf/distro/include/debug_build.inc
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index f9818d2a06..93fd57548d 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -830,8 +830,6 @@  include conf/licenses.conf
 require conf/sanity.conf
 include conf/bblock.conf
 
-# Allow other layers to add their own debug build configurations
-include_all ${@oe.utils.vartrue('DEBUG_BUILD', 'conf/distro/include/debug_build.inc', '', d)}
 
 ##################################################################
 # Weak variables (usually to retain backwards compatibility)