dash/depends/patches/zeromq/netbsd_kevent_void.patch

58 lines
2.2 KiB
Diff
Raw Normal View History

commit 129137d5182967dbfcfec66bad843df2a992a78f
Author: fanquake <fanquake@gmail.com>
Date: Mon Jan 3 20:13:33 2022 +0800
problem: kevent udata is now void* on NetBSD Current (10)
solution: check for the intptr_t variant in configure.
diff --git a/configure.ac b/configure.ac
index 1a571291..402f8b86 100644
--- a/configure.ac
+++ b/configure.ac
Merge bitcoin/bitcoin#24134: build: Fix zeromq package when cross-compiling f13e642c831c5689cb2bb7f5c4f9cb4c0c03ef21 build: Disable valgrind when building zeromq package in depends (Hennadii Stepanov) b970f03beae0f3ae6a796f0e3b97732fc579f6aa build: Disable libbsd when building zeromq package in depends (Hennadii Stepanov) 77899991b1e29a45bc377b21330148cb7cc08923 build: Update netbsd_kevent_void.patch (Hennadii Stepanov) Pull request description: Since v4.3.3 (https://github.com/zeromq/libzmq/commit/068385c951c0608edec6264d55ba9c4c923acccc) `libzmq` uses `libbsd` by default. This PR disables `libbsd` explicitly, as it's not a part of our depends. Zeromq will fallback to its internal `strlcpy` implementation. Otherwise, on systems with installed `libbsd-dev` package the `zeromq` package build system erroneously detects `libbsd` package from the host system: ```diff --- a/libzmq.pc +++ b/libzmq.pc @@ -8,5 +8,5 @@ Version: 4.3.4 Libs: -L${libdir} -lzmq Libs.private: -lpthread -Requires.private: +Requires.private: libbsd Cflags: -I${includedir} ``` This causes the `configure` fails to detect the `zeromq` package: ``` configure: WARNING: libzmq version 4.x or greater not found, disabling ``` --- Other minor improvements: - fixed `netbsd_kevent_void.patch` offset - disabled valgrind as it's used in unit tests which we do not run: ```diff --- a/zmq-configure-output +++ b/zmq-configure-output @@ -119,11 +119,6 @@ checking whether the g++ -m64 linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes checking dynamic linker characteristics... (cached) GNU/Linux ld.so checking how to hardcode library paths into programs... immediate -checking for valgrind... valgrind -checking for Valgrind tool memcheck... memcheck -checking for Valgrind tool helgrind... helgrind -checking for Valgrind tool drd... drd -checking for Valgrind tool exp-sgcheck... exp-sgcheck checking linker version script flag... --version-script checking if version scripts can use complex wildcards... yes checking for working posix_memalign... yes ``` ACKs for top commit: fanquake: ACK f13e642c831c5689cb2bb7f5c4f9cb4c0c03ef21 Tree-SHA512: d4c86d4a841eb6e7c32157e84972243072f905496c2a4c14ec6f6ab4216df6695cbf29baa2233ce27eaede35d1e250ad2f9975b16f570d01509f0c5da4597cad
2022-01-27 03:44:24 +01:00
@@ -307,6 +307,27 @@ case "${host_os}" in
if test "x$libzmq_netbsd_has_atomic" = "xno"; then
AC_DEFINE(ZMQ_FORCE_MUTEXES, 1, [Force to use mutexes])
fi
+ # NetBSD Current (to become 10) has changed the type of udata in it's
+ # kevent struct from intptr_t to void * to align with darwin and other
+ # BSDs, see upstream commit:
+ # https://github.com/NetBSD/src/commit/e5ead823eb916b56589d2c6c560dbcfe4a2d0afc
+ AC_MSG_CHECKING([whether kevent udata type is intptr_t])
+ AC_LANG_PUSH([C++])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM(
+ [[#include <sys/types.h>
+ #include <sys/event.h>
+ #include <sys/time.h>]],
+ [[struct kevent ev;
+ intptr_t udata;
+ EV_SET(&ev, 0, 0, EV_ADD, 0, 0, udata);
+ return 0;]])],
+ [libzmq_netbsd_kevent_udata_intptr_t=yes],
+ [libzmq_netbsd_kevent_udata_intptr_t=no])
+ AC_LANG_POP([C++])
+ AC_MSG_RESULT([$libzmq_netbsd_kevent_udata_intptr_t])
+ if test "x$libzmq_netbsd_kevent_udata_intptr_t" = "xyes"; then
+ AC_DEFINE(ZMQ_NETBSD_KEVENT_UDATA_INTPTR_T, 1, [kevent udata type is intptr_t])
+ fi
;;
*openbsd*|*bitrig*)
# Define on OpenBSD to enable all library features
diff --git a/src/kqueue.cpp b/src/kqueue.cpp
index 53d82ac4..a6a7a7f2 100644
--- a/src/kqueue.cpp
+++ b/src/kqueue.cpp
@@ -46,9 +46,9 @@
#include "i_poll_events.hpp"
#include "likely.hpp"
-// NetBSD defines (struct kevent).udata as intptr_t, everyone else
-// as void *.
-#if defined ZMQ_HAVE_NETBSD
+// NetBSD up to version 9 defines (struct kevent).udata as intptr_t,
+// everyone else as void *.
+#if defined ZMQ_HAVE_NETBSD && defined(ZMQ_NETBSD_KEVENT_UDATA_INTPTR_T)
#define kevent_udata_t intptr_t
#else
#define kevent_udata_t void *