commit:     277aa8e05065e73499e8e24cfa9f24221348b4b3
Author:     Ryan Hill <rhill <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 23 05:19:44 2015 +0000
Commit:     Ryan Hill <rhill <AT> gentoo <DOT> org>
CommitDate: Sat Oct 24 05:14:21 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=277aa8e0

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

 eclass/wxwidgets.eclass | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/eclass/wxwidgets.eclass b/eclass/wxwidgets.eclass
index 07e2d8c..ea7cf9f 100644
--- a/eclass/wxwidgets.eclass
+++ b/eclass/wxwidgets.eclass
@@ -52,8 +52,13 @@
 #
 # Note: unless you know your package works with wxbase (which is very
 # doubtful), always depend on wxGTK[X].
+#
+# Debugging: In wxGTK 3.0 and later debugging support is enabled in the
+# library by default and needs to be controlled at the package level.
+# Use the -DNDEBUG preprocessor flag to disable debugging features.
+# (Using need-wxwidgets will do this for you, see below.)
 
-inherit eutils multilib
+inherit eutils flag-o-matic multilib
 
 # We do this in global scope so ebuilds can get sane defaults just by
 # inheriting.
@@ -80,10 +85,18 @@ fi
 # @USAGE:       <profile>
 # @DESCRIPTION:
 #
-#  Available configurations are:
+#  Available profiles are:
 #
 #    unicode       (USE="X")
 #    base-unicode  (USE="-X")
+#
+#  This lets you choose which config file from /usr/lib/wx/config is used when
+#  building the package. It also exports ${WX_CONFIG} with the full path to
+#  that config.
+#
+#  If your ebuild does not have a debug USE flag, or it has one and it is
+#  disabled, -DNDEBUG will be automatically added to CPPFLAGS. This can be
+#  overridden by setting WX_DISABLE_DEBUG if you want to handle it yourself.
 
 need-wxwidgets() {
        local wxtoolkit wxdebug wxconf
@@ -124,6 +137,10 @@ need-wxwidgets() {
                else
                        wxdebug="release-"
                fi
+       else
+               if [[ -z ${WX_DISABLE_DEBUG} ]]; then
+                       use_if_iuse debug || append-cppflags -DNDEBUG
+               fi
        fi
 
        wxconf="${wxtoolkit}-unicode-${wxdebug}${WX_GTK_VER}"

Reply via email to