commit:     ed192a5ae0261aa59a25677fa29bce0f29fe5bcf
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 14 11:49:00 2022 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Fri Oct 14 11:56:25 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ed192a5a

games-arcade/netris: fix build w/ upcoming clang16 + pass std=gnu89

Tests silently failed (errors to /dev/null, and no confirmation),
then it silently skip including the header it didn't find.

(just a quick fix, this could use cleanups, better patches, and no sed)

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

 .../netris/files/netris-0.52-clang16.patch         | 31 ++++++++++++++++++++++
 ...netris-0.52-r3.ebuild => netris-0.52-r4.ebuild} |  9 +++++--
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/games-arcade/netris/files/netris-0.52-clang16.patch 
b/games-arcade/netris/files/netris-0.52-clang16.patch
new file mode 100644
index 000000000000..7d13d02975bf
--- /dev/null
+++ b/games-arcade/netris/files/netris-0.52-clang16.patch
@@ -0,0 +1,31 @@
+https://bugs.gentoo.org/874021
+--- a/Configure
++++ b/Configure
+@@ -78,3 +78,3 @@
+ echo "Checking for libraries"
+-echo 'main(){}' > test.c
++echo 'int main(void){return 0;}' > test.c
+ LFLAGS=""
+@@ -96,4 +96,5 @@
+ cat << END > test.c
+-void handler(void) {}
+-main() { on_exit(handler, (void *)0); }
++#include <stdlib.h>
++void handler(int a, void *b) {}
++int main(void) { on_exit(handler, (void *)0); return 0; }
+ END
+@@ -108,3 +109,3 @@
+ #include <signal.h>
+-main() { sigset_t set; sigprocmask(SIG_BLOCK, &set, &set); }
++int main(void) { sigset_t set; sigprocmask(SIG_BLOCK, &set, &set); return 0; }
+ END
+@@ -119,3 +120,3 @@
+ #include <getopt.h>
+-main(){}
++int main(void){return 0;}
+ END
+@@ -131,3 +132,3 @@
+ #include <memory.h>
+-main(){}
++int main(void){return 0;}
+ END

diff --git a/games-arcade/netris/netris-0.52-r3.ebuild 
b/games-arcade/netris/netris-0.52-r4.ebuild
similarity index 81%
rename from games-arcade/netris/netris-0.52-r3.ebuild
rename to games-arcade/netris/netris-0.52-r4.ebuild
index 54f80a22be4d..6f5c8b733523 100644
--- a/games-arcade/netris/netris-0.52-r3.ebuild
+++ b/games-arcade/netris/netris-0.52-r4.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
 
-inherit toolchain-funcs
+inherit flag-o-matic toolchain-funcs
 
 DEB_VER="10"
 DESCRIPTION="Classic networked version of T*tris"
@@ -26,6 +26,7 @@ src_prepare() {
 
        eapply "${S}"/../debian/patches/[01]*
        eapply "${FILESDIR}"/${P}-tinfo.patch
+       eapply "${FILESDIR}"/${P}-clang16.patch
 
        # bug #185332
        sed -i \
@@ -53,6 +54,10 @@ src_prepare() {
 }
 
 src_configure() {
+       append-cflags -std=gnu89 # old codebase, incompatible with c2x
+       append-cppflags -D_DEFAULT_SOURCE #874021, for on_exit()
+       append-cflags ${CPPFLAGS}
+
        bash ./Configure -O || die
 }
 

Reply via email to