Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / wayland / darwin.patch
blob965294dfa5fffde146bfec6af6859dfe546a0894
1 diff --git a/meson.build b/meson.build
2 index 35c3b95..f27e472 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())
8 cc_args = []
9 -if host_machine.system() != 'freebsd'
10 +if host_machine.system() not in ['darwin', 'freebsd']
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)
26 if get_option('libraries')
27 - if host_machine.system() == 'freebsd'
28 + if host_machine.system() in ['darwin', 'freebsd']
29 # When building for FreeBSD, epoll(7) is provided by a userspace
30 # wrapper around kqueue(2).
31 epoll_dep = dependency('epoll-shim')
32 diff --git a/src/event-loop.c b/src/event-loop.c
33 index 37cf95d..49a38cb 100644
34 --- a/src/event-loop.c
35 +++ b/src/event-loop.c
36 @@ -48,6 +48,13 @@
38 #define TIMER_REMOVED -2
40 +#ifdef __APPLE__
41 +struct itimerspec {
42 + struct timespec it_interval;
43 + struct timespec it_value;
44 +};
45 +#endif
47 struct wl_event_loop;
48 struct wl_event_source_interface;
49 struct wl_event_source_timer;
50 diff --git a/src/wayland-os.c b/src/wayland-os.c
51 index a9066ca..483fe64 100644
52 --- a/src/wayland-os.c
53 +++ b/src/wayland-os.c
54 @@ -69,17 +69,19 @@ wl_os_socket_cloexec(int domain, int type, int protocol)
56 int fd;
58 +#ifdef SOCK_CLOEXEC
59 fd = socket(domain, type | SOCK_CLOEXEC, protocol);
60 if (fd >= 0)
61 return fd;
62 if (errno != EINVAL)
63 return -1;
64 +#endif
66 fd = socket(domain, type, protocol);
67 return set_cloexec_or_close(fd);
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)