Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 74 lines 2.3 kB view raw
1diff --git a/meson.build b/meson.build 2index 8e28f2a..c8d1dc9 100644 3--- a/meson.build 4+++ b/meson.build 5@@ -16,7 +16,7 @@ config_h.set_quoted('PACKAGE', meson.project_name()) 6 config_h.set_quoted('PACKAGE_VERSION', meson.project_version()) 7 8 cc_args = [] 9-if host_machine.system() not in ['freebsd', 'openbsd'] 10+if host_machine.system() not in ['darwin', 'freebsd', 'openbsd'] 11 cc_args += ['-D_POSIX_C_SOURCE=200809L'] 12 endif 13 add_project_arguments(cc_args, language: 'c') 14@@ -52,7 +52,7 @@ foreach f: have_funcs 15 endforeach 16 config_h.set10('HAVE_XUCRED_CR_PID', cc.has_member('struct xucred', 'cr_pid', prefix : '#include <sys/ucred.h>')) 17 have_broken_msg_cmsg_cloexec = false 18-if host_machine.system() == 'freebsd' 19+if host_machine.system() in ['darwin', 'freebsd'] 20 have_broken_msg_cmsg_cloexec = not cc.compiles(''' 21 #include <sys/param.h> /* To get __FreeBSD_version. */ 22 #if __FreeBSD_version < 1300502 || \ 23@@ -69,7 +69,7 @@ endif 24 config_h.set10('HAVE_BROKEN_MSG_CMSG_CLOEXEC', have_broken_msg_cmsg_cloexec) 25 26 if get_option('libraries') 27- if host_machine.system() in ['freebsd', 'openbsd'] 28+ if host_machine.system() in ['darwin', 'freebsd', 'openbsd'] 29 # When building for FreeBSD, epoll(7) is provided by a userspace 30 # wrapper around kqueue(2). 31 epoll_dep = dependency('epoll-shim') 32diff --git a/src/event-loop.c b/src/event-loop.c 33index 45222f7..fb3b464 100644 34--- a/src/event-loop.c 35+++ b/src/event-loop.c 36@@ -49,6 +49,13 @@ 37 38 #define TIMER_REMOVED -2 39 40+#ifdef __APPLE__ 41+struct itimerspec { 42+ struct timespec it_interval; 43+ struct timespec it_value; 44+}; 45+#endif 46+ 47 struct wl_event_loop; 48 struct wl_event_source_interface; 49 struct wl_event_source_timer; 50diff --git a/src/wayland-os.c b/src/wayland-os.c 51index f00ead4..4dc01d0 100644 52--- a/src/wayland-os.c 53+++ b/src/wayland-os.c 54@@ -75,17 +75,19 @@ wl_os_socket_cloexec(int domain, int type, int protocol) 55 { 56 int fd; 57 58+#ifdef SOCK_CLOEXEC 59 fd = wl_socket(domain, type | SOCK_CLOEXEC, protocol); 60 if (fd >= 0) 61 return fd; 62 if (errno != EINVAL) 63 return -1; 64+#endif 65 66 fd = wl_socket(domain, type, protocol); 67 return set_cloexec_or_close(fd); 68 } 69 70-#if defined(__FreeBSD__) 71+#if defined(__APPLE__) || defined(__FreeBSD__) 72 int 73 wl_os_socket_peercred(int sockfd, uid_t *uid, gid_t *gid, pid_t *pid) 74 {