Skip to content

build: Use datarootdir in Meson-generated pkg-config files

Jan Tojnar requested to merge jtojnar/polkit:pc-datarootdir into master

With datadir outside of prefix (currently unsupported by Meson¹ but a frequent occurrence in Nixpkgs), the datadir entry, in the polkit-gobject-1 pkg-config file will be an absolute path. This will prevent changing the base directory of policydir with --define-variable=prefix=…, which many projects use to install policy files to their own prefix.

Previously, this worked without changes on Nixpkgs’s part because the pkg-config template used by Autotools contained @datarootdir@, which resolves to $(prefix)/share², taking no heed of the changed datadir.

Similar issue can happen when a distribution package redefines datadir like Debian does/did: https://blogs.gnome.org/hughsie/2014/06/16/datarootdir-v-s-datadir/

This patch changes Meson-based build system to use $(prefix)/share in the generated pkg-config files, mirroring Autotools.


  1. Likely to change in the future: https://github.com/mesonbuild/meson/issues/2561#issuecomment-939253717
  2. https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
Edited by Jan Tojnar

Merge request reports