pipewire: simplify outputs drastically

This drops a whole bunch of patches we carry to avoid output cycles, at the cost of +1MB to closure size
on systems that don't already have Pipewire, which are becoming rarer and rarer.
This commit is contained in:
K900 2023-10-20 00:41:55 +03:00
parent 249e31affe
commit ff44e8ab07
9 changed files with 7 additions and 156 deletions

View File

@ -115,8 +115,7 @@ in {
environment.systemPackages = [ cfg.package ]
++ lib.optional cfg.jack.enable jack-libs;
systemd.packages = [ cfg.package ]
++ lib.optional cfg.pulse.enable cfg.package.pulse;
systemd.packages = [ cfg.package ];
# PipeWire depends on DBUS but doesn't list it. Without this booting
# into a terminal results in the service crashing with an error.
@ -140,14 +139,14 @@ in {
environment.etc."alsa/conf.d/49-pipewire-modules.conf" = mkIf cfg.alsa.enable {
text = ''
pcm_type.pipewire {
libs.native = ${cfg.package.lib}/lib/alsa-lib/libasound_module_pcm_pipewire.so ;
libs.native = ${cfg.package}/lib/alsa-lib/libasound_module_pcm_pipewire.so ;
${optionalString enable32BitAlsaPlugins
"libs.32Bit = ${pkgs.pkgsi686Linux.pipewire.lib}/lib/alsa-lib/libasound_module_pcm_pipewire.so ;"}
"libs.32Bit = ${pkgs.pkgsi686Linux.pipewire}/lib/alsa-lib/libasound_module_pcm_pipewire.so ;"}
}
ctl_type.pipewire {
libs.native = ${cfg.package.lib}/lib/alsa-lib/libasound_module_ctl_pipewire.so ;
libs.native = ${cfg.package}/lib/alsa-lib/libasound_module_ctl_pipewire.so ;
${optionalString enable32BitAlsaPlugins
"libs.32Bit = ${pkgs.pkgsi686Linux.pipewire.lib}/lib/alsa-lib/libasound_module_ctl_pipewire.so ;"}
"libs.32Bit = ${pkgs.pkgsi686Linux.pipewire}/lib/alsa-lib/libasound_module_ctl_pipewire.so ;"}
}
'';
};

View File

@ -78,7 +78,7 @@ stdenv.mkDerivation {
pciutils
];
appendRunpaths = [
"${pipewire.lib}/lib"
"${pipewire}/lib"
];
# Firefox uses "relrhack" to manually process relocations from a fixed offset
patchelfFlags = [ "--no-clobber-old-sections" ];

View File

@ -1,13 +0,0 @@
diff --git a/meson.build b/meson.build
index 99a4b2d1..d4a4cda7 100644
--- a/meson.build
+++ b/meson.build
@@ -55,7 +55,7 @@ endif
spa_plugindir = pipewire_libdir / spa_name
-alsadatadir = pipewire_datadir / 'alsa-card-profile' / 'mixer'
+alsadatadir = pipewire_libdir / '..' / 'share' / 'alsa-card-profile' / 'mixer'
pipewire_headers_dir = pipewire_name / 'pipewire'

View File

