pkg/59950: miniupnpd package fails to build

"[email protected] via gnats" <[email protected]>
Newsgroups gmane.os.netbsd.devel.pkgsrc.bugs
Message-ID <[email protected]>
>Number:         59950
>Category:       pkg
>Synopsis:       miniupnpd package fails to build
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 29 13:45:01 +0000 2026
>Originator:     nico
>Release:        pkgsrc-2025Q4
>Organization:
rintene.trade
>Environment:
SunOS briareus 5.11 joyent_20251113T010957Z i86pc i386 i86pc
>Description:
Hi. 
I was trying to compile
First of all. I've changed package version to 2.3.9.

A couple of errors while compiling miniupnpd under SunOS.
./minissdp.c:214:39: error: 'SO_REUSEPORT' undeclared (first use in this function); did you mean 'SO_REUSEADDR'?
And also SunOs does not seem to have link_ntoa.
After i've fixed this. Package was compiling, but i've got some linking problems.

>How-To-Repeat:

>Fix:
One should patch the following files -  configure, getifstats.c, getroute.c, ifacewatcher.c, ipfrdr.c, Makefile.sunos, minissdp.c

patch-configure.c
$NetBSD$

--- configure.orig      2026-01-24 18:34:17.214052685 +0000
+++ configure
@@ -448,7 +448,7 @@ case $OS_NAME in
                ;;
        SunOS)
                OS_FAMILY=BSD
-               MAKEFILE=Makefile.bsd
+               MAKEFILE=Makefile.sunos
                echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
                FW=ipf
                echo "#define LOG_PERROR 0" >> ${CONFIGFILE}

patch-minissdp.c
$NetBSD$

--- minissdp.c.orig     2025-03-09 02:16:42.067816180 +0000
+++ minissdp.c  2025-03-09 02:26:41.296533197 +0000
@@ -22,6 +22,11 @@
 #include <sys/uio.h>
 #include <net/if.h>
 #include <net/if_dl.h>
+#if defined(__sun)
+               /* solaris does not seem to have link_ntoa */
+               /* #define link_ntoa _link_ntoa */
+#define link_ntoa(x) "dummy-link_ntoa"
+#endif
 #endif

 #include "config.h"
@@ -197,10 +202,12 @@
        {
                syslog(LOG_WARNING, "setsockopt(udp, SO_REUSEADDR): %m");
        }
+#ifdef SO_REUSEPORT
        if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &on, sizeof(on)) < 0)
        {
                syslog(LOG_WARNING, "setsockopt(udp, SO_REUSEPORT): %m");
        }
+#endif /* SO_REUSEPORT */
 #ifdef IP_RECVIF
        /* BSD */
        if(!ipv6) {

patch-Makefile.sunos
$NetBSD$

--- Makefile.sunos.orig 2026-01-25 08:04:28.174762703 +0000
+++ Makefile.sunos
@@ -39,9 +39,11 @@ ARCH :sh = uname -m
 FWNAME = ipf

 # Solaris specific CFLAGS
-CFLAGS :sh += echo "-DSOLARIS2=`uname -r | cut -d. -f2`"
+#CFLAGS :sh += echo "-DSOLARIS2=`uname -r | cut -d. -f2`"
+CFLAGS += $(shell echo "-DSOLARIS2=`uname -r | cut -d. -f2`")
 # "amd64"
-CFLAGS += -m64 -mcmodel=kernel -mno-red-zone -ffreestanding
+#CFLAGS += -m64 -mcmodel=kernel -mno-red-zone -ffreestanding
+CFLAGS += -m64
 # "sparc64"
 #CFLAGS += -m64 -mcmodel=medlow
 LDFLAGS += -m64
@@ -75,7 +77,7 @@ ALLOBJS += $(IPFOBJS)

 TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o
 TESTUPNPPERMISSIONSOBJS = testupnppermissions.o upnppermissions.o
-TESTGETIFADDROBJS = testgetifaddr.o getifaddr.o
+TESTGETIFADDROBJS = testgetifaddr.o getifaddr.o getconnstatus.o
 MINIUPNPDCTLOBJS = miniupnpdctl.o
 TESTASYNCSENDTOOBJS = testasyncsendto.o asyncsendto.o upnputils.o bsd/getroute.o
 TESTPORTINUSEOBJS = testportinuse.o portinuse.o getifaddr.o

patch-getifstats.c
$NetBSD$

--- bsd/getifstats.c.orig       2026-01-25 08:09:16.214709889 +0000
+++ bsd/getifstats.c
@@ -19,7 +19,7 @@
 #endif

 #include "../getifstats.h"
-#include "config.h"
+#include "../config.h"

 int
 getifstats(const char *ifname, struct ifdata *data)


patch-getroute.c
$NetBSD$

--- bsd/getroute.c.orig 2026-01-25 08:09:23.746102068 +0000
+++ bsd/getroute.c
@@ -20,7 +20,7 @@
 #include <sys/param.h>
 #endif

-#include "config.h"
+#include "../config.h"
 #include "../upnputils.h"

 /* SA_SIZE() is a multiple of sizeof(long) with a minimum value of sizeof(long) */


patch-ifacewatcher.c
$NetBSD$

--- bsd/ifacewatcher.c.orig     2026-01-25 08:09:28.756806267 +0000
+++ bsd/ifacewatcher.c
@@ -16,7 +16,7 @@
 #define        SALIGN  (sizeof(long) - 1)
 #define        SA_RLEN(sa)     (SA_LEN(sa) ? ((SA_LEN(sa) + SALIGN) & ~SALIGN) : (SALIGN + 1))

-#include "config.h"
+#include "../config.h"

 #include "../upnputils.h"
 #include "../upnpglobalvars.h"


patch-ipfrdr.c
$NetBSD$

--- ipf/ipfrdr.c.orig   2026-01-25 08:12:01.426739094 +0000
+++ ipf/ipfrdr.c
@@ -59,7 +59,7 @@ struct file;
 #include <string.h>
 #include <unistd.h>

-#include "config.h"
+#include "../config.h"
 #include "netinet/ipl.h"
 #include "netinet/ip_compat.h"
 #include "netinet/ip_fil.h"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.