Index | Thread | Search

From:
Christoph Liebender <christoph@liebender.dev>
Subject:
Re: net/openmdns 0.7 -> 0.8
To:
ports@openbsd.org
Date:
Tue, 25 Nov 2025 21:16:28 +0100

Download raw body.

Thread
On 11/24/25 22:18, Stuart Henderson wrote:
> 
> The version number in the package needs to be _controlled_ by the
> SHARED_LIBS setting. Because openmdns is using bsd source make rules
> rather than autoconf/meson/etc (where ports knows how to deal with this)
> it's a bit more fiddly than usual.
> 
> The library major is available via LIBmdns_VERSION:R and the minor
> via LIBmdns_VERSION:E.
> 
> It's probably simplest to use these and replace shlib_version with
> printf rather than patching.
> 

ok, I did that - though I am confused - /usr/share/mk/bsd.lib.mk says:

.if exists(${.CURDIR}/shlib_version)
.include "${.CURDIR}/shlib_version"
.if defined(LIB) && defined(LIB${LIB}_VERSION)
SHLIB_MAJOR=${LIB${LIB}_VERSION:R}
SHLIB_MINOR=${LIB${LIB}_VERSION:E}
.else
SHLIB_MAJOR=${major}
SHLIB_MINOR=${minor}
.endif
.endif

shlib_version exists, and LIB and LIBmdns_VERSION is defined. Though the 
library is built with soversion 0.1. Is LIBmdns_VERSION not propagated 
downwards?

> 
> btw you can do "git config diff.renames no" to set the default for
> a checkout so you don't need to remember --no-renames when you run
> git diff
> 

Thanks!!! Applied for my ports tree :)
diff --git a/net/openmdns/Makefile b/net/openmdns/Makefile
index 8f519886c76..6fa7fddc5a1 100644
--- a/net/openmdns/Makefile
+++ b/net/openmdns/Makefile
@@ -1,26 +1,34 @@
 COMMENT =		MDNS/DNS-SD daemon
 
-DISTNAME =		openmdns-0.7
+V =			0.8
+DISTNAME =		openmdns-$V
+
+SHARED_LIBS +=		mdns 0.0 # 0.1
+
 CATEGORIES =		net
-REVISION =		3
 
 MAINTAINER =		Gonzalo L. R. <gonzalo@openbsd.org>
 
-HOMEPAGE =		http://www.haesbaert.org/openmdns/
+HOMEPAGE =		https://www.haesbaert.org/openmdns/
 
 # ISC
 PERMIT_PACKAGE =	Yes
 
-SITES =			http://www.haesbaert.org/openmdns/releases/ \
-			http://x61.com.ar/mirrors/openmdns/
+SITES =			https://x61.sh/mirrors/openmdns/
 
 WANTLIB +=		c event util
 
-WRKDIST =		${WRKDIR}/mdnsd
+WRKDIST =		${WRKDIR}/mdnsd-$V
 
 MAKE_FLAGS =		BINDIR="${TRUEPREFIX}/bin" \
-			MANDIR="${TRUEPREFIX}/man/man"
+			MANDIR="${TRUEPREFIX}/man/man" \
+			LIBDIR="${TRUEPREFIX}/lib"
 
 NO_TEST =		Yes
 
+pre-configure:
+	printf 'major=%d\nminor=%d' \
+		${LIBmdns_VERSION:R} ${LIBmdns_VERSION:E} \
+		> ${WRKDIST}/libmdns/shlib_version
+
 .include <bsd.port.mk>
