build: Don't replace prefix in .pc file if relocation is disabled

Replacing the prefix with a path relative to ${pcfiledir} can be harmful
if the number of path components between the prefix and the ${libdir}
is not what we expect, in particular on Debian-derived systems where the
${libdir} is normally lib/x86_64-linux-gnu or similar.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2022-06-27 15:14:18 +01:00
parent 47deeb4a9e
commit abef795081

View file

@ -80,6 +80,9 @@ def post_install_relocation():
#
# TODO: Meson >=0.63 has a new feature, -Dpkgconfig.relocatable=true.
if not relocation:
return
pc_filepath = next(
v for (k,v) in introspection['installed'].items() if k.endswith('.pc')
)