pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

powwow: Fix build.



Module Name:	pkgsrc-wip
Committed By:	nikita <nikita%NetBSD.org@localhost>
Pushed By:	nikita
Date:		Thu May 19 18:13:46 2022 +0200
Changeset:	725d1fdbacf73fd5d23eb4686b30669ebb10b903

Modified Files:
	powwow/Makefile
	powwow/TODO
	powwow/distinfo
Added Files:
	powwow/patches/patch-src_follow.c
	powwow/patches/patch-src_main.c
	powwow/patches/patch-src_ptr.c
	powwow/patches/patch-src_ptr.h
	powwow/patches/patch-src_tcp.c
	powwow/patches/patch-src_tty.c
Removed Files:
	powwow/patches/patch-main_c
	powwow/patches/patch-ptr_c
	powwow/patches/patch-ptr_h
	powwow/patches/patch-tcp_c
	powwow/patches/patch-tty_c

Log Message:
powwow: Fix build.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=725d1fdbacf73fd5d23eb4686b30669ebb10b903

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 powwow/Makefile                   |  1 +
 powwow/TODO                       | 34 ++++++++-------
 powwow/distinfo                   | 11 ++---
 powwow/patches/patch-main_c       | 15 -------
 powwow/patches/patch-ptr_c        | 19 ---------
 powwow/patches/patch-ptr_h        | 19 ---------
 powwow/patches/patch-src_follow.c | 12 ++++++
 powwow/patches/patch-src_main.c   | 15 +++++++
 powwow/patches/patch-src_ptr.c    | 19 +++++++++
 powwow/patches/patch-src_ptr.h    | 19 +++++++++
 powwow/patches/patch-src_tcp.c    | 23 ++++++++++
 powwow/patches/patch-src_tty.c    | 90 +++++++++++++++++++++++++++++++++++++++
 powwow/patches/patch-tcp_c        | 23 ----------
 powwow/patches/patch-tty_c        | 82 -----------------------------------
 14 files changed, 203 insertions(+), 179 deletions(-)

diffs:
diff --git a/powwow/Makefile b/powwow/Makefile
index 95021a2631..88b2c346af 100644
--- a/powwow/Makefile
+++ b/powwow/Makefile
@@ -8,6 +8,7 @@ MAINTAINER=	nikita%NetBSD.org@localhost
 HOMEPAGE=	http://hoopajoo.net/projects/powwow.html
 COMMENT=	Client to play MUDs
 LICENSE=	gnu-gpl-v2
+USE_TOOLS+=	gmake
 
 GNU_CONFIGURE=		yes
 CONFIGURE_ARGS+=	--enable-bsd
diff --git a/powwow/TODO b/powwow/TODO
index 5c87942a2f..50e96e6fe3 100644
--- a/powwow/TODO
+++ b/powwow/TODO
@@ -1,18 +1,20 @@
-* Correctly patch alloca() usage. Upstream has been contacted for
-  resolution.
+gcc -DPACKAGE_NAME=\"powwow\" -DPACKAGE_TARNAME=\"powwow\" -DPACKAGE_VERSION=\"1.2.23\" -DPACKAGE_STRING=\"powwow\ 1.2.23\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"powwow\" -D
+VERSION=\"1.2.23\" -DUSE_SGTTY=1 -DBSD_LIKE=1 -DHAVE_LIBDL=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1
+ -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STDLIB_H=1 -DHAVE_UNISTD_H=1 -DUSE_LOCALE=1 -DUSE_REGEXP=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -I.  -D_XOPEN_SOURCE=700 -DPOWWOW_
+DIR=\"/usr/pkg/share/powwow\" -DPLUGIN_DIR=\"/usr/pkg/lib/powwow\" -I/usr/include  -O2 -fPIC -D_FORTIFY_SOURCE=2 -I/usr/include -MT ptr.o -MD -MP -MF .deps/ptr.Tpo -c -o ptr.o ptr.c          tty.c: In function 'tty_printf':
+tty.c:861:11: warning: implicit declaration of function 'vasprintf'; did you mean 'vsprintf'? [-Wimplicit-function-declaration]
+  861 |     res = vasprintf(&bufp, format, va); 
+      |           ^~~~~~~~~                                                                    
+      |           vsprintf             
+ptr.c: In function 'ptrrchr':                                                                  
+ptr.c:442:9: warning: implicit declaration of function 'memrchr'; did you mean 'memrchrx'? [-Wimplicit-function-declaration]
+  442 |  return memrchr(ptrdata(p), ptrlen(p), c);                        
+      |         ^~~~~~~   
+      |         memrchrx                                                                       
+ptr.c:442:9: warning: returning 'int' from a function with return type 'char *' makes pointer from integer without a cast [-Wint-conversion]
+  442 |  return memrchr(ptrdata(p), ptrlen(p), c);
+      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                    
 
