commit:     0d65b247b839fc2574f59722d650ab04b3a5f803
Author:     NRK <nrk <AT> disroot <DOT> org>
AuthorDate: Mon Oct  2 12:18:32 2023 +0000
Commit:     Nickolas Raymond Kaczynski <nrk <AT> disroot <DOT> org>
CommitDate: Mon Oct  2 12:21:39 2023 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=0d65b247

media-gfx/nsxiv: add debug useflag

v32 changed from having assertions enabled by default to having them
disabled. explicitly passing `-DDEBUG` is now required to enable
assertions.

Signed-off-by: NRK <nrk <AT> disroot.org>

 media-gfx/nsxiv/nsxiv-32.ebuild   | 9 ++++++---
 media-gfx/nsxiv/nsxiv-9999.ebuild | 9 ++++++---
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/media-gfx/nsxiv/nsxiv-32.ebuild b/media-gfx/nsxiv/nsxiv-32.ebuild
index 21454ad79b..289eb79656 100644
--- a/media-gfx/nsxiv/nsxiv-32.ebuild
+++ b/media-gfx/nsxiv/nsxiv-32.ebuild
@@ -18,7 +18,7 @@ HOMEPAGE="https://codeberg.org/nsxiv/nsxiv";
 
 LICENSE="GPL-2+ public-domain"
 SLOT="0"
-IUSE="+statusbar +inotify exif"
+IUSE="+statusbar +inotify exif debug"
 
 RDEPEND="
        x11-libs/libX11
@@ -43,12 +43,15 @@ src_prepare() {
 }
 
 src_configure() {
+       # avoid rebuild on `make install`
        sed -i -e '/^install: / s|: all|:|' Makefile || die
-       sed -i -e 's|^CFLAGS =|CFLAGS +=|;s|-O2 ||;' config.mk || die
 }
 
 src_compile() {
-       emake CC="$(tc-getCC)" OPT_DEP_DEFAULT=0 \
+       local dbg=""
+       use debug && dbg="-UNDEBUG -DDEBUG"
+       emake CC="$(tc-getCC)" CFLAGS="${CFLAGS} ${dbg}" \
+               OPT_DEP_DEFAULT=0 \
                HAVE_INOTIFY="$(usex inotify 1 0)" \
                HAVE_LIBFONTS="$(usex statusbar 1 0)" \
                HAVE_LIBEXIF="$(usex exif 1 0)"

diff --git a/media-gfx/nsxiv/nsxiv-9999.ebuild 
b/media-gfx/nsxiv/nsxiv-9999.ebuild
index 21454ad79b..289eb79656 100644
--- a/media-gfx/nsxiv/nsxiv-9999.ebuild
+++ b/media-gfx/nsxiv/nsxiv-9999.ebuild
@@ -18,7 +18,7 @@ HOMEPAGE="https://codeberg.org/nsxiv/nsxiv";
 
 LICENSE="GPL-2+ public-domain"
 SLOT="0"
-IUSE="+statusbar +inotify exif"
+IUSE="+statusbar +inotify exif debug"
 
 RDEPEND="
        x11-libs/libX11
@@ -43,12 +43,15 @@ src_prepare() {
 }
 
 src_configure() {
+       # avoid rebuild on `make install`
        sed -i -e '/^install: / s|: all|:|' Makefile || die
-       sed -i -e 's|^CFLAGS =|CFLAGS +=|;s|-O2 ||;' config.mk || die
 }
 
 src_compile() {
-       emake CC="$(tc-getCC)" OPT_DEP_DEFAULT=0 \
+       local dbg=""
+       use debug && dbg="-UNDEBUG -DDEBUG"
+       emake CC="$(tc-getCC)" CFLAGS="${CFLAGS} ${dbg}" \
+               OPT_DEP_DEFAULT=0 \
                HAVE_INOTIFY="$(usex inotify 1 0)" \
                HAVE_LIBFONTS="$(usex statusbar 1 0)" \
                HAVE_LIBEXIF="$(usex exif 1 0)"

Reply via email to