commit: 474e67ae25755a712778ffd79ed7d725c84482e4
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 19 11:09:51 2023 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Apr 22 06:17:02 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=474e67ae
distutils-r1.eclass: Support IUSE=debug for DISTUTILS_EXT
Add IUSE=debug when DISTUTILS_EXT is set, and use it to control
assertions via appending -DNDEBUG or -UNDEBUG to CPPFLAGS.
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
eclass/distutils-r1.eclass | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index f56fa5a51efa..b089f2e007b1 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -60,6 +60,8 @@ esac
#
# - adds PYTHON_DEPS to DEPEND (for cross-compilation support), unless
# DISTUTILS_OPTIONAL is used
+#
+# - adds `debug` flag to IUSE that controls assertions (i.e. -DNDEBUG)
# @ECLASS_VARIABLE: DISTUTILS_OPTIONAL
# @DEFAULT_UNSET
@@ -325,6 +327,7 @@ _distutils_set_globals() {
if [[ ${DISTUTILS_EXT} ]]; then
DEPEND="${PYTHON_DEPS}"
+ IUSE="debug"
fi
fi
}
@@ -1766,6 +1769,10 @@ distutils-r1_run_phase() {
local -x AR=${AR} CC=${CC} CPP=${CPP} CXX=${CXX}
tc-export AR CC CPP CXX
+ if [[ ${DISTUTILS_EXT} ]]; then
+ local -x CPPFLAGS="${CPPFLAGS} $(usex debug '-UNDEBUG'
'-DNDEBUG')"
+ fi
+
# How to build Python modules in different worlds...
local ldopts
case "${CHOST}" in