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@gentoo.org>
This commit is contained in:
Ionen Wolkens
2022-10-14 07:49:00 -04:00
parent 0d9d5268d4
commit ed192a5ae0
2 changed files with 38 additions and 2 deletions

View File

@@ -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

View File

@@ -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
}