Skip to content

Commit

Permalink
pkgconfig: Define libdir and includedir in -uninstalled.pc files
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
xclaesse authored and jpakkane committed Oct 21, 2020
1 parent bf5bcad commit 14fd1a3
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions mesonbuild/modules/pkgconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,18 +329,17 @@ def generate_pkgconfig_file(self, state, deps, subdirs, name, description,
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:
Expand Down

0 comments on commit 14fd1a3

Please sign in to comment.