public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-games/libnw/, dev-games/libnw/files/
@ 2025-02-10  9:14 Sam James
  0 siblings, 0 replies; only message in thread
From: Sam James @ 2025-02-10  9:14 UTC (permalink / raw
  To: gentoo-commits

commit:     81bf071611c64d183b3764c9318e0bd0eb394caf
Author:     NHOrus <jy6x2b32pie9 <AT> yahoo <DOT> com>
AuthorDate: Mon Jan 13 14:02:15 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Feb 10 09:08:37 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=81bf0716

dev-games/libnw: fix incompatible pointer types, port to C23

Incompatible pointers reside in autogenerated code, regenerating it
with byson fails. Hence patching both .y and .c files. Patching order
must be preserved, or make tries to regenerate them and fails.
Minimal inclusion of changes to port to C23.

Bug: https://bugs.gentoo.org/931876
Signed-off-by: NHOrus <jy6x2b32pie9 <AT> yahoo.com>
Closes: https://github.com/gentoo/gentoo/pull/40117
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-games/libnw/files/libnw-1.30.02-C23.patch | 210 ++++++++++++++++++++++++++
 dev-games/libnw/libnw-1.30.02-r2.ebuild       |  45 ++++++
 2 files changed, 255 insertions(+)

diff --git a/dev-games/libnw/files/libnw-1.30.02-C23.patch b/dev-games/libnw/files/libnw-1.30.02-C23.patch
new file mode 100644
index 000000000000..984cd10f3605
--- /dev/null
+++ b/dev-games/libnw/files/libnw-1.30.02-C23.patch
@@ -0,0 +1,210 @@
+https://bugs.gentoo.org/931876
+Fix incompatible pointer cast by pointing to hopefully correct struct
+member.
+Ordering  of {.y,.c} is important so makefile doesn't try and fail to
+regenerate autogenerated file we just edited.
+--- a/libnw/mdly.y
++++ b/libnw/mdly.y
+@@ -214,7 +214,7 @@
+ dummynodeelement
+ 	: token_parent token_string =
+ 	{
+-		cur_Node->parent = $2;
++		cur_Node->parent->name = $2;
+ 	}
+ 	| token_position xyz =
+ 	{
+@@ -247,7 +247,7 @@
+ trimeshnodeelement
+ 	: token_parent token_string =
+ 	{
+-		cur_Node->parent = $2;
++		cur_Node->parent->name = $2;
+ 	}
+ 	| token_position xyz =
+ 	{
+@@ -359,7 +359,7 @@
+ aabbnodeelement
+ 	: token_parent token_string =
+ 	{
+-		cur_Node->parent = $2;
++		cur_Node->parent->name = $2;
+ 	}
+ 	| token_ambient rgb =
+ 	{
+--- a/libnw/mdly.c
++++ b/libnw/mdly.c
+@@ -1142,7 +1142,7 @@
+ case 22:
+ #line 216 "mdly.y"
+ {
+-		cur_Node->parent = yyvsp[0].string;
++		cur_Node->parent->name = yyvsp[0].string;
+ 	}
+     break;
+ case 23:
+@@ -1167,7 +1167,7 @@
+ case 30:
+ #line 249 "mdly.y"
+ {
+-		cur_Node->parent = yyvsp[0].string;
++		cur_Node->parent->name = yyvsp[0].string;
+ 	}
+     break;
+ case 31:
+@@ -1294,7 +1294,7 @@
+ case 60:
+ #line 361 "mdly.y"
+ {
+-		cur_Node->parent = yyvsp[0].string;
++		cur_Node->parent->name = yyvsp[0].string;
+ 	}
+     break;
+ case 61:
+Minimum amount of patching to make it compile with C23:
+_POSIX_C_SOURCE for fileno and getopt
+strings for strncasecmp
+--- a/libnw/key.c
++++ b/libnw/key.c
+@@ -9,6 +9,7 @@
+ # endif
+ # include	<string.h>
+ #endif
++#include	<strings.h>
+ #include	"global.h"
+ #include	"key.h"
+ #include	"restyp.h"
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -2,4 +2,4 @@
+ 
+ EXTRA_DIST = README.tech TODO autogen.sh README.License-Torlack Doxyfile.in magic
+ 
+-AM_CFLAGS = -Wall
++AM_CFLAGS = -Wall -D_POSIX_C_SOURCE=200809L
+--- a/itpdis/Makefile.am
++++ b/itpdis/Makefile.am
+@@ -10,4 +10,4 @@
+ 
+ INCLUDES = -I$(top_srcdir)/include
+ 
+-AM_CFLAGS = -Wall
++AM_CFLAGS = -Wall -D_POSIX_C_SOURCE=200809L
+--- a/libnw/Makefile.am
++++ b/libnw/Makefile.am
+@@ -18,4 +18,4 @@
+ EXTRA_DIST = $(man_MANS) sety.h mdly.h agg_toc_load.3.in agg_toc_del.3.in \
+ 	agg_create.3.in bif_toc_load.3.in get_game_dir.3.in read_key.3.in
+ 
+-AM_CFLAGS = -Wall
++AM_CFLAGS = -Wall -D_POSIX_C_SOURCE=200809L
+--- a/nw2da2csv/Makefile.am
++++ b/nw2da2csv/Makefile.am
+@@ -10,4 +10,4 @@
+ 
+ EXTRA_DIST = $(man_MANS) nw2da2csv.1.in
+ 
+-AM_CFLAGS = -Wall
++AM_CFLAGS = -Wall -D_POSIX_C_SOURCE=200809L
+--- a/nwaggext/Makefile.am
++++ b/nwaggext/Makefile.am
+@@ -10,4 +10,4 @@
+ 
+ INCLUDES = -I$(top_srcdir)/include
+ 
+-AM_CFLAGS = -Wall
++AM_CFLAGS = -Wall -D_POSIX_C_SOURCE=200809L
+--- a/nwareamap/Makefile.am
++++ b/nwareamap/Makefile.am
+@@ -10,4 +10,4 @@
+ 
+ INCLUDES = -I$(top_srcdir)/include
+ 
+-AM_CFLAGS = -Wall
++AM_CFLAGS = -Wall -D_POSIX_C_SOURCE=200809L
+--- a/nwmrgplc/Makefile.am
++++ b/nwmrgplc/Makefile.am
+@@ -10,4 +10,4 @@
+ 
+ EXTRA_DIST = $(man_MANS) nwmrgplc.1.in
+ 
+-AM_CFLAGS = -Wall
++AM_CFLAGS = -Wall -D_POSIX_C_SOURCE=200809L
+--- a/nwresext/Makefile.am
++++ b/nwresext/Makefile.am
+@@ -10,4 +10,4 @@
+ 
+ INCLUDES = -I$(top_srcdir)/include
+ 
+-AM_CFLAGS = -Wall
++AM_CFLAGS = -Wall -D_POSIX_C_SOURCE=200809L
+--- a/nwstrref/Makefile.am
++++ b/nwstrref/Makefile.am
+@@ -10,4 +10,4 @@
+ 
+ INCLUDES = -I$(top_srcdir)/include
+ 
+-AM_CFLAGS = -Wall
++AM_CFLAGS = -Wall -D_POSIX_C_SOURCE=200809L
+--- a/nwtsfix/Makefile.am
++++ b/nwtsfix/Makefile.am
+@@ -10,4 +10,4 @@
+ 
+ EXTRA_DIST = $(man_MANS) nwtsfix.1.in
+ 
+-AM_CFLAGS = -Wall
++AM_CFLAGS = -Wall -D_POSIX_C_SOURCE=200809L
+--- a/nwtsmerge/Makefile.am
++++ b/nwtsmerge/Makefile.am
+@@ -10,4 +10,4 @@
+ 
+ EXTRA_DIST = $(man_MANS) nwtsmerge.1.in
+ 
+-AM_CFLAGS = -Wall
++AM_CFLAGS = -Wall -D_POSIX_C_SOURCE=200809L
+--- a/nwtsrefs/Makefile.am
++++ b/nwtsrefs/Makefile.am
+@@ -10,4 +10,4 @@
+ 
+ EXTRA_DIST = $(man_MANS) nwtsrefs.1.in
+ 
+-AM_CFLAGS = -Wall
++AM_CFLAGS = -Wall -D_POSIX_C_SOURCE=200809L
+--- a/plistcheck/Makefile.am
++++ b/plistcheck/Makefile.am
+@@ -6,4 +6,4 @@
+ 
+ INCLUDES = -I$(top_srcdir)/include
+ 
+-AM_CFLAGS = -Wall
++AM_CFLAGS = -Wall -D_POSIX_C_SOURCE=200809L
+--- a/itpdis/main.c
++++ b/itpdis/main.c
+@@ -12,6 +12,7 @@
+ # endif
+ # include	<string.h>
+ #endif
++#include	<strings.h>
+ #include	"global.h"
+ #include	"gamedir.h"
+ #include	"itp.h"
+--- a/nwmrgplc/main.c
++++ b/nwmrgplc/main.c
+@@ -12,6 +12,7 @@
+ # endif
+ # include	<string.h>
+ #endif
++#include        <strings.h>
+ #include	"global.h"
+ #include	"gamedir.h"
+ #include	"2da.h"
+--- a/nwtsrefs/main.c
++++ b/nwtsrefs/main.c
+@@ -12,6 +12,7 @@
+ # endif
+ # include	<string.h>
+ #endif
++#include	<strings.h>
+ #include	<ctype.h>
+ #include	"global.h"
+ #include	"gamedir.h"

diff --git a/dev-games/libnw/libnw-1.30.02-r2.ebuild b/dev-games/libnw/libnw-1.30.02-r2.ebuild
new file mode 100644
index 000000000000..5c9dc87c53c0
--- /dev/null
+++ b/dev-games/libnw/libnw-1.30.02-r2.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools flag-o-matic
+
+DESCRIPTION="Tools and libraries for NWN file manipulation"
+HOMEPAGE="https://sourceforge.net/projects/openknights/"
+SRC_URI="https://downloads.sourceforge.net/openknights/${P}.tar.gz"
+
+LICENSE="openknights"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND="!sci-biology/newick-utils"
+BDEPEND="
+	app-alternatives/yacc
+	app-alternatives/lex"
+
+DOCS=( AUTHORS ChangeLog NEWS README README.tech TODO )
+
+PATCHES=( "${FILESDIR}/${P}-C23.patch" )
+
+src_prepare() {
+	default
+	eautoreconf
+
+}
+
+src_configure() {
+	# -Werror=strict-aliasing
+	# https://bugs.gentoo.org/855314
+	#
+	# Sourceforge software dead since 2006, no point reporting anything.
+	append-flags -fno-strict-aliasing
+	filter-lto
+
+	default
+}
+
+src_install() {
+	default
+	find "${ED}" -name '*.la' -delete || die
+}


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-02-10  9:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-10  9:14 [gentoo-commits] repo/gentoo:master commit in: dev-games/libnw/, dev-games/libnw/files/ Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox