From 14fd1a329a5825230fce4c586b0c267ddb9b80de Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Tue, 20 Oct 2020 08:23:58 -0400 Subject: pkgconfig: Define libdir and includedir in -uninstalled.pc files This fixes glib-2.0-uninstalled.pc file. GLib does `extra_cflags : ['-I${libdir}/glib-2.0/include']` because some of its headers gets installed there. But when used uninstalled that path makes no sense and pkg-config aborts because ${libdir} is not defined. This cannot be worked around by GLib because Meson does not allow setting different `extra_cflags` for -uninstalled.pc, and does not allow setting libdir in `uninstalled_variables`. --- mesonbuild/modules/pkgconfig.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'mesonbuild') diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py index 968e1ee..a863b33 100644 --- a/mesonbuild/modules/pkgconfig.py +++ b/mesonbuild/modules/pkgconfig.py @@ -329,18 +329,17 @@ class PkgConfigModule(ExtensionModule): else: outdir = state.environment.scratch_dir prefix = PurePath(coredata.get_builtin_option('prefix')) - # These always return paths relative to prefix - libdir = PurePath(coredata.get_builtin_option('libdir')) - incdir = PurePath(coredata.get_builtin_option('includedir')) + # These always return paths relative to prefix + libdir = PurePath(coredata.get_builtin_option('libdir')) + incdir = PurePath(coredata.get_builtin_option('includedir')) fname = os.path.join(outdir, pcfile) with open(fname, 'w', encoding='utf-8') as ofile: if not dataonly: ofile.write('prefix={}\n'.format(self._escape(prefix))) if uninstalled: ofile.write('srcdir={}\n'.format(self._escape(srcdir))) - else: - ofile.write('libdir={}\n'.format(self._escape('${prefix}' / libdir))) - ofile.write('includedir={}\n'.format(self._escape('${prefix}' / incdir))) + ofile.write('libdir={}\n'.format(self._escape('${prefix}' / libdir))) + ofile.write('includedir={}\n'.format(self._escape('${prefix}' / incdir))) if variables: ofile.write('\n') for k, v in variables: -- cgit v1.1