From e5711623d42343fcccb5892480f06fb39336ed3f Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Sat, 5 Feb 2022 14:24:05 +0100 Subject: [PATCH] nethack: fix compilation with ubuntu 21.10 --- packages/nethack/build.sh | 2 +- .../host-build-fix.patch.beforehostbuild | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 packages/nethack/host-build-fix.patch.beforehostbuild diff --git a/packages/nethack/build.sh b/packages/nethack/build.sh index b649dcce4..35af6174d 100644 --- a/packages/nethack/build.sh +++ b/packages/nethack/build.sh @@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Dungeon crawl game" TERMUX_PKG_LICENSE="Nethack" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=3.6.6 -TERMUX_PKG_REVISION=5 +TERMUX_PKG_REVISION=6 TERMUX_PKG_SRCURL=http://www.nethack.org/download/${TERMUX_PKG_VERSION}/nethack-${TERMUX_PKG_VERSION//./}-src.tgz TERMUX_PKG_SHA256=cfde0c3ab6dd7c22ae82e1e5a59ab80152304eb23fb06e3129439271e5643ed2 TERMUX_PKG_DEPENDS="gzip, ncurses" diff --git a/packages/nethack/host-build-fix.patch.beforehostbuild b/packages/nethack/host-build-fix.patch.beforehostbuild new file mode 100644 index 000000000..d019a4b6b --- /dev/null +++ b/packages/nethack/host-build-fix.patch.beforehostbuild @@ -0,0 +1,35 @@ +commit 1cb5dc04605daa45f1c6a647c17442ed7ff2fe4e +Author: nhmall +Date: Tue Jan 4 08:24:08 2022 -0500 + + work around ubuntu 20.10 build issue + + NetHack was trying to suppress warn_unused_result + in include/tradstdc.h, by defining warn_unused_result + to an empty string. That began causing a build error + in a system-supplied header file cdefs.h + when using 20.10 ubuntu impish. + + Try skipping that in tradstdc.h for any linux, unless + the NetHack build defines GCC_URWARN to force it into + play. + +diff --git a/include/tradstdc.h b/include/tradstdc.h +index 09decb4b15ee..8c33d55e0ae9 100644 +--- a/include/tradstdc.h ++++ b/include/tradstdc.h +@@ -405,12 +405,14 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */ + #if __GNUC__ >= 3 + #define UNUSED __attribute__((unused)) + #define NORETURN __attribute__((noreturn)) ++#if !defined(__linux__) || defined(GCC_URWARN) + /* disable gcc's __attribute__((__warn_unused_result__)) since explicitly + discarding the result by casting to (void) is not accepted as a 'use' */ + #define __warn_unused_result__ /*empty*/ + #define warn_unused_result /*empty*/ + #endif + #endif ++#endif + + #ifndef PRINTF_F + #define PRINTF_F(f, v)