diff --git a/depends/packages/libevent.mk b/depends/packages/libevent.mk index 9507fe9ddfd..bf03bd2f307 100644 --- a/depends/packages/libevent.mk +++ b/depends/packages/libevent.mk @@ -4,6 +4,7 @@ $(package)_download_path=https://github.com/libevent/libevent/releases/download/ $(package)_file_name=$(package)-$($(package)_version).tar.gz $(package)_sha256_hash=92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb $(package)_patches=cmake_fixups.patch +$(package)_patches += netbsd_fixup.patch $(package)_build_subdir=build # When building for Windows, we set _WIN32_WINNT to target the same Windows @@ -22,7 +23,8 @@ define $(package)_set_vars endef define $(package)_preprocess_cmds - patch -p1 < $($(package)_patch_dir)/cmake_fixups.patch + patch -p1 < $($(package)_patch_dir)/cmake_fixups.patch && \ + patch -p1 < $($(package)_patch_dir)/netbsd_fixup.patch endef define $(package)_config_cmds diff --git a/depends/patches/libevent/netbsd_fixup.patch b/depends/patches/libevent/netbsd_fixup.patch new file mode 100644 index 00000000000..c0027a31804 --- /dev/null +++ b/depends/patches/libevent/netbsd_fixup.patch @@ -0,0 +1,20 @@ +Fix compiling on NetBSD + +GCC documentation states that "the various `-std` options disable +certain keywords". Apparently, `-std=c11` disables the `typeof` keyword. +GCC documentation recommends using the alternative `__typeof__` keyword. + + +--- a/kqueue.c ++++ b/kqueue.c +@@ -52,8 +52,8 @@ + * intptr_t, whereas others define it as void*. There doesn't seem to be an + * easy way to tell them apart via autoconf, so we need to use OS macros. */ + #if defined(__NetBSD__) +-#define PTR_TO_UDATA(x) ((typeof(((struct kevent *)0)->udata))(x)) +-#define INT_TO_UDATA(x) ((typeof(((struct kevent *)0)->udata))(intptr_t)(x)) ++#define PTR_TO_UDATA(x) ((__typeof__(((struct kevent *)0)->udata))(x)) ++#define INT_TO_UDATA(x) ((__typeof__(((struct kevent *)0)->udata))(intptr_t)(x)) + #elif defined(EVENT__HAVE_INTTYPES_H) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__darwin__) && !defined(__APPLE__) && !defined(__CloudABI__) + #define PTR_TO_UDATA(x) ((intptr_t)(x)) + #define INT_TO_UDATA(x) ((intptr_t)(x))