1 From 7ba07551dfcd4ef9a87b8f0d9eb8b91fabcb41b3 Mon Sep 17 00:00:00 2001
2 From: Jan Tojnar <jtojnar@gmail.com>
3 Date: Mon, 1 Nov 2021 14:17:17 +0100
4 Subject: [PATCH] build: Use datarootdir in Meson-generated pkg-config files
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 With datadir outside of prefix (currently unsupported by Meson[1]
10 but a frequent occurrence in Nixpkgs), the `datadir` entry,
11 in the `polkit-gobject-1` pkg-config file will be an absolute path.
12 This will prevent changing the base directory of `policydir`
13 with `--define-variable=prefix=…`, which many projects use
14 to install policy files to their own prefix.
16 Previously, this worked without changes on Nixpkgs’s part because
17 the pkg-config template used by Autotools contained `@datarootdir@`,
18 which resolves to `$(prefix)/share`[2], taking no heed of the changed datadir.
20 Similar issue can happen when a distribution package redefines datadir
21 like Debian does/did.[3]
23 This patch changes Meson-based build system to use `$(prefix)/share`
24 in the generated pkg-config files, mirroring Autotools.
28 1. Likely to change in the future: https://github.com/mesonbuild/meson/issues/2561#issuecomment-939253717
29 2. https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
30 3. https://blogs.gnome.org/hughsie/2014/06/16/datarootdir-v-s-datadir/
32 src/polkit/meson.build | 5 ++---
33 1 file changed, 2 insertions(+), 3 deletions(-)
35 diff --git a/src/polkit/meson.build b/src/polkit/meson.build
36 index 63dc1e85..c92cb70f 100644
37 --- a/src/polkit/meson.build
38 +++ b/src/polkit/meson.build
39 @@ -113,9 +113,8 @@ pkg.generate(
40 requires: common_deps,
42 'exec_prefix=${prefix}',
43 - 'datadir=' + ('${prefix}' / pk_datadir),
44 - 'policydir=' + ('${datadir}' / pk_actiondir),
45 - 'actiondir=' + ('${datadir}' / pk_actiondir),
46 + 'policydir=' + ('${prefix}' / 'share' / pk_actiondir),
47 + 'actiondir=' + ('${prefix}' / 'share' / pk_actiondir),
48 'pkcheck_supports_uid=true',