systemd user unit directory incorrectly guessed if the prefix is not '/usr'
Building vte on a Linux system using a prefix of anything other than '/usr' results in the systemd user unit files being written to '${prefix}/lib/systemd'.
I'm building vte on a self-built Linux system with an installation prefix of '/opt/gnome' which results in the systemd user unit directory being set to '/opt/gnome/lib/systemd', a location that systemd will not search when looking for unit files. Specifically:
meson setup \
--prefix="/opt/gnome" \
--libdir="/opt/gnome/lib64" \
--localstatedir="/var"
Current versions of systemd include the pkg-config files 'libsystemd.pc' and 'systemd.pc'. The contents of 'systemd.pc' identifies the paths of systemd's configuration files, therefore, where this is available (and I understand that it was not available on earlier versions) the information should be used ahead of the specified vte default.
Attached is a patch against 0.66.2 which does this and provides an overriding parameter ('systemduserunitdir') if the value needs to be altered for any reason.
vte-0.66.2-systemduserunitdir.patch
This results in:
- the value of the 'systemduserunitdir' parameter being used when specified to override all other possible values
- '${prefix}/lib/systemd' being used on non-Linux systems
- '${prefix}/lib/systemd' being used where systemd is not found
- '${prefix}/lib/systemd' being used where systemd is installed but 'systemd.pc' or the 'systemduserunitdir' variable are not available
- the 'systemduserunitdir' variable in 'systemd.pc' being used where systemd is installed, and 'systemd.pc' and the variable are available