build-sys: Fix macOS build

* Enable macOS specific modules (module-bonjour-publish,
  module-coreaudio-detect and module-coreaudio-device)
* Correctly set `PA_SOEXT` (.so, .dylib and .dll)
* Build `poll-posix.c` and `semaphore-osx.c`
* Drop linker flag `-Wl,-z,nodelete` on Darwin
* Drop linker flag `-Wl,--no-undefined` on Darwin
* Prefer to `clock_gettime` over compat impl for old Darwin
* Disable SCM credential on Darwin

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/746>
This commit is contained in:
Shunsuke Shimizu 2022-08-29 04:13:55 +09:00 committed by PulseAudio Marge Bot
parent e4517da353
commit 47a6918739
6 changed files with 53 additions and 26 deletions

View file

@ -65,19 +65,7 @@ pa_usec_t pa_rtclock_age(const struct timeval *tv) {
struct timeval *pa_rtclock_get(struct timeval *tv) {
#if defined(OS_IS_DARWIN)
uint64_t val, abs_time = mach_absolute_time();
Nanoseconds nanos;
nanos = AbsoluteToNanoseconds(*(AbsoluteTime *) &abs_time);
val = *(uint64_t *) &nanos;
tv->tv_sec = val / PA_NSEC_PER_SEC;
tv->tv_usec = (val % PA_NSEC_PER_SEC) / PA_NSEC_PER_USEC;
return tv;
#elif defined(HAVE_CLOCK_GETTIME)
#if defined(HAVE_CLOCK_GETTIME)
struct timespec ts;
#ifdef CLOCK_MONOTONIC
@ -97,6 +85,17 @@ struct timeval *pa_rtclock_get(struct timeval *tv) {
tv->tv_sec = ts.tv_sec;
tv->tv_usec = ts.tv_nsec / PA_NSEC_PER_USEC;
return tv;
#elif defined(OS_IS_DARWIN)
uint64_t val, abs_time = mach_absolute_time();
Nanoseconds nanos;
nanos = AbsoluteToNanoseconds(*(AbsoluteTime *) &abs_time);
val = *(uint64_t *) &nanos;
tv->tv_sec = val / PA_NSEC_PER_SEC;
tv->tv_usec = (val % PA_NSEC_PER_SEC) / PA_NSEC_PER_USEC;
return tv;
#elif defined(OS_IS_WIN32)
if (counter_freq > 0) {

View file

@ -34,7 +34,7 @@
typedef struct pa_creds pa_creds;
typedef struct pa_cmsg_ancil_data pa_cmsg_ancil_data;
#if defined(SCM_CREDENTIALS) || defined(SCM_CREDS)
#if (defined(SCM_CREDENTIALS) || defined(SCM_CREDS)) && !defined(OS_IS_DARWIN)
#define HAVE_CREDS 1