-* this:
-tty.c: In function 'tty_start':
-tty.c:64:18: error: 'ECHO' undeclared (first use in this function); did you mean 'O_ECHO'?
- #  define O_ECHO ECHO
-                  ^
-tty.c:184:49: note: in expansion of macro 'O_ECHO'
-     ttyb.sg_flags = (ttyb.sg_flags|O_CBREAK) & ~O_ECHO;
-                                                 ^~~~~~
-tty.c:64:18: note: each undeclared identifier is reported only once for each function it appears in
- #  define O_ECHO ECHO
-									                  ^
-tty.c:184:49: note: in expansion of macro 'O_ECHO'
-     ttyb.sg_flags = (ttyb.sg_flags|O_CBREAK) & ~O_ECHO;
-                                                 ^~~~~~
 
+* Correctly patch alloca() usage. Upstream has been contacted for
+  resolution.
diff --git a/powwow/distinfo b/powwow/distinfo
index 359e4e6673..af921eebcb 100644
--- a/powwow/distinfo
+++ b/powwow/distinfo
@@ -3,8 +3,9 @@ $NetBSD: distinfo,v 1.10 2015/11/03 20:57:01 agc Exp $
 BLAKE2s (powwow-1.2.23.tar.gz) = 36739c34b24752e5efb7ccf7e0f3b8b9fc4153a3d2973714a98423699f2feff9
 SHA512 (powwow-1.2.23.tar.gz) = 591ff9ca9dfc3bb624cfbb7f47785af977250cf9f6858b5149cf0fa30c6e1173f03f0cbabb8a55eb6ceb7622509f6c3fb11c36b154edc243824ecb8513c110a4
 Size (powwow-1.2.23.tar.gz) = 338893 bytes
