Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/Makefile.am | 5 -
src/meson.build | 10 ++
src/util/Makefile.inc.am | 307 ---------------------------------------
src/util/meson.build | 196 +++++++++++++++++++++++++
4 files changed, 206 insertions(+), 312 deletions(-)
create mode 100644 src/util/meson.build
diff --git a/src/Makefile.am b/src/Makefile.am
index 4c0ef6283a0..e533e27b344 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -19,11 +19,6 @@
# No libraries with the exception of LIBXML should be listed
# here. List them against the individual XXX_la_CFLAGS targets
# that actually use them.
-AM_CPPFLAGS = \
- -I$(srcdir)/util \
- -I./util \
- $(NULL)
-
AM_LDFLAGS_MOD = \
-module \
-avoid-version \
diff --git a/src/meson.build b/src/meson.build
index 9796d344b4a..9f3dd9fca8f 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -67,3 +67,13 @@ if conf.has('WITH_DTRACE_PROBES')
install_dir: systemtap_dir,
)
endif
+
+
+# list subdirectories
+
+subdir('util')
+
+src_dep = declare_dependency(
+ dependencies: [ src_dep ],
+ include_directories: [ util_inc_dir ],
+)
diff --git a/src/util/Makefile.inc.am b/src/util/Makefile.inc.am
index ca25f983090..879b3d9e398 100644
--- a/src/util/Makefile.inc.am
+++ b/src/util/Makefile.inc.am
@@ -1,310 +1,3 @@
# vim: filetype=automake
-# These files are not related to driver APIs. Simply generic
-# helper APIs for various purposes
-UTIL_SOURCES = \
- util/glibcompat.c \
- util/glibcompat.h \
- util/viralloc.c \
- util/viralloc.h \
- util/virarch.c \
- util/virarch.h \
- util/virarptable.c \
- util/virarptable.h \
- util/viraudit.c \
- util/viraudit.h \
- util/virauth.c \
- util/virauth.h \
- util/virauthconfig.c \
- util/virauthconfig.h \
- util/virbitmap.c \
- util/virbitmap.h \
- util/virbpf.c \
- util/virbpf.h \
- util/virbuffer.c \
- util/virbuffer.h \
- util/virperf.c \
- util/virperf.h \
- util/vircgroup.c \
- util/vircgroup.h util/vircgrouppriv.h \
- util/vircgroupbackend.c \
- util/vircgroupbackend.h \
- util/vircgroupv1.c \
- util/vircgroupv1.h \
- util/vircgroupv2.c \
- util/vircgroupv2.h \
- util/vircgroupv2devices.c \
- util/vircgroupv2devices.h \
- util/vircommand.c \
- util/vircommand.h \
- util/vircommandpriv.h \
- util/virconf.c \
- util/virconf.h \
- util/vircrypto.c \
- util/vircrypto.h \
- util/virdaemon.c \
- util/virdaemon.h \
- util/virdbus.c \
- util/virdbus.h \
- util/virdbuspriv.h \
- util/virdevmapper.c \
- util/virdevmapper.h \
- util/virdnsmasq.c \
- util/virdnsmasq.h \
- util/virebtables.c \
- util/virebtables.h \
- util/virendian.h \
- util/virenum.h \
- util/virenum.c \
- util/virerror.c \
- util/virerror.h \
- util/virerrorpriv.h \
- util/virevent.c \
- util/virevent.h \
- util/vireventglib.c \
- util/vireventglib.h \
- util/vireventglibwatch.c \
- util/vireventglibwatch.h \
- util/vireventthread.c \
- util/vireventthread.h \
- util/virfcp.c \
- util/virfcp.h \
- util/virfdstream.c \
- util/virfdstream.h \
- util/virfile.c \
- util/virfile.h \
- util/virfirewall.c \
- util/virfirewall.h \
- util/virfirewallpriv.h \
- util/virfirewalld.c \
- util/virfirewalld.h \
- util/virfirewalldpriv.h \
- util/virfirmware.c \
- util/virfirmware.h \
- util/virgettext.c \
- util/virgettext.h \
- util/virgic.c \
- util/virgic.h \
- util/virhash.c \
- util/virhash.h \
- util/virhashcode.c \
- util/virhashcode.h \
- util/virhook.c \
- util/virhook.h \
- util/virhostcpu.c \
- util/virhostcpu.h \
- util/virhostcpupriv.h \
- util/virhostmem.c \
- util/virhostmem.h \
- util/virhostuptime.c \
- util/virhostuptime.h \
- util/viridentity.c \
- util/viridentity.h \
- util/virinitctl.c \
- util/virinitctl.h \
- util/viriptables.c \
- util/viriptables.h \
- util/viriscsi.c \
- util/viriscsi.h \
- util/virjson.c \
- util/virjson.h \
- util/virkeycode.c \
- util/virkeycode.h \
- util/virlease.c \
- util/virlease.h \
- util/virlockspace.c \
- util/virlockspace.h \
- util/virlog.c \
- util/virlog.h \
- util/virmacaddr.c \
- util/virmacaddr.h \
- util/virmacmap.c \
- util/virmacmap.h \
- util/virmodule.c \
- util/virmodule.h \
- util/virnetdev.c \
- util/virnetdev.h \
- util/virnetdevbandwidth.c \
- util/virnetdevbandwidth.h \
- util/virnetdevbridge.c \
- util/virnetdevbridge.h \
- util/virnetdevip.c \
- util/virnetdevip.h \
- util/virnetdevmacvlan.c \
- util/virnetdevmacvlan.h \
- util/virnetdevmidonet.c \
- util/virnetdevmidonet.h \
- util/virnetdevopenvswitch.c \
- util/virnetdevopenvswitch.h \
- util/virnetdevtap.c \
- util/virnetdevtap.h \
- util/virnetdevveth.c \
- util/virnetdevveth.h \
- util/virnetdevvlan.c \
- util/virnetdevvlan.h \
- util/virnetdevvportprofile.c \
- util/virnetdevvportprofile.h \
- util/virnetlink.c \
- util/virnetlink.h \
- util/virnodesuspend.c \
- util/virnodesuspend.h \
- util/virnvme.c \
- util/virnvme.h \
- util/virkmod.c \
- util/virkmod.h \
- util/virnuma.c \
- util/virnuma.h \
- util/virobject.c \
- util/virobject.h \
- util/virpci.c \
- util/virpci.h \
- util/virpidfile.c \
- util/virpidfile.h \
- util/virpolkit.c \
- util/virpolkit.h \
- util/virportallocator.c \
- util/virportallocator.h \
- util/virprobe.h \
- util/virprocess.c \
- util/virprocess.h \
- util/virqemu.c \
- util/virqemu.h \
- util/virrandom.c \
- util/virrandom.h \
- util/virresctrl.c \
- util/virresctrl.h \
- util/virresctrlpriv.h \
- util/virrotatingfile.c \
- util/virrotatingfile.h \
- util/virscsi.c \
- util/virscsi.h \
- util/virscsihost.c \
- util/virscsihost.h \
- util/virscsivhost.c \
- util/virscsivhost.h \
- util/virseclabel.c \
- util/virseclabel.h \
- util/virsecret.c \
- util/virsecret.h \
- util/virsocket.c \
- util/virsocket.h \
- util/virsocketaddr.c \
- util/virsocketaddr.h \
- util/virstorageencryption.c \
- util/virstorageencryption.h \
- util/virstoragefile.c \
- util/virstoragefile.h \
- util/virstoragefilebackend.c \
- util/virstoragefilebackend.h \
- util/virstring.c \
- util/virstring.h \
- util/virsysinfo.c \
- util/virsysinfo.h \
- util/virsysinfopriv.h \
- util/virsystemd.c \
- util/virsystemd.h \
- util/virsystemdpriv.h \
- util/virthread.c \
- util/virthread.h \
- util/virthreadjob.c \
- util/virthreadjob.h \
- util/virthreadpool.c \
- util/virthreadpool.h \
- util/virtime.c \
- util/virtime.h \
- util/virtpm.c \
- util/virtpm.h \
- util/virtypedparam-public.c \
- util/virtypedparam.c \
- util/virtypedparam.h \
- util/virusb.c \
- util/virusb.h \
- util/viruri.c \
- util/viruri.h \
- util/virutil.c \
- util/virutil.h \
- util/viruuid.c \
- util/viruuid.h \
- util/virvhba.c \
- util/virvhba.h \
- util/virvsock.c \
- util/virvsock.h \
- util/virxdrdefs.h \
- util/virxml.c \
- util/virxml.h \
- util/virmdev.c \
- util/virmdev.h \
- util/virfilecache.c \
- util/virfilecache.h \
- $(NULL)
-
-
-# Sync with docs/
-KEYCODES = linux osx atset1 atset2 atset3 xtkbd usb win32 qnum
-KEYNAMES = linux osx win32
-
-KEYTABLES = \
- $(KEYCODES:%=util/virkeycodetable_%.h) \
- $(KEYNAMES:%=util/virkeynametable_%.h) \
- $(NULL)
-
UTIL_IO_HELPER_SOURCES = util/iohelper.c
-
-noinst_LTLIBRARIES += libvirt_util.la
-libvirt_la_LIBADD = $(libvirt_la_BUILT_LIBADD)
-libvirt_la_BUILT_LIBADD += libvirt_util.la
-libvirt_util_la_SOURCES = \
- $(UTIL_SOURCES) \
- $(NULL)
-nodist_libvirt_util_la_SOURCES = \
- $(KEYTABLES) \
- $(NULL)
-libvirt_util_la_CFLAGS = \
- $(CAPNG_CFLAGS) \
- $(YAJL_CFLAGS) \
- $(LIBNL_CFLAGS) \
- $(AM_CFLAGS) \
- $(AUDIT_CFLAGS) \
- $(DEVMAPPER_CFLAGS) \
- $(DBUS_CFLAGS) \
- $(NUMACTL_CFLAGS) \
- $(GNUTLS_CFLAGS) \
- $(ACL_CFLAGS) \
- $(NULL)
-libvirt_util_la_LIBADD = \
- -lm \
- $(CAPNG_LIBS) \
- $(YAJL_LIBS) \
- $(LIBNL_LIBS) \
- $(THREAD_LIBS) \
- $(AUDIT_LIBS) \
- $(DEVMAPPER_LIBS) \
- $(DBUS_LIBS) \
- $(WIN32_EXTRA_LIBS) \
- $(LIBXML_LIBS) \
- $(SECDRIVER_LIBS) \
- $(NUMACTL_LIBS) \
- $(ACL_LIBS) \
- $(GNUTLS_LIBS) \
- $(NULL)
-
-
-util/virkeycodetable_%.h: $(srcdir)/keycodemapdb/data/keymaps.csv \
- $(srcdir)/keycodemapdb/tools/keymap-gen Makefile.am
- $(AM_V_GEN)export NAME=`echo $@ | sed -e 's,util/virkeycodetable_,,' \
- -e 's,\.h,,'` && \
- $(MKDIR_P) util/ && \
- $(RUNUTF8) $(PYTHON) $(srcdir)/keycodemapdb/tools/keymap-gen \
- code-table --lang stdc --varname virKeyCodeTable_$$NAME \
- $(srcdir)/keycodemapdb/data/keymaps.csv $$NAME > $@-tmp && \
- mv $@-tmp $@ || rm -f $@-tmp
-
-util/virkeynametable_%.h: $(srcdir)/keycodemapdb/data/keymaps.csv \
- $(srcdir)/keycodemapdb/tools/keymap-gen Makefile.am
- $(AM_V_GEN)export NAME=`echo $@ | sed -e 's,util/virkeynametable_,,' \
- -e 's,\.h,,'` && \
- $(MKDIR_P) util/ && \
- $(RUNUTF8) $(PYTHON) $(srcdir)/keycodemapdb/tools/keymap-gen \
- name-table --lang stdc --varname virKeyNameTable_$$NAME \
- $(srcdir)/keycodemapdb/data/keymaps.csv $$NAME > $@-tmp && \
- mv $@-tmp $@ || rm -f $@-tmp
diff --git a/src/util/meson.build b/src/util/meson.build
new file mode 100644
index 00000000000..59a531f6af1
--- /dev/null
+++ b/src/util/meson.build
@@ -0,0 +1,196 @@
+util_sources = [
+ 'glibcompat.c',
+ 'viralloc.c',
+ 'virarch.c',
+ 'virarptable.c',
+ 'viraudit.c',
+ 'virauth.c',
+ 'virauthconfig.c',
+ 'virbitmap.c',
+ 'virbpf.c',
+ 'virbuffer.c',
+ 'vircgroup.c',
+ 'vircgroupbackend.c',
+ 'vircgroupv1.c',
+ 'vircgroupv2.c',
+ 'vircgroupv2devices.c',
+ 'vircommand.c',
+ 'virconf.c',
+ 'vircrypto.c',
+ 'virdaemon.c',
+ 'virdbus.c',
+ 'virdevmapper.c',
+ 'virdnsmasq.c',
+ 'virebtables.c',
+ 'virenum.c',
+ 'vireventglib.c',
+ 'vireventglibwatch.c',
+ 'vireventthread.c',
+ 'virfcp.c',
+ 'virfdstream.c',
+ 'virfile.c',
+ 'virfilecache.c',
+ 'virfirewall.c',
+ 'virfirewalld.c',
+ 'virfirmware.c',
+ 'virgettext.c',
+ 'virgic.c',
+ 'virhash.c',
+ 'virhashcode.c',
+ 'virhook.c',
+ 'virhostcpu.c',
+ 'virhostmem.c',
+ 'virhostuptime.c',
+ 'viridentity.c',
+ 'virinitctl.c',
+ 'viriptables.c',
+ 'viriscsi.c',
+ 'virjson.c',
+ 'virkeycode.c',
+ 'virkmod.c',
+ 'virlease.c',
+ 'virlockspace.c',
+ 'virlog.c',
+ 'virmacaddr.c',
+ 'virmacmap.c',
+ 'virmdev.c',
+ 'virmodule.c',
+ 'virnetdev.c',
+ 'virnetdevbandwidth.c',
+ 'virnetdevbridge.c',
+ 'virnetdevip.c',
+ 'virnetdevmacvlan.c',
+ 'virnetdevmidonet.c',
+ 'virnetdevopenvswitch.c',
+ 'virnetdevtap.c',
+ 'virnetdevveth.c',
+ 'virnetdevvlan.c',
+ 'virnetdevvportprofile.c',
+ 'virnetlink.c',
+ 'virnodesuspend.c',
+ 'virnuma.c',
+ 'virnvme.c',
+ 'virobject.c',
+ 'virpci.c',
+ 'virperf.c',
+ 'virpidfile.c',
+ 'virpolkit.c',
+ 'virportallocator.c',
+ 'virprocess.c',
+ 'virqemu.c',
+ 'virrandom.c',
+ 'virresctrl.c',
+ 'virrotatingfile.c',
+ 'virscsi.c',
+ 'virscsihost.c',
+ 'virscsivhost.c',
+ 'virseclabel.c',
+ 'virsecret.c',
+ 'virsocket.c',
+ 'virsocketaddr.c',
+ 'virstorageencryption.c',
+ 'virstoragefile.c',
+ 'virstoragefilebackend.c',
+ 'virstring.c',
+ 'virsysinfo.c',
+ 'virsystemd.c',
+ 'virthread.c',
+ 'virthreadjob.c',
+ 'virthreadpool.c',
+ 'virtime.c',
+ 'virtpm.c',
+ 'virtypedparam.c',
+ 'viruri.c',
+ 'virusb.c',
+ 'virutil.c',
+ 'viruuid.c',
+ 'virvhba.c',
+ 'virvsock.c',
+ 'virxml.c',
+]
+
+util_public_sources = files(
+ 'virerror.c',
+ 'virevent.c',
+ 'virtypedparam-public.c',
+)
+
+keycode_gen_sources = []
+
+keycode_list = [
+ 'atset1',
+ 'atset2',
+ 'atset3',
+ 'linux',
+ 'osx',
+ 'qnum',
+ 'usb',
+ 'win32',
+ 'xtkbd',
+]
+
+keyname_list = [
+ 'linux',
+ 'osx',
+ 'win32',
+]
+
+keymap_gen_prog =
find_program('@0(a)/src/keycodemapdb/tools/keymap-gen'.format(meson.source_root()))
+keymap_src_file =
'@0(a)/src/keycodemapdb/data/keymaps.csv'.format(meson.source_root())
+
+foreach name : keycode_list
+ keycode_gen_sources += custom_target(
+ 'virt_keycode_@0(a)'.format(name),
+ input: keymap_src_file,
+ output: 'virkeycodetable_@0@.h'.format(name),
+ command: [
+ meson_python_prog, python3_prog, keymap_gen_prog, 'code-table',
+ '--lang', 'stdc',
+ '--varname', 'virKeyCodeTable_@0(a)'.format(name),
+ '@INPUT@', name,
+ ],
+ capture: true,
+ )
+endforeach
+
+foreach name : keyname_list
+ keycode_gen_sources += custom_target(
+ 'keyname_@0(a)'.format(name),
+ input: keymap_src_file,
+ output: 'virkeynametable_@0@.h'.format(name),
+ command: [
+ meson_python_prog, python3_prog, keymap_gen_prog, 'name-table',
+ '--lang', 'stdc',
+ '--varname', 'virKeyNameTable_@0(a)'.format(name),
+ '@INPUT@', name,
+ ],
+ capture: true,
+ )
+endforeach
+
+virt_util_lib = static_library(
+ 'virt_util',
+ [
+ util_sources,
+ util_public_sources,
+ keycode_gen_sources,
+ dtrace_gen_headers,
+ ],
+ dependencies: [
+ acl_dep,
+ audit_dep,
+ capng_dep,
+ dbus_dep,
+ devmapper_dep,
+ gnutls_dep,
+ libnl_dep,
+ numactl_dep,
+ secdriver_dep,
+ src_dep,
+ thread_dep,
+ win32_dep,
+ yajl_dep,
+ ],
+)
+
+util_inc_dir = include_directories('.')
--
2.26.2