commit:     8a3473c6b639d633ba9517468e01e5a268d99b14
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 16 16:27:06 2022 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Sun Oct 16 16:59:05 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8a3473c6

games-roguelike/nethack: fix build w/ clang16, pass -std=gnu89

wrt -Wno-error, this has the same problem as net-misc/vncrec
for which there's not much that can reasonably be done about
here (and is harmless).

Closes: https://bugs.gentoo.org/874462
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 .../nethack/files/nethack-3.6.6-clang16.patch      | 10 ++++++++++
 ...ethack-3.6.6.ebuild => nethack-3.6.6-r1.ebuild} | 22 +++++++++++++++++-----
 2 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/games-roguelike/nethack/files/nethack-3.6.6-clang16.patch 
b/games-roguelike/nethack/files/nethack-3.6.6-clang16.patch
new file mode 100644
index 000000000000..b8a67644b80e
--- /dev/null
+++ b/games-roguelike/nethack/files/nethack-3.6.6-clang16.patch
@@ -0,0 +1,10 @@
+https://bugs.gentoo.org/874462
+--- a/win/tty/wintty.c
++++ b/win/tty/wintty.c
+@@ -26,2 +26,6 @@
+ 
++#ifdef DEF_PAGER
++#include <fcntl.h>
++#endif
++
+ #ifndef NO_TERMS

diff --git a/games-roguelike/nethack/nethack-3.6.6.ebuild 
b/games-roguelike/nethack/nethack-3.6.6-r1.ebuild
similarity index 88%
rename from games-roguelike/nethack/nethack-3.6.6.ebuild
rename to games-roguelike/nethack/nethack-3.6.6-r1.ebuild
index 1d26ceda38ae..7c457f11ab98 100644
--- a/games-roguelike/nethack/nethack-3.6.6.ebuild
+++ b/games-roguelike/nethack/nethack-3.6.6-r1.ebuild
@@ -8,6 +8,7 @@ inherit desktop flag-o-matic toolchain-funcs
 DESCRIPTION="The ultimate old-school single player dungeon exploration game"
 HOMEPAGE="https://www.nethack.org/";
 SRC_URI="https://nethack.org/download/${PV}/nethack-${PV//.}-src.tgz -> 
${P}.tar.gz"
+S="${WORKDIR}/NetHack-NetHack-${PV}_Released"
 
 LICENSE="nethack"
 SLOT="0"
@@ -18,6 +19,7 @@ RDEPEND="
        acct-group/gamestat
        sys-libs/ncurses:0=
        X? (
+               x11-libs/libX11
                x11-libs/libXaw
                x11-libs/libXpm
                x11-libs/libXt
@@ -36,25 +38,35 @@ BDEPEND="
        )
 "
 
-S="${WORKDIR}/NetHack-NetHack-${PV}_Released"
+PATCHES=(
+       "${FILESDIR}/${PN}-3.6.3-recover.patch"
+       "${FILESDIR}/${PN}-3.6.6-wunused-result.patch" # bug 830556
+       "${FILESDIR}/${PN}-3.6.6-clang16.patch"
+)
 
 src_prepare() {
-       eapply "${FILESDIR}/${PN}-3.6.3-recover.patch"
-       eapply "${FILESDIR}/${PN}-3.6.6-wunused-result.patch" # bug 830556
-       eapply_user
+       default
 
        cp "${FILESDIR}/${PN}-3.6.3-hint-$(usex X x11 tty)" hint || die "Failed 
to copy hint file"
        sys/unix/setup.sh hint || die "Failed to run setup.sh"
 }
 
 src_compile() {
+       append-cflags -std=gnu89 # old codebase, incompatible with c2x
        append-cflags -I../include -DDLB -DSECURE -DTIMED_DELAY -DVISION_TABLES 
-DDUMPLOG -DSCORE_ON_BOTL
        append-cflags '-DCOMPRESS=\"${EPREFIX}/bin/gzip\"' 
'-DCOMPRESS_EXTENSION=\".gz\"'
        append-cflags "-DHACKDIR=\\\"${EPREFIX}/usr/$(get_libdir)/nethack\\\"" 
"-DVAR_PLAYGROUND=\\\"${EPREFIX}/var/games/nethack\\\""
        append-cflags "-DDEF_PAGER=\\\"${PAGER}\\\""
        append-cflags -DSYSCF 
"-DSYSCF_FILE=\\\"${EPREFIX}/etc/nethack.sysconf\\\""
 
-       use X && append-cflags -DX11_GRAPHICS -DUSE_XPM
+       if use X; then
+               append-cflags -DX11_GRAPHICS -DUSE_XPM
+
+               # XtErrorHandler usage seems right, but headers "may" add 
((noreturn))
+               # giving an incompatible type error with clang-16 (could 
alternatively
+               # use private _X_NORETURN but this may be fragile)
+               append-cflags -Wno-error=incompatible-pointer-types #874462
+       fi
 
        LOCAL_MAKEOPTS=(
                CC="$(tc-getCC)" CFLAGS="${CFLAGS}" LFLAGS="${LDFLAGS}"

Reply via email to