Skip to content

Commit 6897c4b

Browse files
committed
build: patch depends zeromq to fix building on NetBSD Current
1 parent ce6dd2f commit 6897c4b

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed

depends/packages/zeromq.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ $(package)_version=4.3.4
33
$(package)_download_path=https://github.com/zeromq/libzmq/releases/download/v$($(package)_version)/
44
$(package)_file_name=$(package)-$($(package)_version).tar.gz
55
$(package)_sha256_hash=c593001a89f5a85dd2ddf564805deb860e02471171b3f204944857336295c3e5
6-
$(package)_patches=remove_libstd_link.patch
6+
$(package)_patches=remove_libstd_link.patch netbsd_kevent_void.patch
77

88
define $(package)_set_vars
99
$(package)_config_opts=--without-docs --disable-shared --disable-curve --disable-curve-keygen --disable-perf
@@ -17,10 +17,12 @@ endef
1717

1818
define $(package)_preprocess_cmds
1919
patch -p1 < $($(package)_patch_dir)/remove_libstd_link.patch && \
20+
patch -p1 < $($(package)_patch_dir)/netbsd_kevent_void.patch && \
2021
cp -f $(BASEDIR)/config.guess $(BASEDIR)/config.sub config
2122
endef
2223

2324
define $(package)_config_cmds
25+
./autogen.sh && \
2426
$($(package)_autoconf)
2527
endef
2628

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
commit 129137d5182967dbfcfec66bad843df2a992a78f
2+
Author: fanquake <[email protected]>
3+
Date: Mon Jan 3 20:13:33 2022 +0800
4+
5+
problem: kevent udata is now void* on NetBSD Current (10)
6+
7+
solution: check for the intptr_t variant in configure.
8+
9+
diff --git a/configure.ac b/configure.ac
10+
index 1a571291..402f8b86 100644
11+
--- a/configure.ac
12+
+++ b/configure.ac
13+
@@ -308,6 +308,27 @@ case "${host_os}" in
14+
if test "x$libzmq_netbsd_has_atomic" = "xno"; then
15+
AC_DEFINE(ZMQ_FORCE_MUTEXES, 1, [Force to use mutexes])
16+
fi
17+
+ # NetBSD Current (to become 10) has changed the type of udata in it's
18+
+ # kevent struct from intptr_t to void * to align with darwin and other
19+
+ # BSDs, see upstream commit:
20+
+ # https://github.com/NetBSD/src/commit/e5ead823eb916b56589d2c6c560dbcfe4a2d0afc
21+
+ AC_MSG_CHECKING([whether kevent udata type is intptr_t])
22+
+ AC_LANG_PUSH([C++])
23+
+ AC_LINK_IFELSE([AC_LANG_PROGRAM(
24+
+ [[#include <sys/types.h>
25+
+ #include <sys/event.h>
26+
+ #include <sys/time.h>]],
27+
+ [[struct kevent ev;
28+
+ intptr_t udata;
29+
+ EV_SET(&ev, 0, 0, EV_ADD, 0, 0, udata);
30+
+ return 0;]])],
31+
+ [libzmq_netbsd_kevent_udata_intptr_t=yes],
32+
+ [libzmq_netbsd_kevent_udata_intptr_t=no])
33+
+ AC_LANG_POP([C++])
34+
+ AC_MSG_RESULT([$libzmq_netbsd_kevent_udata_intptr_t])
35+
+ if test "x$libzmq_netbsd_kevent_udata_intptr_t" = "xyes"; then
36+
+ AC_DEFINE(ZMQ_NETBSD_KEVENT_UDATA_INTPTR_T, 1, [kevent udata type is intptr_t])
37+
+ fi
38+
;;
39+
*openbsd*|*bitrig*)
40+
# Define on OpenBSD to enable all library features
41+
diff --git a/src/kqueue.cpp b/src/kqueue.cpp
42+
index 53d82ac4..a6a7a7f2 100644
43+
--- a/src/kqueue.cpp
44+
+++ b/src/kqueue.cpp
45+
@@ -46,9 +46,9 @@
46+
#include "i_poll_events.hpp"
47+
#include "likely.hpp"
48+
49+
-// NetBSD defines (struct kevent).udata as intptr_t, everyone else
50+
-// as void *.
51+
-#if defined ZMQ_HAVE_NETBSD
52+
+// NetBSD up to version 9 defines (struct kevent).udata as intptr_t,
53+
+// everyone else as void *.
54+
+#if defined ZMQ_HAVE_NETBSD && defined(ZMQ_NETBSD_KEVENT_UDATA_INTPTR_T)
55+
#define kevent_udata_t intptr_t
56+
#else
57+
#define kevent_udata_t void *

0 commit comments

Comments
 (0)