summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2023-04-19 13:09:51 +0200
committerMichał Górny <mgorny@gentoo.org>2023-04-22 08:17:02 +0200
commit474e67ae25755a712778ffd79ed7d725c84482e4 (patch)
treeee65f390fee8427f96f31f38b592ba819c07ebf0 /eclass
parentdistutils-r1.eclass: Add PYTHON_DEPS to DEPEND when DISTUTILS_EXT (diff)
downloadgentoo-474e67ae25755a712778ffd79ed7d725c84482e4.tar.gz
gentoo-474e67ae25755a712778ffd79ed7d725c84482e4.tar.bz2
gentoo-474e67ae25755a712778ffd79ed7d725c84482e4.zip
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@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/distutils-r1.eclass7
1 files changed, 7 insertions, 0 deletions
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