Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
Makefile.am | 3 ---
configure.ac | 4 ----
meson.build | 29 +++++++++++++++++++++++++++++
3 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index d538d037eb0..e6a37deb4a5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -25,9 +25,6 @@ SUBDIRS = .
XZ_OPT ?= -v -T0
export XZ_OPT
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libvirt.pc libvirt-qemu.pc libvirt-lxc.pc libvirt-admin.pc
-
rpm: clean
@(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.xz)
diff --git a/configure.ac b/configure.ac
index 06e7f7491e4..b0a6cad178a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -109,9 +109,5 @@ AC_CONFIG_FILES([\
Makefile \
.color_coded \
.ycm_extra_conf.py \
- libvirt.pc \
- libvirt-qemu.pc \
- libvirt-lxc.pc \
- libvirt-admin.pc \
libvirt.spec mingw-libvirt.spec])
AC_OUTPUT
diff --git a/meson.build b/meson.build
index 65843ed574d..7b858797388 100644
--- a/meson.build
+++ b/meson.build
@@ -2214,6 +2214,35 @@ subdir('po')
subdir('docs')
+# install pkgconfig files
+pkgconfig_files = [
+ 'libvirt.pc.in',
+ 'libvirt-qemu.pc.in',
+ 'libvirt-lxc.pc.in',
+ 'libvirt-admin.pc.in',
+]
+
+pkgconfig_conf = configuration_data()
+pkgconfig_conf.set('VERSION', meson.project_version())
+pkgconfig_conf.set('datadir', datadir)
+pkgconfig_conf.set('datarootdir', datadir)
+pkgconfig_conf.set('exec_prefix', prefix)
+pkgconfig_conf.set('includedir', includedir)
+pkgconfig_conf.set('libdir', libdir)
+pkgconfig_conf.set('prefix', prefix)
+
+pkgconfig_dir = libdir / 'pkgconfig'
+
+foreach file : pkgconfig_files
+ configure_file(
+ input: file,
+ output: '@BASENAME@',
+ configuration: pkgconfig_conf,
+ install: true,
+ install_dir: pkgconfig_dir,
+ )
+endforeach
+
# generate meson-config.h file
configure_file(output: 'meson-config.h', configuration: conf)
--
2.26.2