systemd: Add systemd-user-unit-dir override

Add a new build option 'system-user-unit=dir', which can be used to
override the pkg-config default value.

By doing this, it becomes more practical to make a local unprivileged
build of the latest PipeWire:

$ meson --prefix=~/.local build
$ meson configure build -Dpipewire-alsa=false
$ meson configure build -Dsystemd-user-unit-dir=~/.config/systemd/user
$ meson configure build -Dudevrulesdir="`mktemp -d`"
$ ninja -C build install

For a local build enabling ALSA plugins is not plausible.

JACK needs a simple addition to the ~/.profile:

export LD_LIBRARY_PATH=$HOME/.local/lib/x86_64-linux-gnu/pipewire-0.3/jack

Finally, the genuine PulseAudio must be masked and local services
enabled:

systemctl --user enable pipewire.socket
systemctl --user enable pipewire-pulse.socket
systemctl --user mask pulseaudio.service

A sanity check [*] shows that nothing has leaked out of the home
directory (even though at least on my Debian 10 system PolKit still
asks for authorization during the meson build).

Not perfect, but lowers a barrier to run the development version a lot,
as that does not anymore to trash your system.

[*]  find / -name "*pipewire*" \! -path "/home/*"  \! -path "/var/lib/flatpak/*" 2> /dev/null

Signed-off-by: Jarkko Sakkinen <jarkko@suppilovahvero.lan>
This commit is contained in:
Jarkko Sakkinen 2021-01-09 11:38:45 +02:00 committed by Wim Taymans
parent 7ca568db86
commit ec9dfe72ff
2 changed files with 6 additions and 0 deletions

View file

@ -140,3 +140,6 @@ option('pw-cat',
option('udevrulesdir',
type : 'string',
description : 'Directory for udev rules (defaults to /lib/udev/rules.d)')
option('systemd-user-unit-dir',
type : 'string',
description : 'Directory for user systemd units (defaults to /usr/lib/systemd/user)')

View file

@ -1,4 +1,7 @@
systemd_user_services_dir = systemd.get_pkgconfig_variable('systemduserunitdir', define_variable : [ 'prefix', prefix])
if get_option('systemd-user-unit-dir') != ''
systemd_user_services_dir = get_option('systemd-user-unit-dir')
endif
install_data(
sources : ['pipewire.socket', 'pipewire-pulse.socket'],