libpulseaudio: fix build on x86_64-darwin
Signed-off-by: Thiago Kenji Okada <thiagokokada@gmail.com>
This commit is contained in:
parent
f419dc5763
commit
9cf2c67910
|
@ -0,0 +1,26 @@
|
||||||
|
From 72f3fe059f031f24c5ad026cb2fc16318f227c09 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Andrew Childs <andrew.childs@bibo.com.ph>
|
||||||
|
Date: Tue, 19 Apr 2022 16:29:58 +0900
|
||||||
|
Subject: [PATCH 1/8] Make gio-2.0 optional when gsettings is disabled
|
||||||
|
|
||||||
|
Derived from https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/654
|
||||||
|
---
|
||||||
|
meson.build | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/meson.build b/meson.build
|
||||||
|
index d7e468cab..f7adf1413 100644
|
||||||
|
--- a/meson.build
|
||||||
|
+++ b/meson.build
|
||||||
|
@@ -614,7 +614,7 @@ if dbus_dep.found()
|
||||||
|
cdata.set('HAVE_DBUS', 1)
|
||||||
|
endif
|
||||||
|
|
||||||
|
-gio_dep = dependency('gio-2.0', version : '>= 2.26.0')
|
||||||
|
+gio_dep = dependency('gio-2.0', version : '>= 2.26.0', required : false)
|
||||||
|
if get_option('gsettings').enabled()
|
||||||
|
assert(gio_dep.found(), 'GSettings support needs glib I/O library (GIO)')
|
||||||
|
cdata.set('HAVE_GSETTINGS', 1)
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
27
pkgs/servers/pulseaudio/0002-Ignore-SCM_CREDS-on-macOS.patch
Normal file
27
pkgs/servers/pulseaudio/0002-Ignore-SCM_CREDS-on-macOS.patch
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
From 39bef695f783614e6175477417298ddf37e2ac13 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Andrew Childs <andrew.childs@bibo.com.ph>
|
||||||
|
Date: Tue, 19 Apr 2022 16:58:43 +0900
|
||||||
|
Subject: [PATCH 2/8] Ignore SCM_CREDS on macOS
|
||||||
|
|
||||||
|
It was added for FreeBSD support, but also enables the
|
||||||
|
unsupported[citation needed] feature on macOS.
|
||||||
|
---
|
||||||
|
src/pulsecore/creds.h | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/pulsecore/creds.h b/src/pulsecore/creds.h
|
||||||
|
index b599b569c..b5b1c9f37 100644
|
||||||
|
--- a/src/pulsecore/creds.h
|
||||||
|
+++ b/src/pulsecore/creds.h
|
||||||
|
@@ -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(__APPLE__))
|
||||||
|
|
||||||
|
#define HAVE_CREDS 1
|
||||||
|
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
From 3f1abb55f4eb985fd0715b2b2ca45dcce3a56824 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Andrew Childs <andrew.childs@bibo.com.ph>
|
||||||
|
Date: Tue, 19 Apr 2022 17:06:50 +0900
|
||||||
|
Subject: [PATCH 3/8] Disable `-z nodelete` on darwin
|
||||||
|
|
||||||
|
Not supported[citation needed].
|
||||||
|
---
|
||||||
|
meson.build | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/meson.build b/meson.build
|
||||||
|
index f7adf1413..d4bece11a 100644
|
||||||
|
--- a/meson.build
|
||||||
|
+++ b/meson.build
|
||||||
|
@@ -404,7 +404,7 @@ cdata.set('MESON_BUILD', 1)
|
||||||
|
# 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.
|
||||||
|
# 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']
|
||||||
|
else
|
||||||
|
nodelete_link_args = []
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
57
pkgs/servers/pulseaudio/0004-Prefer-clock_gettime.patch
Normal file
57
pkgs/servers/pulseaudio/0004-Prefer-clock_gettime.patch
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
From 0bd3b613ac3bf16a73b3223fa1b961da3a0db1b2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Andrew Childs <andrew.childs@bibo.com.ph>
|
||||||
|
Date: Tue, 19 Apr 2022 17:12:52 +0900
|
||||||
|
Subject: [PATCH 4/8] Prefer clock_gettime
|
||||||
|
|
||||||
|
Available in darwin since 10.12 (released in 2016).
|
||||||
|
---
|
||||||
|
src/pulsecore/core-rtclock.c | 26 +++++++++++++-------------
|
||||||
|
1 file changed, 13 insertions(+), 13 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/pulsecore/core-rtclock.c b/src/pulsecore/core-rtclock.c
|
||||||
|
index 2c2e28631..a08d4b391 100644
|
||||||
|
--- a/src/pulsecore/core-rtclock.c
|
||||||
|
+++ b/src/pulsecore/core-rtclock.c
|
||||||
|
@@ -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
|
||||||
|
@@ -109,6 +97,18 @@ struct timeval *pa_rtclock_get(struct timeval *tv) {
|
||||||
|
|
||||||
|
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;
|
||||||
|
+
|
||||||
|
#endif /* HAVE_CLOCK_GETTIME */
|
||||||
|
|
||||||
|
return pa_gettimeofday(tv);
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
From 8dee473920d3a331b73a415b37e7e0b01f014110 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Andrew Childs <andrew.childs@bibo.com.ph>
|
||||||
|
Date: Tue, 19 Apr 2022 17:22:23 +0900
|
||||||
|
Subject: [PATCH 5/8] Include poll-posix.c on darwin
|
||||||
|
|
||||||
|
---
|
||||||
|
src/meson.build | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/src/meson.build b/src/meson.build
|
||||||
|
index e2860811b..5bd68cb12 100644
|
||||||
|
--- a/src/meson.build
|
||||||
|
+++ b/src/meson.build
|
||||||
|
@@ -182,6 +182,7 @@ if host_machine.system() == 'windows'
|
||||||
|
else
|
||||||
|
libpulsecommon_sources += [
|
||||||
|
'pulsecore/mutex-posix.c',
|
||||||
|
+ 'pulsecore/poll-posix.c',
|
||||||
|
'pulsecore/semaphore-posix.c',
|
||||||
|
'pulsecore/thread-posix.c'
|
||||||
|
]
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
From 419258112b9d90d149ebbd5c657a36d8532b78a2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Andrew Childs <andrew.childs@bibo.com.ph>
|
||||||
|
Date: Tue, 19 Apr 2022 17:31:36 +0900
|
||||||
|
Subject: [PATCH 6/8] Only use version-script on GNU-ish linkers
|
||||||
|
|
||||||
|
---
|
||||||
|
src/pulse/meson.build | 6 +++++-
|
||||||
|
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/pulse/meson.build b/src/pulse/meson.build
|
||||||
|
index c2128e087..a5e47867e 100644
|
||||||
|
--- a/src/pulse/meson.build
|
||||||
|
+++ b/src/pulse/meson.build
|
||||||
|
@@ -74,7 +74,11 @@ run_target('update-map-file',
|
||||||
|
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')
|
||||||
|
+if meson.get_compiler('c').get_linker_id().startswith('ld.')
|
||||||
|
+ 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_sources,
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
From 6f132be835d5acb5db4301ea1818601504e47fae Mon Sep 17 00:00:00 2001
|
||||||
|
From: Andrew Childs <andrew.childs@bibo.com.ph>
|
||||||
|
Date: Tue, 19 Apr 2022 17:41:34 +0900
|
||||||
|
Subject: [PATCH 7/8] Adapt undefined link args per linker
|
||||||
|
|
||||||
|
TODO: Why is this required? Isn't it default?
|
||||||
|
---
|
||||||
|
src/modules/meson.build | 13 ++++++++++++-
|
||||||
|
1 file changed, 12 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/modules/meson.build b/src/modules/meson.build
|
||||||
|
index be72c3b9b..0163b583f 100644
|
||||||
|
--- a/src/modules/meson.build
|
||||||
|
+++ b/src/modules/meson.build
|
||||||
|
@@ -293,6 +293,17 @@ all_modules += [
|
||||||
|
# FIXME: meson doesn't support multiple RPATH arguments currently
|
||||||
|
rpath_dirs = join_paths(privlibdir) + ':' + join_paths(modlibexecdir)
|
||||||
|
|
||||||
|
+if meson.get_compiler('c').get_linker_id().startswith('ld.')
|
||||||
|
+ no_undefined_link_args = [ '-Wl,--no-undefined' ]
|
||||||
|
+elif meson.get_compiler('c').get_linker_id() == 'ld64'
|
||||||
|
+ # TODO: is this required? is this not default?
|
||||||
|
+ no_undefined_link_args = [ '-Wl,-undefined,error' ]
|
||||||
|
+else
|
||||||
|
+ # TODO: what platforms is this? what flag do they use?
|
||||||
|
+ no_undefined_link_args = []
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
+
|
||||||
|
foreach m : all_modules
|
||||||
|
name = m[0]
|
||||||
|
sources = m[1]
|
||||||
|
@@ -310,7 +321,7 @@ foreach m : all_modules
|
||||||
|
install_rpath : rpath_dirs,
|
||||||
|
install_dir : modlibexecdir,
|
||||||
|
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_link_args ],
|
||||||
|
link_with : extra_libs,
|
||||||
|
name_prefix : '',
|
||||||
|
implicit_include_directories : false)
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
From 1a840b6e517004c902dfbea3d358b344c9588978 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Andrew Childs <andrew.childs@bibo.com.ph>
|
||||||
|
Date: Tue, 19 Apr 2022 17:49:08 +0900
|
||||||
|
Subject: [PATCH 8/8] Use correct semaphore on darwin
|
||||||
|
|
||||||
|
---
|
||||||
|
src/meson.build | 6 +++++-
|
||||||
|
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/meson.build b/src/meson.build
|
||||||
|
index 5bd68cb12..041e2fab4 100644
|
||||||
|
--- a/src/meson.build
|
||||||
|
+++ b/src/meson.build
|
||||||
|
@@ -183,9 +183,13 @@ else
|
||||||
|
libpulsecommon_sources += [
|
||||||
|
'pulsecore/mutex-posix.c',
|
||||||
|
'pulsecore/poll-posix.c',
|
||||||
|
- 'pulsecore/semaphore-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
|
||||||
|
# FIXME: Do SIMD things
|
||||||
|
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
, sbc, bluez5, udev, openssl, fftwFloat
|
, sbc, bluez5, udev, openssl, fftwFloat
|
||||||
, soxr, speexdsp, systemd, webrtc-audio-processing
|
, soxr, speexdsp, systemd, webrtc-audio-processing
|
||||||
, gst_all_1
|
, gst_all_1
|
||||||
, check, meson, ninja, m4, wrapGAppsHook
|
, check, libintl, meson, ninja, m4, wrapGAppsHook
|
||||||
|
|
||||||
, x11Support ? false
|
, x11Support ? false
|
||||||
|
|
||||||
|
@ -45,6 +45,18 @@ stdenv.mkDerivation rec {
|
||||||
# Install sysconfdir files inside of the nix store,
|
# Install sysconfdir files inside of the nix store,
|
||||||
# but use a conventional runtime sysconfdir outside the store
|
# but use a conventional runtime sysconfdir outside the store
|
||||||
./add-option-for-installation-sysconfdir.patch
|
./add-option-for-installation-sysconfdir.patch
|
||||||
|
|
||||||
|
# https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/654
|
||||||
|
./0001-Make-gio-2.0-optional-when-gsettings-is-disabled.patch
|
||||||
|
|
||||||
|
# TODO (not sent upstream)
|
||||||
|
./0002-Ignore-SCM_CREDS-on-macOS.patch
|
||||||
|
./0003-Disable-z-nodelete-on-darwin.patch
|
||||||
|
./0004-Prefer-clock_gettime.patch
|
||||||
|
./0005-Include-poll-posix.c-on-darwin.patch
|
||||||
|
./0006-Only-use-version-script-on-GNU-ish-linkers.patch
|
||||||
|
./0007-Adapt-undefined-link-args-per-linker.patch
|
||||||
|
./0008-Use-correct-semaphore-on-darwin.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
outputs = [ "out" "dev" ];
|
outputs = [ "out" "dev" ];
|
||||||
|
@ -58,7 +70,7 @@ stdenv.mkDerivation rec {
|
||||||
lib.optionals stdenv.isLinux [ libcap ];
|
lib.optionals stdenv.isLinux [ libcap ];
|
||||||
|
|
||||||
buildInputs =
|
buildInputs =
|
||||||
[ libtool libsndfile soxr speexdsp fftwFloat check ]
|
[ libtool libsndfile soxr speexdsp fftwFloat check libintl ]
|
||||||
++ lib.optionals stdenv.isLinux [ glib dbus ]
|
++ lib.optionals stdenv.isLinux [ glib dbus ]
|
||||||
++ lib.optionals stdenv.isDarwin [ AudioUnit Cocoa CoreServices ]
|
++ lib.optionals stdenv.isDarwin [ AudioUnit Cocoa CoreServices ]
|
||||||
++ lib.optionals (!libOnly) (
|
++ lib.optionals (!libOnly) (
|
||||||
|
@ -84,15 +96,18 @@ stdenv.mkDerivation rec {
|
||||||
"-Dbluez5-gstreamer=${if (!libOnly && bluetoothSupport && advancedBluetoothCodecs) then "enabled" else "disabled"}"
|
"-Dbluez5-gstreamer=${if (!libOnly && bluetoothSupport && advancedBluetoothCodecs) then "enabled" else "disabled"}"
|
||||||
"-Ddatabase=simple"
|
"-Ddatabase=simple"
|
||||||
"-Ddoxygen=false"
|
"-Ddoxygen=false"
|
||||||
|
"-Ddbus=${if stdenv.isLinux then "enabled" else "disabled"}"
|
||||||
"-Delogind=disabled"
|
"-Delogind=disabled"
|
||||||
|
"-Dglib=${if stdenv.isLinux then "enabled" else "disabled"}"
|
||||||
# gsettings does not support cross-compilation
|
# gsettings does not support cross-compilation
|
||||||
"-Dgsettings=${if stdenv.buildPlatform == stdenv.hostPlatform then "enabled" else "disabled"}"
|
"-Dgsettings=${if stdenv.isLinux && (stdenv.buildPlatform == stdenv.hostPlatform) then "enabled" else "disabled"}"
|
||||||
"-Dgstreamer=disabled"
|
"-Dgstreamer=disabled"
|
||||||
"-Dgtk=disabled"
|
"-Dgtk=disabled"
|
||||||
"-Djack=${if jackaudioSupport && !libOnly then "enabled" else "disabled"}"
|
"-Djack=${if jackaudioSupport && !libOnly then "enabled" else "disabled"}"
|
||||||
"-Dlirc=${if remoteControlSupport then "enabled" else "disabled"}"
|
"-Dlirc=${if remoteControlSupport then "enabled" else "disabled"}"
|
||||||
"-Dopenssl=${if airtunesSupport then "enabled" else "disabled"}"
|
"-Dopenssl=${if airtunesSupport then "enabled" else "disabled"}"
|
||||||
"-Dorc=disabled"
|
"-Dorc=disabled"
|
||||||
|
"-Doss-output=${if stdenv.isLinux then "enabled" else "disabled"}"
|
||||||
"-Dsystemd=${if useSystemd && !libOnly then "enabled" else "disabled"}"
|
"-Dsystemd=${if useSystemd && !libOnly then "enabled" else "disabled"}"
|
||||||
"-Dtcpwrap=disabled"
|
"-Dtcpwrap=disabled"
|
||||||
"-Dudev=${if !libOnly then "enabled" else "disabled"}"
|
"-Dudev=${if !libOnly then "enabled" else "disabled"}"
|
||||||
|
@ -104,9 +119,11 @@ stdenv.mkDerivation rec {
|
||||||
"-Dsysconfdir=/etc"
|
"-Dsysconfdir=/etc"
|
||||||
"-Dsysconfdir_install=${placeholder "out"}/etc"
|
"-Dsysconfdir_install=${placeholder "out"}/etc"
|
||||||
"-Dudevrulesdir=${placeholder "out"}/lib/udev/rules.d"
|
"-Dudevrulesdir=${placeholder "out"}/lib/udev/rules.d"
|
||||||
|
|
||||||
|
# tests fail on Darwin because of timeouts
|
||||||
|
"-Dtests=${if stdenv.isLinux then "true" else "false"}"
|
||||||
]
|
]
|
||||||
++ lib.optional (stdenv.isLinux && useSystemd) "-Dsystemduserunitdir=${placeholder "out"}/lib/systemd/user"
|
++ lib.optional (stdenv.isLinux && useSystemd) "-Dsystemduserunitdir=${placeholder "out"}/lib/systemd/user";
|
||||||
;
|
|
||||||
|
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
preCheck = ''
|
preCheck = ''
|
||||||
|
|
Loading…
Reference in a new issue