diff --git a/net/openmdns/distinfo b/net/openmdns/distinfo
index 8be676c9b7c..e06049e2ac2 100644
--- a/net/openmdns/distinfo
+++ b/net/openmdns/distinfo
@@ -1,2 +1,2 @@
-SHA256 (openmdns-0.7.tar.gz) = 6Qmw5yOWv8XagyWPRSKqebRA9wabCbf9vqL6ZT7Mfuo=
-SIZE (openmdns-0.7.tar.gz) = 49299
+SHA256 (openmdns-0.8.tar.gz) = p+So9KUkD3pr4UPjiIRwGfWcYgqXhUWN2xtaIVMFYtA=
+SIZE (openmdns-0.8.tar.gz) = 2946543
diff --git a/net/openmdns/patches/patch-libmdns_mdnsl_c b/net/openmdns/patches/patch-libmdns_mdnsl_c
new file mode 100644
index 00000000000..78f9ca156b8
--- /dev/null
+++ b/net/openmdns/patches/patch-libmdns_mdnsl_c
@@ -0,0 +1,42 @@
+Fix imsg API usage.
+
+Index: libmdns/mdnsl.c
+--- libmdns/mdnsl.c.orig
++++ libmdns/mdnsl.c
+@@ -59,7 +59,8 @@ mdns_open(struct mdns *m)
+ 	bzero(m, sizeof(*m));
+ 	if ((sockfd = mdns_connect()) == -1)
+ 		return (-1);
+-	imsg_init(&m->ibuf, sockfd);
++	if (imsgbuf_init(&m->ibuf, sockfd) == -1)
++		return (-1);
+ 	
+ 	return (sockfd);
+ }
+@@ -67,7 +68,7 @@ mdns_open(struct mdns *m)
+ void
+ mdns_close(struct mdns *m)
+ {
+-	imsg_clear(&m->ibuf);
++	imsgbuf_clear(&m->ibuf);
+ }
+ 
+ void
+@@ -329,7 +330,7 @@ mdns_read(struct mdns *m)
+ 	struct mdns_service	ms;
+ 	char			groupname[MAXHOSTNAMELEN];
+ 
+-	n = imsg_read(&m->ibuf);
++	n = imsgbuf_read(&m->ibuf);
+ 
+ 	if (n == -1 || n == 0)
+ 		return (n);
+@@ -514,7 +515,7 @@ ibuf_send_imsg(struct imsgbuf *ibuf, u_int32_t type,
+ 
+ 	imsg_close(ibuf, wbuf);
+ 
+-	if (msgbuf_write(&ibuf->w) == -1)
++	if (imsgbuf_write(ibuf) == -1)
+ 		return (-1);
+ 
+ 	return (0);
diff --git a/net/openmdns/patches/patch-mdnsctl_Makefile b/net/openmdns/patches/patch-mdnsctl_Makefile
new file mode 100644
index 00000000000..706e74ee799
--- /dev/null
+++ b/net/openmdns/patches/patch-mdnsctl_Makefile
@@ -0,0 +1,17 @@
+Fix build by not outputting to obj directory.
+
+Index: mdnsctl/Makefile
+--- mdnsctl/Makefile.orig
++++ mdnsctl/Makefile
+@@ -12,11 +12,7 @@ CFLAGS+= -Wshadow -Wpointer-arith -Wcast-qual
+ CFLAGS+= -Wsign-compare
+ CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../mdnsd
+ 
+-.if exists(${.CURDIR}/../libmdns/${__objdir})
+-LDADD+= -L${.CURDIR}/../libmdns/${__objdir} -lmdns
+-.else
+ LDADD+= -L${.CURDIR}/../libmdns -lmdns
+-.endif
+ LDADD+= -lutil
+ DPADD+=  ${LIBUTIL}
+ 
diff --git a/net/openmdns/patches/patch-mdnsctl_mdnsl_c b/net/openmdns/patches/patch-mdnsctl_mdnsl_c
deleted file mode 100644
index 3994eca5834..00000000000
--- a/net/openmdns/patches/patch-mdnsctl_mdnsl_c
+++ /dev/null
@@ -1,40 +0,0 @@
-Index: mdnsctl/mdnsl.c
---- mdnsctl/mdnsl.c.orig
-+++ mdnsctl/mdnsl.c
-@@ -59,7 +59,8 @@ mdns_open(struct mdns *m)
- 	bzero(m, sizeof(*m));
- 	if ((sockfd = mdns_connect()) == -1)
- 		return (-1);
--	imsg_init(&m->ibuf, sockfd);
-+	if (imsgbuf_init(&m->ibuf, sockfd) == -1)
-+		return (-1);
- 	
- 	return (sockfd);
- }
-@@ -67,7 +68,7 @@ mdns_open(struct mdns *m)
- void
- mdns_close(struct mdns *m)
- {
--	imsg_clear(&m->ibuf);
-+	imsgbuf_clear(&m->ibuf);
- }
- 
- void
-@@ -329,7 +330,7 @@ mdns_read(struct mdns *m)
- 	struct mdns_service	ms;
- 	char			groupname[MAXHOSTNAMELEN];
- 
--	n = imsg_read(&m->ibuf);
-+	n = imsgbuf_read(&m->ibuf);
- 
- 	if (n == -1 || n == 0)
- 		return (n);
-@@ -514,7 +515,7 @@ ibuf_send_imsg(struct imsgbuf *ibuf, u_int32_t type,
- 
- 	imsg_close(ibuf, wbuf);
- 
--	if (msgbuf_write(&ibuf->w) == -1)
-+	if (imsgbuf_write(ibuf) == -1)
- 		return (-1);
- 
- 	return (0);
diff --git a/net/openmdns/patches/patch-mdnsd_Makefile b/net/openmdns/patches/patch-mdnsd_Makefile
new file mode 100644
index 00000000000..61e229a0290
--- /dev/null
+++ b/net/openmdns/patches/patch-mdnsd_Makefile
@@ -0,0 +1,17 @@
+Fix build by not outputting to obj directory.
+
+Index: mdnsd/Makefile
+--- mdnsd/Makefile.orig
++++ mdnsd/Makefile
+@@ -14,11 +14,7 @@ CFLAGS+= -Wmissing-declarations
+ CFLAGS+= -Wshadow -Wpointer-arith -Wcast-qual
+ CFLAGS+= -Wsign-compare
+ 
+-.if exists(${.CURDIR}/../libmdns/${__objdir})
+-LDADD+= -L${.CURDIR}/../libmdns/${__objdir} -lmdns
+-.else
+ LDADD+= -L${.CURDIR}/../libmdns -lmdns
+-.endif
+ LDADD+= -levent -lutil
+ DPADD+= ${LIBEVENT} ${LIBUTIL}
+ 
diff --git a/net/openmdns/patches/patch-mdnsd_mdnsd_c b/net/openmdns/patches/patch-mdnsd_mdnsd_c
index 33da19cbc92..f974f609abc 100644
--- a/net/openmdns/patches/patch-mdnsd_mdnsd_c
+++ b/net/openmdns/patches/patch-mdnsd_mdnsd_c
@@ -4,16 +4,16 @@ https://svnweb.freebsd.org/ports?view=revision&revision=549579
 Index: mdnsd/mdnsd.c
 --- mdnsd/mdnsd.c.orig
 +++ mdnsd/mdnsd.c
-@@ -45,6 +45,8 @@ int		mdns_sock(void);
- void		fetchmyname(char [MAXHOSTNAMELEN]);
- void		fetchhinfo(struct hinfo *);
+@@ -51,6 +51,8 @@ void			 fetchmyname(char [MAXHOSTNAMELEN]);
+ void			 fetchhinfo(struct hinfo *);
+ struct reflect_rule	*parse_reflect_rule(char *);
  
 +ctl_conns_t	ctl_conns;
 +
  struct mdnsd_conf	*conf = NULL;
  extern char		*malloc_options;
  
-@@ -361,12 +363,12 @@ void
+@@ -455,12 +457,12 @@ void
  imsg_event_add(struct imsgev *iev)
  {
  	if (iev->handler == NULL) {
diff --git a/net/openmdns/patches/patch-mdnsd_mdnsd_h b/net/openmdns/patches/patch-mdnsd_mdnsd_h
index 33a8cb46935..7a859495614 100644
--- a/net/openmdns/patches/patch-mdnsd_mdnsd_h
+++ b/net/openmdns/patches/patch-mdnsd_mdnsd_h
@@ -18,7 +18,7 @@ Index: mdnsd/mdnsd.h
  
  struct kif {
  	char			ifname[IF_NAMESIZE];
-@@ -397,7 +399,8 @@ int		 rr_send_an(struct rr *);
+@@ -425,7 +427,8 @@ int		 rr_send_an(struct rr *);
  void		 conflict_resolve_by_rr(struct rr *);
  
  /* control.c */
diff --git a/net/openmdns/pkg/PLIST b/net/openmdns/pkg/PLIST
index bb8a2e7307c..eaa62e03611 100644
--- a/net/openmdns/pkg/PLIST
+++ b/net/openmdns/pkg/PLIST
@@ -3,6 +3,9 @@
 @rcscript ${RCDIR}/mdnsd
 @bin bin/mdnsctl
 @bin bin/mdnsd
+@comment lib/libmdns.a
+@lib lib/libmdns.so.${LIBmdns_VERSION}
+@comment lib/libmdns_p.a
 @man man/man8/mdnsctl.8
 @man man/man8/mdnsd.8
 share/doc/pkg-readmes/${PKGSTEM}