Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/Makefile.am | 5 --
src/meson.build | 103 +++++++++++++++++++++++++++++++++++++++++
src/remote/meson.build | 26 +++++++++++
3 files changed, 129 insertions(+), 5 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 99bb71e6a03..471ebae2b79 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -69,13 +69,8 @@ include storage/Makefile.inc.am
include remote/Makefile.inc.am
-confdir = $(sysconfdir)/libvirt
conf_DATA += libvirt.conf
-augeasdir = $(datadir)/augeas/lenses
-
-augeastestdir = $(datadir)/augeas/lenses/tests
-
# .libs/libvirt.so is built by libtool as a side-effect of the Makefile
# rule for libvirt.la. However, checking symbols relies on Linux ELF layout
if WITH_LINUX
diff --git a/src/meson.build b/src/meson.build
index bb970f10c61..3a44cd9d663 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -149,6 +149,32 @@ virt_daemons = []
# * install_dir - installation directory (optional, libexecdir)
virt_helpers = []
+# virt_conf_files:
+# libvirt conf files
+virt_conf_files = []
+
+# virt_aug_files:
+# libvirt aug files
+virt_aug_files = []
+
+# virt_test_aug_files:
+# generate libvirt augeas test files
+# * name - augeas test file name (required)
+# * aug - augeas test file source (required)
+# * conf - conf file (required)
+virt_test_aug_files = []
+
+# virt_daemon_confs:
+# generation libvirt daemon conf files
+# each entry is a dictionary with following items:
+# * name - daemon name (required)
+# * name_uc - daemon name with first letter uppercase (required)
+# * with_ip - only for libvirtd and virtproxyd (optional, default false)
+virt_daemon_confs = []
+
+virt_aug_dir = datadir / 'augeas' / 'lenses'
+virt_test_aug_dir = datadir / 'augeas' / 'lenses' / 'tests'
+
# list subdirectories
@@ -547,3 +573,80 @@ foreach helper : virt_helpers
install_rpath: libdir,
)
endforeach
+
+
+# Generate daemon config, augeas and augeas test files
+
+install_data(virt_conf_files, install_dir: confdir)
+install_data(virt_aug_files, install_dir: virt_aug_dir)
+
+foreach data : virt_test_aug_files
+ custom_target(
+ data['name'],
+ input: [ data['conf'], data['aug'] ],
+ output: data['name'],
+ command: [ meson_python_prog, augeas_gentest_prog, '@INPUT@' ],
+ capture: true,
+ install: true,
+ install_dir: virt_test_aug_dir,
+ )
+endforeach
+
+foreach data : virt_daemon_confs
+ daemon_conf = configuration_data()
+ daemon_conf.set('runstatedir', runstatedir)
+ daemon_conf.set('sbindir', sbindir)
+ daemon_conf.set('sysconfdir', sysconfdir)
+ daemon_conf.set('DAEMON_NAME', data['name'])
+ daemon_conf.set('DAEMON_NAME_UC', data['name_uc'])
+ # to silence meson warning about missing 'CONFIG' in the configuration_data
+ daemon_conf.set('CONFIG', '@CONFIG@')
+
+ if data.get('with_ip', false)
+ conf_in = libvirtd_conf_tmp
+ else
+ conf_in = virtd_conf_tmp
+ endif
+ conf_out = configure_file(
+ input: conf_in,
+ output: '@0@.conf'.format(data['name']),
+ configuration: daemon_conf,
+ install: true,
+ install_dir: confdir,
+ )
+
+ if data.get('with_ip', false)
+ aug_in = libvirtd_aug_tmp
+ else
+ aug_in = virtd_aug_tmp
+ endif
+ configure_file(
+ input: aug_in,
+ output: '@0@.aug'.format(data['name']),
+ configuration: daemon_conf,
+ install: true,
+ install_dir: virt_aug_dir,
+ )
+
+ if data.get('with_ip', false)
+ test_aug_in = test_libvirtd_aug_tmp
+ else
+ test_aug_in = test_virtd_aug_tmp
+ endif
+ test_aug_tmp = configure_file(
+ input: test_aug_in,
+ output: 'test_@0@.aug.tmp'.format(data['name']),
+ configuration: daemon_conf,
+ )
+
+ test_aug_out = 'test_@0@.aug'.format(data['name'])
+ custom_target(
+ test_aug_out,
+ input: [ conf_out, test_aug_tmp ],
+ output: test_aug_out,
+ command: [ meson_python_prog, augeas_gentest_prog, '@INPUT@' ],
+ capture: true,
+ install: true,
+ install_dir: virt_test_aug_dir,
+ )
+endforeach
diff --git a/src/remote/meson.build b/src/remote/meson.build
index ee38364868e..6635bcd4cff 100644
--- a/src/remote/meson.build
+++ b/src/remote/meson.build
@@ -63,6 +63,32 @@ foreach name : [ 'remote', 'qemu', 'lxc' ]
)
endforeach
+libvirt_conf_files = [
+ [ 'libvirtd.conf.in', 'libvirtd.conf.tmp', 'virtd.conf.tmp' ],
+ [ 'libvirtd.aug.in', 'libvirtd.aug.tmp', 'virtd.aug.tmp' ],
+ [ 'test_libvirtd.aug.in', 'test_libvirtd.aug.tmp',
'test_virtd.aug.tmp' ],
+]
+
+foreach name : libvirt_conf_files
+ tmp = configure_file(
+ input: name[0],
+ output: name[1],
+ command: [ 'sed', '-e', '/[@]CUT_ENABLE_IP[@]/d',
'-e', '/[@]END[@]/d', '@INPUT@' ],
+ capture: true,
+ )
+ set_variable(name[1].underscorify(), tmp)
+endforeach
+
+foreach name : libvirt_conf_files
+ tmp = configure_file(
+ input: name[0],
+ output: name[2],
+ command: [ 'sed', '-e', '/[@]CUT_ENABLE_IP[@]/,/[@]END[@]/d',
'@INPUT@' ],
+ capture: true,
+ )
+ set_variable(name[2].underscorify(), tmp)
+endforeach
+
if conf.has('WITH_REMOTE')
remote_driver_lib = static_library(
'virt_remote_driver',
--
2.26.2