depends: Fix compiling libevent package on NetBSD

This commit is contained in:
Hennadii Stepanov 2024-12-14 15:15:37 +00:00
parent b042c4f053
commit 53ae319eee
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
2 changed files with 23 additions and 1 deletions

View file

@ -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

View file

@ -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))