@ -1,27 +0,0 @@
diff --git a/meson_options.txt b/meson_options.txt
index 961ae2a76..692b84dfd 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -179,6 +179,9 @@ option('udev',
option('udevrulesdir',
type : 'string',
description : 'Directory for udev rules (defaults to /lib/udev/rules.d)')
+option('pipewire_pulse_prefix',
+ type : 'string',
+ description: 'Install directory for the pipewire-pulse daemon')
option('systemd-system-unit-dir',
type : 'string',
description : 'Directory for system systemd units (defaults to /usr/lib/systemd/system)')
diff --git a/src/daemon/systemd/user/meson.build b/src/daemon/systemd/user/meson.build
index d17f3794f..34afe4f1a 100644
--- a/src/daemon/systemd/user/meson.build
+++ b/src/daemon/systemd/user/meson.build
@@ -9,7 +9,7 @@ install_data(
systemd_config = configuration_data()
systemd_config.set('PW_BINARY', pipewire_bindir / 'pipewire')
-systemd_config.set('PW_PULSE_BINARY', pipewire_bindir / 'pipewire-pulse')
+systemd_config.set('PW_PULSE_BINARY', get_option('pipewire_pulse_prefix') / 'bin/pipewire-pulse')
configure_file(input : 'pipewire.service.in',
output : 'pipewire.service',

View File

@ -1,30 +0,0 @@
diff --git a/meson.build b/meson.build
index b6b4553b..f21c29d8 100644
--- a/meson.build
+++ b/meson.build
@@ -37,7 +37,10 @@ pipewire_localedir = prefix / get_option('localedir')
pipewire_sysconfdir = prefix / get_option('sysconfdir')
pipewire_configdir = pipewire_sysconfdir / 'pipewire'
-pipewire_confdatadir = pipewire_datadir / 'pipewire'
+pipewire_confdatadir = get_option('pipewire_confdata_dir')
+if pipewire_confdatadir == ''
+ pipewire_confdatadir = pipewire_datadir / 'pipewire'
+endif
modules_install_dir = pipewire_libdir / pipewire_name
if host_machine.system() == 'linux'
diff --git a/meson_options.txt b/meson_options.txt
index 9bc33fcd..e4bd2dc1 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -61,6 +61,9 @@ option('jack-devel',
option('libjack-path',
description: 'Where to install the libjack.so library',
type: 'string')
+option('pipewire_confdata_dir',
+ type: 'string',
+ description: 'Directory for pipewire default configuration (defaults to /usr/share/pipewire)')
option('spa-plugins',
description: 'Enable spa plugins integration',
type: 'feature',

View File

@ -1,41 +0,0 @@
diff --git a/src/daemon/minimal.conf.in b/src/daemon/minimal.conf.in
index 9c885a38f..c474eb45d 100644
--- a/src/daemon/minimal.conf.in
+++ b/src/daemon/minimal.conf.in
@@ -111,7 +111,7 @@ context.modules = [
# access.allowed to list an array of paths of allowed
# apps.
#access.allowed = [
- # @session_manager_path@
+ # <session_manager_path>
#]
# An array of rejected paths.
@@ -359,5 +359,5 @@ context.exec = [
# It can be interesting to start another daemon here that listens
# on another address with the -a option (eg. -a tcp:4713).
#
- #@pulse_comment@{ path = "@pipewire_path@" args = "-c pipewire-pulse.conf" }
+ #@pulse_comment@{ path = "<pipewire_path>" args = "-c pipewire-pulse.conf" }
]
diff --git a/src/daemon/pipewire.conf.in b/src/daemon/pipewire.conf.in
index 697bf094d..3a7b54ddd 100644
--- a/src/daemon/pipewire.conf.in
+++ b/src/daemon/pipewire.conf.in
@@ -294,7 +294,7 @@ context.exec = [
# but it is better to start it as a systemd service.
# Run the session manager with -h for options.
#
- @sm_comment@{ path = "@session_manager_path@" args = "@session_manager_args@"
+ @sm_comment@{ path = "<session_manager_path>" args = "@session_manager_args@"
@sm_comment@ condition = [ { exec.session-manager = null } { exec.session-manager = true } ] }
#
# You can optionally start the pulseaudio-server here as well
@@ -302,6 +302,6 @@ context.exec = [
# It can be interesting to start another daemon here that listens
# on another address with the -a option (eg. -a tcp:4713).
#
- @pulse_comment@{ path = "@pipewire_path@" args = "-c pipewire-pulse.conf"
+ @pulse_comment@{ path = "<pipewire_path>" args = "-c pipewire-pulse.conf"
@pulse_comment@ condition = [ { exec.pipewire-pulse = null } { exec.pipewire-pulse = true } ] }
]

View File

@ -1,12 +0,0 @@
diff --git a/meson.build b/meson.build
index 56599ebd1..3bed2d3e3 100644
--- a/meson.build
+++ b/meson.build
@@ -54,7 +54,7 @@ else
endif
spa_plugindir = pipewire_libdir / spa_name
-spa_datadir = pipewire_datadir / spa_name
+spa_datadir = pipewire_libdir / spa_name
alsadatadir = pipewire_datadir / 'alsa-card-profile' / 'mixer'

View File

@ -85,8 +85,6 @@ let
outputs = [
"out"
"lib"
"pulse"
"jack"
"dev"
"doc"
@ -103,20 +101,10 @@ let
};
patches = [
# Break up a dependency cycle between outputs.
./0040-alsa-profiles-use-libdir.patch
# Change the path of the pipewire-pulse binary in the service definition.
./0050-pipewire-pulse-path.patch
# Load libjack from a known location
./0060-libjack-path.patch
# Move installed tests into their own output.
./0070-installed-tests-path.patch
# Add option for changing the config install directory
./0080-pipewire-config-dir.patch
# Remove output paths from the comments in the config templates to break dependency cycles
./0090-pipewire-config-template-paths.patch
# Place SPA data files in lib output to avoid dependency cycles
./0095-spa-data-dir.patch
];
strictDeps = true;
@ -170,9 +158,7 @@ let
"-Dudevrulesdir=lib/udev/rules.d"
"-Dinstalled_tests=enabled"
"-Dinstalled_test_prefix=${placeholder "installedTests"}"
"-Dpipewire_pulse_prefix=${placeholder "pulse"}"
"-Dlibjack-path=${placeholder "jack"}/lib"
"-Dlibv4l2-path=${placeholder "out"}/lib"
"-Dlibcamera=${mesonEnableFeature libcameraSupport}"
"-Dlibffado=${mesonEnableFeature ffadoSupport}"
"-Droc=${mesonEnableFeature rocSupport}"
@ -181,7 +167,6 @@ let
"-Dgstreamer=${mesonEnableFeature gstreamerSupport}"
"-Dsystemd-system-service=${mesonEnableFeature enableSystemd}"
"-Dudev=${mesonEnableFeature (!enableSystemd)}"
"-Dudevrulesdir=${placeholder "out"}/lib/udev/rules.d"
"-Dffmpeg=${mesonEnableFeature ffmpegSupport}"
"-Dbluez5=${mesonEnableFeature bluezSupport}"
"-Dbluez5-backend-hsp-native=${mesonEnableFeature nativeHspSupport}"
@ -194,7 +179,6 @@ let
"-Dbluez5-codec-lc3=${mesonEnableFeature bluezSupport}"
"-Dbluez5-codec-ldac=${mesonEnableFeature ldacbtSupport}"
"-Dsysconfdir=/etc"
"-Dpipewire_confdata_dir=${placeholder "lib"}/share/pipewire"
"-Draop=${mesonEnableFeature raopSupport}"
"-Dsession-managers="
"-Dvulkan=enabled"
@ -218,15 +202,6 @@ let
'';
postInstall = ''
${lib.optionalString enableSystemd ''
moveToOutput "share/systemd/user/pipewire-pulse.*" "$pulse"
moveToOutput "lib/systemd/user/pipewire-pulse.*" "$pulse"
''}
rm $out/bin/pipewire-pulse
mkdir -p $pulse/bin
ln -sf $out/bin/pipewire $pulse/bin/pipewire-pulse
moveToOutput "bin/pw-jack" "$jack"
'';

View File

@ -80,7 +80,7 @@ in buildFHSEnv rec {
xorg.libXfixes
libGL
libva
pipewire.lib
pipewire
# steamwebhelper
harfbuzz