* systemd.pc: Keep support for rootprefix and root_prefix
We dropped support for split-usr in https://github.com/systemd/systemd/commit/
b0d3095fd6cc1791a38f57a1982116b4475244ba
but kept the `rootprefix` variable in meson but ignore it to make sure we do
not break downstream builds that depend on systemd.
This is fine because we had logic in our meson.build that rootprefix and prefix need to be the
same when split-usr=false.
However we never had this logic in our systemd.pc.in file. This leads to a nasty breaking problem
downstream. Many packages [0,1,2] (there might be more!) rely on overriding rootprefix or root_prefix when calling pkg-config to configure where
to install systemd units. This is because before split-usr we installed units in rootprefix. Setting prefix
on the pkg-config file didn't work. Even when split-usr=false people had to set rootprefix to install units
in the right position.
E.g. they have a line like:
systemdunitdir = systemd.get_variable(pkgconfig: 'systemdsystemunitdir', pkgconfig_define: ['rootprefix', systemd_root_prefix])
With https://github.com/systemd/systemd/commit/
b0d3095fd6cc1791a38f57a1982116b4475244ba landing
This would mean all these downstream packages need to be patched to use `prefix` next to `rootprefix`.
(Both need to be kept to keep backwards compat with using older versions of systemd).
This puts a big burden on downstream packages.
Instead we should not break the existing behaviour and keep the old behaviour of systemd.pc.in around.
I've changed systemd.pc.in such that either setting prefix, rootprefix or root_prefix will all have
the same effect. This way we do not break any downstream packages.
- [0](https://github.com/fwupd/fwupd/blob/
caa788b37ff34334d83debb047335fd12f3a7836/meson.build#L464)
- [1](https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blame/main/meson.build#L204)
- [2](https://github.com/PipeWire/pipewire/blob/
49cdb468c28ba366dbd08eef9cb6dbf2dea2a2e5/src/daemon/systemd/system/meson.build#L1)
# considered deprecated (though there is no plan to remove them). New names
# shall have underscores.
-prefix={{PREFIX_NOSLASH}}
-root_prefix=${prefix}
-rootprefix=${prefix}
+# root_prefix and rootprefix are deprecated since we dropped support for split-usr
+# however we used to install units in root_prefix and a lot of downstream software
+# overrode this variable in their build system to support installing units elsewhere.
+# To stop those builds from silently breaking we keep root_prefix around but have
+# it as an alias for prefix
+root_prefix={{PREFIX_NOSLASH}}
+rootprefix=${root_prefix}
+prefix=${rootprefix}
sysconf_dir={{SYSCONF_DIR}}
sysconfdir=${sysconf_dir}