mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
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:
parent
e4517da353
commit
47a6918739
6 changed files with 53 additions and 26 deletions
10
meson.build
10
meson.build
|
|
@ -150,7 +150,13 @@ cdata.set_quoted('PA_MACHINE_ID', join_paths(sysconfdir, 'machine-id'))
|
||||||
cdata.set_quoted('PA_MACHINE_ID_FALLBACK', join_paths(localstatedir, 'lib', 'dbus', 'machine-id'))
|
cdata.set_quoted('PA_MACHINE_ID_FALLBACK', join_paths(localstatedir, 'lib', 'dbus', 'machine-id'))
|
||||||
cdata.set_quoted('PA_SRCDIR', join_paths(meson.current_source_dir(), 'src'))
|
cdata.set_quoted('PA_SRCDIR', join_paths(meson.current_source_dir(), 'src'))
|
||||||
cdata.set_quoted('PA_BUILDDIR', meson.current_build_dir())
|
cdata.set_quoted('PA_BUILDDIR', meson.current_build_dir())
|
||||||
cdata.set_quoted('PA_SOEXT', '.so')
|
if host_machine.system() == 'windows'
|
||||||
|
cdata.set_quoted('PA_SOEXT', '.dll')
|
||||||
|
elif host_machine.system() == 'darwin'
|
||||||
|
cdata.set_quoted('PA_SOEXT', '.dylib')
|
||||||
|
else
|
||||||
|
cdata.set_quoted('PA_SOEXT', '.so')
|
||||||
|
endif
|
||||||
cdata.set_quoted('PA_DEFAULT_CONFIG_DIR', pulsesysconfdir)
|
cdata.set_quoted('PA_DEFAULT_CONFIG_DIR', pulsesysconfdir)
|
||||||
cdata.set('PA_DEFAULT_CONFIG_DIR_UNQUOTED', pulsesysconfdir)
|
cdata.set('PA_DEFAULT_CONFIG_DIR_UNQUOTED', pulsesysconfdir)
|
||||||
cdata.set_quoted('PA_BINARY', join_paths(bindir, 'pulseaudio'))
|
cdata.set_quoted('PA_BINARY', join_paths(bindir, 'pulseaudio'))
|
||||||
|
|
@ -426,7 +432,7 @@ cdata.set('MESON_BUILD', 1)
|
||||||
# so we request the nodelete flag to be enabled.
|
# so we request the nodelete flag to be enabled.
|
||||||
# On other systems, we don't really know how to do that, but it's welcome if somebody can tell.
|
# On other systems, we don't really know how to do that, but it's welcome if somebody can tell.
|
||||||
# Windows doesn't support this flag.
|
# Windows doesn't support this flag.
|
||||||
if host_machine.system() != 'windows'
|
if host_machine.system() != 'windows' and host_machine.system() != 'darwin'
|
||||||
nodelete_link_args = ['-Wl,-z,nodelete']
|
nodelete_link_args = ['-Wl,-z,nodelete']
|
||||||
else
|
else
|
||||||
nodelete_link_args = []
|
nodelete_link_args = []
|
||||||
|
|
|
||||||
|
|
@ -182,9 +182,14 @@ if host_machine.system() == 'windows'
|
||||||
else
|
else
|
||||||
libpulsecommon_sources += [
|
libpulsecommon_sources += [
|
||||||
'pulsecore/mutex-posix.c',
|
'pulsecore/mutex-posix.c',
|
||||||
'pulsecore/semaphore-posix.c',
|
'pulsecore/poll-posix.c',
|
||||||
'pulsecore/thread-posix.c'
|
'pulsecore/thread-posix.c',
|
||||||
]
|
]
|
||||||
|
if host_machine.system() == 'darwin'
|
||||||
|
libpulsecommon_sources += ['pulsecore/semaphore-osx.c']
|
||||||
|
else
|
||||||
|
libpulsecommon_sources += ['pulsecore/semaphore-posix.c']
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
# FIXME: Do SIMD things
|
# FIXME: Do SIMD things
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,15 +8,12 @@ all_modules = [
|
||||||
[ 'module-always-sink', 'module-always-sink.c' ],
|
[ 'module-always-sink', 'module-always-sink.c' ],
|
||||||
[ 'module-always-source', 'module-always-source.c' ],
|
[ 'module-always-source', 'module-always-source.c' ],
|
||||||
[ 'module-augment-properties', 'module-augment-properties.c' ],
|
[ 'module-augment-properties', 'module-augment-properties.c' ],
|
||||||
# [ 'module-bonjour-publish', 'macosx/module-bonjour-publish.c' ],
|
|
||||||
[ 'module-card-restore', 'module-card-restore.c' ],
|
[ 'module-card-restore', 'module-card-restore.c' ],
|
||||||
[ 'module-cli', 'module-cli.c', [], [], [], libcli ],
|
[ 'module-cli', 'module-cli.c', [], [], [], libcli ],
|
||||||
[ 'module-cli-protocol-tcp', 'module-protocol-stub.c', [], ['-DUSE_PROTOCOL_CLI', '-DUSE_TCP_SOCKETS'], [], libprotocol_cli ],
|
[ 'module-cli-protocol-tcp', 'module-protocol-stub.c', [], ['-DUSE_PROTOCOL_CLI', '-DUSE_TCP_SOCKETS'], [], libprotocol_cli ],
|
||||||
[ 'module-cli-protocol-unix', 'module-protocol-stub.c', [], ['-DUSE_PROTOCOL_CLI', '-DUSE_UNIX_SOCKETS'], [], libprotocol_cli ],
|
[ 'module-cli-protocol-unix', 'module-protocol-stub.c', [], ['-DUSE_PROTOCOL_CLI', '-DUSE_UNIX_SOCKETS'], [], libprotocol_cli ],
|
||||||
[ 'module-combine', 'module-combine.c' ],
|
[ 'module-combine', 'module-combine.c' ],
|
||||||
[ 'module-combine-sink', 'module-combine-sink.c', [], [], [libatomic_ops_dep] ],
|
[ 'module-combine-sink', 'module-combine-sink.c', [], [], [libatomic_ops_dep] ],
|
||||||
# [ 'module-coreaudio-detect', 'macosx/module-coreaudio-detect.c' ],
|
|
||||||
# [ 'module-coreaudio-device', 'macosx/module-coreaudio-device.c' ],
|
|
||||||
[ 'module-default-device-restore', 'module-default-device-restore.c', [], [], [], libprotocol_native ],
|
[ 'module-default-device-restore', 'module-default-device-restore.c', [], [], [], libprotocol_native ],
|
||||||
[ 'module-detect', 'module-detect.c' ],
|
[ 'module-detect', 'module-detect.c' ],
|
||||||
[ 'module-device-manager', 'module-device-manager.c', [], [], [], libprotocol_native ],
|
[ 'module-device-manager', 'module-device-manager.c', [], [], [], libprotocol_native ],
|
||||||
|
|
@ -78,6 +75,16 @@ if host_machine.system() != 'windows'
|
||||||
]
|
]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if host_machine.system() == 'darwin'
|
||||||
|
bonjour_dep = dependency('appleframeworks', modules : ['CoreFoundation'])
|
||||||
|
coreaudio_dep = dependency('appleframeworks', modules : ['CoreAudio'])
|
||||||
|
all_modules += [
|
||||||
|
[ 'module-bonjour-publish', 'macosx/module-bonjour-publish.c', [], [], [bonjour_dep] ],
|
||||||
|
[ 'module-coreaudio-detect', 'macosx/module-coreaudio-detect.c', [], [], [coreaudio_dep] ],
|
||||||
|
[ 'module-coreaudio-device', 'macosx/module-coreaudio-device.c', [], [], [coreaudio_dep] ],
|
||||||
|
]
|
||||||
|
endif
|
||||||
|
|
||||||
# Modules enabled by headers
|
# Modules enabled by headers
|
||||||
|
|
||||||
if cc.has_header('linux/input.h')
|
if cc.has_header('linux/input.h')
|
||||||
|
|
@ -298,6 +305,12 @@ all_modules += [
|
||||||
# FIXME: meson doesn't support multiple RPATH arguments currently
|
# FIXME: meson doesn't support multiple RPATH arguments currently
|
||||||
rpath_dirs = join_paths(privlibdir) + ':' + join_paths(modlibexecdir)
|
rpath_dirs = join_paths(privlibdir) + ':' + join_paths(modlibexecdir)
|
||||||
|
|
||||||
|
if host_machine.system() != 'windows' and host_machine.system() != 'darwin'
|
||||||
|
no_undefined_args = ['-Wl,--no-undefined']
|
||||||
|
else
|
||||||
|
no_undefined_args = []
|
||||||
|
endif
|
||||||
|
|
||||||
foreach m : all_modules
|
foreach m : all_modules
|
||||||
name = m[0]
|
name = m[0]
|
||||||
sources = m[1]
|
sources = m[1]
|
||||||
|
|
@ -315,7 +328,7 @@ foreach m : all_modules
|
||||||
install_rpath : rpath_dirs,
|
install_rpath : rpath_dirs,
|
||||||
install_dir : modlibexecdir,
|
install_dir : modlibexecdir,
|
||||||
dependencies : [thread_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep, libintl_dep, platform_dep, platform_socket_dep] + extra_deps,
|
dependencies : [thread_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep, libintl_dep, platform_dep, platform_socket_dep] + extra_deps,
|
||||||
link_args : [nodelete_link_args, '-Wl,--no-undefined' ],
|
link_args : [nodelete_link_args, no_undefined_args],
|
||||||
link_with : extra_libs,
|
link_with : extra_libs,
|
||||||
name_prefix : '',
|
name_prefix : '',
|
||||||
implicit_include_directories : false)
|
implicit_include_directories : false)
|
||||||
|
|
|
||||||
|
|
@ -70,11 +70,15 @@ if glib_dep.found()
|
||||||
libpulse_headers += 'glib-mainloop.h'
|
libpulse_headers += 'glib-mainloop.h'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
run_target('update-map-file',
|
if host_machine.system() != 'windows' and host_machine.system() != 'darwin'
|
||||||
command : [ join_paths(meson.source_root(), 'scripts/generate-map-file.sh'), 'map-file',
|
run_target('update-map-file',
|
||||||
[ libpulse_headers, 'simple.h', join_paths(meson.build_root(), 'src', 'pulse', 'version.h') ] ])
|
command : [ join_paths(meson.source_root(), 'scripts/generate-map-file.sh'), 'map-file',
|
||||||
|
[ libpulse_headers, 'simple.h', join_paths(meson.build_root(), 'src', 'pulse', 'version.h') ] ])
|
||||||
|
|
||||||
versioning_link_args = '-Wl,-version-script=' + join_paths(meson.source_root(), 'src', 'pulse', 'map-file')
|
versioning_link_args = ['-Wl,-version-script=' + join_paths(meson.source_root(), 'src', 'pulse', 'map-file')]
|
||||||
|
else
|
||||||
|
versioning_link_args = []
|
||||||
|
endif
|
||||||
|
|
||||||
libpulse = shared_library('pulse',
|
libpulse = shared_library('pulse',
|
||||||
libpulse_sources,
|
libpulse_sources,
|
||||||
|
|
|
||||||
|
|
@ -65,19 +65,7 @@ pa_usec_t pa_rtclock_age(const struct timeval *tv) {
|
||||||
|
|
||||||
struct timeval *pa_rtclock_get(struct timeval *tv) {
|
struct timeval *pa_rtclock_get(struct timeval *tv) {
|
||||||
|
|
||||||
#if defined(OS_IS_DARWIN)
|
#if defined(HAVE_CLOCK_GETTIME)
|
||||||
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)
|
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
|
|
||||||
#ifdef CLOCK_MONOTONIC
|
#ifdef CLOCK_MONOTONIC
|
||||||
|
|
@ -97,6 +85,17 @@ struct timeval *pa_rtclock_get(struct timeval *tv) {
|
||||||
tv->tv_sec = ts.tv_sec;
|
tv->tv_sec = ts.tv_sec;
|
||||||
tv->tv_usec = ts.tv_nsec / PA_NSEC_PER_USEC;
|
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;
|
return tv;
|
||||||
#elif defined(OS_IS_WIN32)
|
#elif defined(OS_IS_WIN32)
|
||||||
if (counter_freq > 0) {
|
if (counter_freq > 0) {
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
typedef struct pa_creds pa_creds;
|
typedef struct pa_creds pa_creds;
|
||||||
typedef struct pa_cmsg_ancil_data pa_cmsg_ancil_data;
|
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
|
#define HAVE_CREDS 1
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue