Skip to content

Commit 3dd5c1c

Browse files
committed
merge bitcoin#31500: Fix compiling libevent package on NetBSD
1 parent be4e492 commit 3dd5c1c

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

depends/packages/libevent.mk

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ $(package)_download_path=https://github.com/libevent/libevent/releases/download/
44
$(package)_file_name=$(package)-$($(package)_version).tar.gz
55
$(package)_sha256_hash=92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb
66
$(package)_patches=cmake_fixups.patch
7-
$(package)_patches+=fix_mingw_link.patch
7+
$(package)_patches += fix_mingw_link.patch
8+
$(package)_patches += netbsd_fixup.patch
89
$(package)_build_subdir=build
910

1011
# When building for Windows, we set _WIN32_WINNT to target the same Windows
@@ -25,7 +26,8 @@ endef
2526

2627
define $(package)_preprocess_cmds
2728
patch -p1 < $($(package)_patch_dir)/cmake_fixups.patch && \
28-
patch -p1 < $($(package)_patch_dir)/fix_mingw_link.patch
29+
patch -p1 < $($(package)_patch_dir)/fix_mingw_link.patch && \
30+
patch -p1 < $($(package)_patch_dir)/netbsd_fixup.patch
2931
endef
3032

3133
define $(package)_config_cmds
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Improve portability on NetBSD
2+
3+
According to GCC documentation, "the various `-std` options disable
4+
certain keywords".
5+
This change adheres to GCC's recommendation by replacing the `typeof`
6+
keyword with its alternative, `__typeof__`.
7+
8+
See https://github.com/libevent/libevent/commit/1759485e9a59147a47a674f5132fcfe764e7748c.
9+
10+
11+
--- a/kqueue.c
12+
+++ b/kqueue.c
13+
@@ -52,8 +52,8 @@
14+
* intptr_t, whereas others define it as void*. There doesn't seem to be an
15+
* easy way to tell them apart via autoconf, so we need to use OS macros. */
16+
#if defined(__NetBSD__)
17+
-#define PTR_TO_UDATA(x) ((typeof(((struct kevent *)0)->udata))(x))
18+
-#define INT_TO_UDATA(x) ((typeof(((struct kevent *)0)->udata))(intptr_t)(x))
19+
+#define PTR_TO_UDATA(x) ((__typeof__(((struct kevent *)0)->udata))(x))
20+
+#define INT_TO_UDATA(x) ((__typeof__(((struct kevent *)0)->udata))(intptr_t)(x))
21+
#elif defined(EVENT__HAVE_INTTYPES_H) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__darwin__) && !defined(__APPLE__) && !defined(__CloudABI__)
22+
#define PTR_TO_UDATA(x) ((intptr_t)(x))
23+
#define INT_TO_UDATA(x) ((intptr_t)(x))

0 commit comments

Comments
 (0)