-SHA1 (patch-main_c) = bd3cd4355e0be5f1f8b9aabd61e9a870c9e20deb
-SHA1 (patch-ptr_c) = 2ad9764c3a3925960b511247cec5ce0a1394d9c8
-SHA1 (patch-ptr_h) = 0ba84e818b6ecb56d96db4ee0ad9db5581898eb8
-SHA1 (patch-tcp_c) = ffd6a7cc1f38887f662639b4c5d2e6d1680434d2
-SHA1 (patch-tty_c) = 84393c6050992c409d301622b720e9b68d08a811
+SHA1 (patch-src_follow.c) = 3d22887b1b44bb79802765026c42986bdf273409
+SHA1 (patch-src_main.c) = bd3cd4355e0be5f1f8b9aabd61e9a870c9e20deb
+SHA1 (patch-src_ptr.c) = 2ad9764c3a3925960b511247cec5ce0a1394d9c8
+SHA1 (patch-src_ptr.h) = 0ba84e818b6ecb56d96db4ee0ad9db5581898eb8
+SHA1 (patch-src_tcp.c) = ffd6a7cc1f38887f662639b4c5d2e6d1680434d2
+SHA1 (patch-src_tty.c) = 222543d29b10cc7d94943fc33aa51fa524f3a8d1
diff --git a/powwow/patches/patch-main_c b/powwow/patches/patch-main_c
deleted file mode 100644
index 56fdf8273a..0000000000
--- a/powwow/patches/patch-main_c
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD$
-
-main.c: Remove unnecessary variable declaration of errno.
-
-diff -r c8b10f57c096 -r aaf73ded1091 main.c
---- src/main.c~	Fri Jun 21 10:26:10 2019 +0000
-+++ src/main.c	Fri Jun 21 10:29:07 2019 +0000
-@@ -72,7 +72,6 @@
- #endif
- 
- /* are these really needed? */
--extern int errno;
- extern int select();
- 
- #include "defines.h"
diff --git a/powwow/patches/patch-ptr_c b/powwow/patches/patch-ptr_c
deleted file mode 100644
index e8ddab4b03..0000000000
--- a/powwow/patches/patch-ptr_c
+++ /dev/null
@@ -1,19 +0,0 @@
-$NetBSD$
-
-Avoid conflict with libc memrchr. Appears to have the same intent,
-but this is the path of least resistance.
-
-Authored by dholland@ in revision 1.1 2011/10/03
-
-diff -r d8cbf1749395 -r c8b10f57c096 ptr.c
---- src/ptr.c~	Fri Jun 21 10:22:03 2019 +0000
-+++ src/ptr.c	Fri Jun 21 10:26:10 2019 +0000
-@@ -419,7 +419,7 @@
-  * find last occurrence of c in p
-  * return NULL if none found.
-  */
--char *memrchr(char *p, int lenp, char c)
-+char *memrchrx(char *p, int lenp, char c)
- {
-     char *v, *s = p;
- 
diff --git a/powwow/patches/patch-ptr_h b/powwow/patches/patch-ptr_h
deleted file mode 100644
index 128ab917e1..0000000000
--- a/powwow/patches/patch-ptr_h
+++ /dev/null
@@ -1,19 +0,0 @@
-$NetBSD$
-
-Avoid conflict with libc memrchr. Appears to have the same intent,
-but this is the path of least resistance.
-
-Authored by dholland@ on 2011/10/03 in patch revision 1.1
-
-diff -r bbd2f93df3a0 -r d8cbf1749395 ptr.h
---- src/ptr.h~	Fri Jun 21 10:19:28 2019 +0000
-+++ src/ptr.h	Fri Jun 21 10:22:03 2019 +0000
-@@ -69,7 +69,7 @@
- /* TODO: watch memrchr, it is defined differently here than under _GNU_SOURCE,
-  * so it could cause bizarre results if a module makes use of a library that
-  * uses it */
--char *memrchr(char *p, int lenp, char c);
-+char *memrchrx(char *p, int lenp, char c);
- #endif
- 
- #endif /* _PTR_H_ */
diff --git a/powwow/patches/patch-src_follow.c b/powwow/patches/patch-src_follow.c
new file mode 100644
index 0000000000..813af06266
--- /dev/null
+++ b/powwow/patches/patch-src_follow.c
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- src/follow.c.orig	2022-05-19 18:04:39.773135287 +0200
++++ src/follow.c	2022-05-19 18:05:38.948865876 +0200
+@@ -43,6 +43,7 @@
+ 
+ #ifdef BSD_LIKE
+ # include <sys/ioctl_compat.h>
++# include <sys/termios.h>
+ # define O_RAW RAW
+ # define O_ECHO ECHO
+ # define O_CBREAK CBREAK
diff --git a/powwow/patches/patch-src_main.c b/powwow/patches/patch-src_main.c
new file mode 100644
index 0000000000..56fdf8273a
--- /dev/null
+++ b/powwow/patches/patch-src_main.c
@@ -0,0 +1,15 @@
+$NetBSD$
+
+main.c: Remove unnecessary variable declaration of errno.
+
+diff -r c8b10f57c096 -r aaf73ded1091 main.c
+--- src/main.c~	Fri Jun 21 10:26:10 2019 +0000
++++ src/main.c	Fri Jun 21 10:29:07 2019 +0000
+@@ -72,7 +72,6 @@
+ #endif
+ 
+ /* are these really needed? */
+-extern int errno;
+ extern int select();
+ 
+ #include "defines.h"
diff --git a/powwow/patches/patch-src_ptr.c b/powwow/patches/patch-src_ptr.c
new file mode 100644
index 0000000000..e8ddab4b03
--- /dev/null
+++ b/powwow/patches/patch-src_ptr.c
@@ -0,0 +1,19 @@
+$NetBSD$
+
+Avoid conflict with libc memrchr. Appears to have the same intent,
+but this is the path of least resistance.
+
+Authored by dholland@ in revision 1.1 2011/10/03
+
+diff -r d8cbf1749395 -r c8b10f57c096 ptr.c
+--- src/ptr.c~	Fri Jun 21 10:22:03 2019 +0000
++++ src/ptr.c	Fri Jun 21 10:26:10 2019 +0000
+@@ -419,7 +419,7 @@
+  * find last occurrence of c in p
+  * return NULL if none found.
+  */
+-char *memrchr(char *p, int lenp, char c)
++char *memrchrx(char *p, int lenp, char c)
+ {
+     char *v, *s = p;
+ 
diff --git a/powwow/patches/patch-src_ptr.h b/powwow/patches/patch-src_ptr.h
new file mode 100644
index 0000000000..128ab917e1
--- /dev/null
+++ b/powwow/patches/patch-src_ptr.h
@@ -0,0 +1,19 @@
+$NetBSD$
+
+Avoid conflict with libc memrchr. Appears to have the same intent,
+but this is the path of least resistance.
+
+Authored by dholland@ on 2011/10/03 in patch revision 1.1
+
+diff -r bbd2f93df3a0 -r d8cbf1749395 ptr.h
+--- src/ptr.h~	Fri Jun 21 10:19:28 2019 +0000
++++ src/ptr.h	Fri Jun 21 10:22:03 2019 +0000
+@@ -69,7 +69,7 @@
+ /* TODO: watch memrchr, it is defined differently here than under _GNU_SOURCE,
+  * so it could cause bizarre results if a module makes use of a library that
+  * uses it */
+-char *memrchr(char *p, int lenp, char c);
++char *memrchrx(char *p, int lenp, char c);
+ #endif
+ 
+ #endif /* _PTR_H_ */
diff --git a/powwow/patches/patch-src_tcp.c b/powwow/patches/patch-src_tcp.c
new file mode 100644
index 0000000000..ffa35f9e0a
--- /dev/null
+++ b/powwow/patches/patch-src_tcp.c
@@ -0,0 +1,23 @@
+$NetBSD$
+
+AI_V4MAPPED may not be defined on some platforms.
+Define to 0 in such cases, so the flag won't be affected.
+
+diff -r aaf73ded1091 -r 15ce679827e8 tcp.c
+--- src/tcp.c~	Fri Jun 21 10:29:07 2019 +0000
++++ src/tcp.c	Fri Jun 21 11:18:15 2019 +0000
+@@ -49,6 +49,14 @@
+ # define TELOPTSTR(n) ((n) > NTELOPTS ? "unknown" : telopts[n])
+ #endif
+ 
++/*
++ * some platforms do not have AI_V4MAPPED, define to 0
++ * so bitwise OR won't be changed
++ */
++#ifndef AI_V4MAPPED
++# define AI_V4MAPPED 0
++#endif
++
+ int tcp_fd = -1;                   /* current socket file descriptor
+ 				    * -1 means no socket */
+ int tcp_main_fd = -1;		   /* socket file descriptor of main connect.
diff --git a/powwow/patches/patch-src_tty.c b/powwow/patches/patch-src_tty.c
new file mode 100644
index 0000000000..52153def98
--- /dev/null
+++ b/powwow/patches/patch-src_tty.c
@@ -0,0 +1,90 @@
+$NetBSD$
+
+Adapt patch from FreeBSD ports patch-src_tty.c
+
+--- src/tty.c.orig	2019-11-06 06:25:17.000000000 +0100
++++ src/tty.c	2022-05-19 18:00:08.513525079 +0200
+@@ -9,7 +9,6 @@
+  *  (at your option) any later version.
+  *
+  */
+-#include <alloca.h>
+ #include <assert.h>
+ #include <errno.h>
+ #include <fcntl.h>
+@@ -61,6 +60,7 @@
+ 
+ #ifdef BSD_LIKE
+ #  include <sys/ioctl_compat.h>
++#  include <sys/termios.h>
+ #  define O_RAW RAW
+ #  define O_ECHO ECHO
+ #  define O_CBREAK CBREAK
+@@ -847,31 +847,29 @@
+ 
+ int tty_printf(const char *format, ...)
+ {
+-    char buf[1024], *bufp = buf;
++    char *bufp;
++    char *old_locale;
+     va_list va;
+     int res;
+ 
+-    char *old_locale = strdup(setlocale(LC_ALL, NULL));
++    if ((old_locale = strdup(setlocale(LC_ALL, NULL))) == NULL)
++           return -1;
+ 
+     setlocale(LC_ALL, "C");
+ 
+     va_start(va, format);
+-    res = vsnprintf(buf, sizeof buf, format, va);
++    res = vasprintf(&bufp, format, va);
+     va_end(va);
+ 
+-    if (res >= sizeof buf) {
+-	bufp = alloca(res + 1);
+-	va_start(va, format);
+-	vsprintf(bufp, format, va);
+-        assert(strlen(bufp) == res);
+-	va_end(va);
+-    }
++    if (res < 0)
++           goto out;
+ 
+     setlocale(LC_ALL, old_locale);
+-    free(old_locale);
+ 
+     tty_puts(bufp);
+-
++    free(bufp);
++out:
++    free(old_locale);
+     return res;
+ }
+ 
+@@ -968,16 +966,23 @@
+ 
+ void tty_gets(char *s, int size)
+ {
+-    wchar_t *ws = alloca(size * sizeof *ws);
++    wchar_t *ws = NULL;
++
++    if ((ws = malloc(size * sizeof *ws)) == NULL)
++           goto out;
+ 
+     if (!fgetws(ws, size, stdin))
+-	return;
++	   goto out;
+ 
+     while (*ws) {
+ 	if (!(*ws & ~0xff))
+ 	    *s++ = (unsigned char)*ws;
+ 	++ws;
+     }
++out:
++    if (ws != NULL)
++           free(ws);
++    return;
+ }
+ 
+ void tty_flush(void)
diff --git a/powwow/patches/patch-tcp_c b/powwow/patches/patch-tcp_c
deleted file mode 100644
index ffa35f9e0a..0000000000
--- a/powwow/patches/patch-tcp_c
+++ /dev/null
@@ -1,23 +0,0 @@
-$NetBSD$
-
-AI_V4MAPPED may not be defined on some platforms.
-Define to 0 in such cases, so the flag won't be affected.
-
-diff -r aaf73ded1091 -r 15ce679827e8 tcp.c
---- src/tcp.c~	Fri Jun 21 10:29:07 2019 +0000
-+++ src/tcp.c	Fri Jun 21 11:18:15 2019 +0000
-@@ -49,6 +49,14 @@
- # define TELOPTSTR(n) ((n) > NTELOPTS ? "unknown" : telopts[n])
- #endif
- 
-+/*
-+ * some platforms do not have AI_V4MAPPED, define to 0
-+ * so bitwise OR won't be changed
-+ */
-+#ifndef AI_V4MAPPED
-+# define AI_V4MAPPED 0
-+#endif
-+
- int tcp_fd = -1;                   /* current socket file descriptor
- 				    * -1 means no socket */
- int tcp_main_fd = -1;		   /* socket file descriptor of main connect.
diff --git a/powwow/patches/patch-tty_c b/powwow/patches/patch-tty_c
deleted file mode 100644
index 8d9f3ec2cb..0000000000
--- a/powwow/patches/patch-tty_c
+++ /dev/null
@@ -1,82 +0,0 @@
-$NetBSD$
-
-Adapt patch from FreeBSD ports patch-src_tty.c
-
---- src/tty.c.orig	2019-11-06 06:25:17.000000000 +0100
-+++ src/tty.c	2022-05-19 16:26:22.465610588 +0200
-@@ -9,7 +9,6 @@
-  *  (at your option) any later version.
-  *
-  */
--#include <alloca.h>
- #include <assert.h>
- #include <errno.h>
- #include <fcntl.h>
-@@ -847,31 +846,29 @@
- 
- int tty_printf(const char *format, ...)
- {
--    char buf[1024], *bufp = buf;
-+    char *bufp;
-+    char *old_locale;
-     va_list va;
-     int res;
- 
--    char *old_locale = strdup(setlocale(LC_ALL, NULL));
-+    if ((old_locale = strdup(setlocale(LC_ALL, NULL))) == NULL)
-+           return -1;
- 
-     setlocale(LC_ALL, "C");
- 
-     va_start(va, format);
--    res = vsnprintf(buf, sizeof buf, format, va);
-+    res = vasprintf(&bufp, format, va);
-     va_end(va);
- 
--    if (res >= sizeof buf) {
--	bufp = alloca(res + 1);
--	va_start(va, format);
--	vsprintf(bufp, format, va);
--        assert(strlen(bufp) == res);
--	va_end(va);
--    }
-+    if (res < 0)
-+           goto out;
- 
-     setlocale(LC_ALL, old_locale);
--    free(old_locale);
- 
-     tty_puts(bufp);
--
-+    free(bufp);
-+out:
-+    free(old_locale);
-     return res;
- }
- 
-@@ -968,16 +965,23 @@
- 
- void tty_gets(char *s, int size)
- {
--    wchar_t *ws = alloca(size * sizeof *ws);
-+    wchar_t *ws = NULL;
-+
-+    if ((ws = malloc(size * sizeof *ws)) == NULL)
-+           goto out;
- 
-     if (!fgetws(ws, size, stdin))
--	return;
-+	   goto out;
- 
-     while (*ws) {
- 	if (!(*ws & ~0xff))
- 	    *s++ = (unsigned char)*ws;
- 	++ws;
-     }
-+out:
-+    if (ws != NULL)
-+           free(ws);
-+    return;
- }
- 
- void tty_flush(void)


Home | Main Index | Thread Index | Old Index