Skip to content

Commit 277aa8e

Browse files
committed
wxwidgets.eclass: Define -DNDEBUG when building against wxGTK:3.0
In wxGTK 3.0 debugging support is always enabled in the library and it's up to packages to state if they want to use it or not. When enabled this makes warning dialogs pop up any time an assertion is encountered, which isn't very user friendly. This disables that behavior by adding -DNDEBUG to CPPFLAGS unless the package has a debug USE flag and it is enabled. Gentoo-Bug: https://bugs.gentoo.org/562480
1 parent 84c5c9d commit 277aa8e

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

eclass/wxwidgets.eclass

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,13 @@
5252
#
5353
# Note: unless you know your package works with wxbase (which is very
5454
# doubtful), always depend on wxGTK[X].
55+
#
56+
# Debugging: In wxGTK 3.0 and later debugging support is enabled in the
57+
# library by default and needs to be controlled at the package level.
58+
# Use the -DNDEBUG preprocessor flag to disable debugging features.
59+
# (Using need-wxwidgets will do this for you, see below.)
5560

56-
inherit eutils multilib
61+
inherit eutils flag-o-matic multilib
5762

5863
# We do this in global scope so ebuilds can get sane defaults just by
5964
# inheriting.
@@ -80,10 +85,18 @@ fi
8085
# @USAGE: <profile>
8186
# @DESCRIPTION:
8287
#
83-
# Available configurations are:
88+
# Available profiles are:
8489
#
8590
# unicode (USE="X")
8691
# base-unicode (USE="-X")
92+
#
93+
# This lets you choose which config file from /usr/lib/wx/config is used when
94+
# building the package. It also exports ${WX_CONFIG} with the full path to
95+
# that config.
96+
#
97+
# If your ebuild does not have a debug USE flag, or it has one and it is
98+
# disabled, -DNDEBUG will be automatically added to CPPFLAGS. This can be
99+
# overridden by setting WX_DISABLE_DEBUG if you want to handle it yourself.
87100

88101
need-wxwidgets() {
89102
local wxtoolkit wxdebug wxconf
@@ -124,6 +137,10 @@ need-wxwidgets() {
124137
else
125138
wxdebug="release-"
126139
fi
140+
else
141+
if [[ -z ${WX_DISABLE_DEBUG} ]]; then
142+
use_if_iuse debug || append-cppflags -DNDEBUG
143+
fi
127144
fi
128145

129146
wxconf="${wxtoolkit}-unicode-${wxdebug}${WX_GTK_VER}"

0 commit comments

Comments
 (0)