pkgsrc-WIP-changes archive

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

doomlegacy: Build fix for SunOS



Module Name:	pkgsrc-wip
Committed By:	Michael Baeuerle <micha%NetBSD.org@localhost>
Pushed By:	micha
Date:		Thu Jun 18 12:31:39 2020 +0200
Changeset:	2da4a1d682888284a2bdf089aa24f4209325fbcc

Modified Files:
	doomlegacy-devel/distinfo
Added Files:
	doomlegacy-devel/patches/patch-src_i__tcp.c

Log Message:
doomlegacy: Build fix for SunOS

Use master server TCP patches for UDP too.

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

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

diffstat:
 doomlegacy-devel/distinfo                   |  1 +
 doomlegacy-devel/patches/patch-src_i__tcp.c | 56 +++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+)

diffs:
diff --git a/doomlegacy-devel/distinfo b/doomlegacy-devel/distinfo
index 067a9bb23a..49d8167ab6 100644
--- a/doomlegacy-devel/distinfo
+++ b/doomlegacy-devel/distinfo
@@ -8,6 +8,7 @@ SHA1 (patch-src_Makefile) = 40184838a23e00975a5380f18c8c53b3cc2eee47
 SHA1 (patch-src_am__map.c) = 14b3c8b70c63778ad043827ab2f0b6f4fe07bcde
 SHA1 (patch-src_doomdata.h) = 8c3186dafbf11a8a75262a06755dd9807cb58612
 SHA1 (patch-src_dstrings.c) = a654c47792800dc6547f5819ef4f5850803b2ca3
+SHA1 (patch-src_i__tcp.c) = 13c8bd14cae31b078154f4ef0d2353cf089234b8
 SHA1 (patch-src_mserv.c) = 685ca5028740428ef2579025ca8673d8da526ebe
 SHA1 (patch-src_p__local.h) = 0340c38a80ba4323e4fe7a8c314575a70a246708
 SHA1 (patch-src_p__setup.c) = 3690d253d07a772eeab87f658ebc5cb61ecc000c
diff --git a/doomlegacy-devel/patches/patch-src_i__tcp.c b/doomlegacy-devel/patches/patch-src_i__tcp.c
new file mode 100644
index 0000000000..7049caa5c1
--- /dev/null
+++ b/doomlegacy-devel/patches/patch-src_i__tcp.c
@@ -0,0 +1,56 @@
+$NetBSD: patch-src_i__tcp.c,v 1.3 2020/06/18 10:14:54 micha Exp $
+
+Use native inet_aton() on Solaris.
+Use portable fcntl() instead of ioctl() for non-blocking mode by default.
+
+--- src/i_tcp.c.orig	2020-05-10 22:05:16.000000000 +0000
++++ src/i_tcp.c
+@@ -123,7 +123,7 @@
+ 
+ #ifdef __OS2__
+   // sys/types.h is also included unconditionally by doomincl.h
+-# include <sys/types.h>
++# include <sys/types.h>  // [MB] 2020-06-18: Maybe required for old Unix too
+ # include <sys/time.h>
+ #endif // __OS2__
+ 
+@@ -146,6 +146,7 @@
+ // non-windows includes
+ #include <sys/socket.h>
+ #include <netinet/in.h>
++#include <fcntl.h>       // [MB] 2020-06-18: For fcntl()
+ #include <unistd.h>
+ #include <netdb.h>
+ #include <sys/ioctl.h>
+@@ -355,7 +356,9 @@ byte  generic_hashaddr( mysockaddr_t *a 
+ // htons: host to net byte order
+ // ntohs: net to host byte order
+ 
+-#if defined( WIN32) || defined( __OS2__) || defined( SOLARIS)
++// [MB] 2020-06-18: Use native inet_aton() on Solaris
++// Solaris has inet_aton() in libresolv since version 2.6 from 1997
++#if defined( WIN32) || defined( __OS2__) // || defined( SOLARIS)
+ // [WDJ] Also defined in mserv.c, but too small, will be inlined anyway.
+ static inline
+ int inet_aton(const char *hostname,
+@@ -1006,7 +1009,20 @@ retry_bind:
+     CONS_Printf("Network port: %d\n", my_sock_port);
+ 
+     // make it non blocking
++#ifndef LINUX
+     ioctl (s, FIONBIO, &trueval);
++#else
++    // [MB] 2020-06-18: Use portable POSIX way to enable non-blocking mode
++    // https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
++    {
++        int res = fcntl(s, F_SETFL, O_NONBLOCK);
++        if(-1 == res)
++        {
++            I_SoftError("UDP_Socket: Switching to non-blocking mode failed: %s\n", strerror(errno));
++            goto close_socket;
++        }
++    }
++#endif
+ 
+     // make it broadcastable
+ #ifdef LINUX


Home | Main Index | Thread Index | Old Index