Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/access/Makefile.inc.am | 75 --------------------------------------
src/access/meson.build | 72 ++++++++++++++++++++++++++++++++++++
src/meson.build | 1 +
src/rpc/meson.build | 1 +
4 files changed, 74 insertions(+), 75 deletions(-)
create mode 100644 src/access/meson.build
diff --git a/src/access/Makefile.inc.am b/src/access/Makefile.inc.am
index d58d5166bef..da9b5ef31b3 100644
--- a/src/access/Makefile.inc.am
+++ b/src/access/Makefile.inc.am
@@ -1,14 +1,5 @@
# vim: filetype=automake
-ACCESS_DRIVER_GENERATED = \
- access/viraccessapicheck.h \
- access/viraccessapicheck.c \
- access/viraccessapicheckqemu.h \
- access/viraccessapicheckqemu.c \
- access/viraccessapichecklxc.h \
- access/viraccessapichecklxc.c \
- $(NULL)
-
ACCESS_DRIVER_SYM_FILES = \
libvirt_access.syms \
libvirt_access_qemu.syms \
@@ -21,44 +12,11 @@ ACCESS_DRIVER_API_FILES = \
libvirt_access_lxc.xml \
$(NULL)
-ACCESS_DRIVER_SOURCES = \
- access/viraccessperm.h \
- access/viraccessperm.c \
- access/viraccessmanager.h \
- access/viraccessmanager.c \
- access/viraccessdriver.h \
- access/viraccessdrivernop.h \
- access/viraccessdrivernop.c \
- access/viraccessdriverstack.h \
- access/viraccessdriverstack.c \
- $(NULL)
-
-ACCESS_DRIVER_POLKIT_SOURCES = \
- access/viraccessdriverpolkit.h \
- access/viraccessdriverpolkit.c \
- $(NULL)
-
ACCESS_DRIVER_POLKIT_POLICY = access/org.libvirt.api.policy
GENERATED_SYM_FILES += $(ACCESS_DRIVER_SYM_FILES)
-libvirt_driver_access_la_SOURCES = \
- $(ACCESS_DRIVER_SOURCES) \
- $(NULL)
-nodist_libvirt_driver_access_la_SOURCES = \
- $(ACCESS_DRIVER_GENERATED) \
- $(NULL)
-noinst_LTLIBRARIES += libvirt_driver_access.la
libvirt_la_BUILT_LIBADD += libvirt_driver_access.la
-libvirt_driver_access_la_CFLAGS = \
- -I$(srcdir)/conf \
- $(AM_CFLAGS) \
- $(NULL)
-libvirt_driver_access_la_LDFLAGS = $(AM_LDFLAGS)
-libvirt_driver_access_la_LIBADD = \
- $(GLIB_LIBS) \
- $(NULL)
-
$(ACCESS_DRIVER_POLKIT_POLICY): $(srcdir)/access/viraccessperm.h \
$(top_srcdir)/scripts/genpolkit.py Makefile.am
@@ -66,7 +24,6 @@ $(ACCESS_DRIVER_POLKIT_POLICY): $(srcdir)/access/viraccessperm.h \
$(top_srcdir)/scripts/genpolkit.py $< > $@ || rm -f $@
if WITH_POLKIT
-libvirt_driver_access_la_SOURCES += $(ACCESS_DRIVER_POLKIT_SOURCES)
polkitactiondir = $(datadir)/polkit-1/actions
if WITH_LIBVIRTD
@@ -101,35 +58,3 @@ libvirt_access_lxc.xml: $(srcdir)/rpc/gendispatch.pl \
$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclapi \
lxc LXC $(LXC_PROTOCOL) > $@
-access/viraccessapicheck.h: $(srcdir)/rpc/gendispatch.pl \
- $(REMOTE_PROTOCOL) Makefile.am
- $(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclheader \
- remote REMOTE $(REMOTE_PROTOCOL) \
- > access/viraccessapicheck.h
-access/viraccessapicheck.c: $(srcdir)/rpc/gendispatch.pl \
- $(REMOTE_PROTOCOL) Makefile.am
- $(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclbody \
- remote REMOTE $(REMOTE_PROTOCOL) access/viraccessapicheck.h \
- > access/viraccessapicheck.c
-
-access/viraccessapicheckqemu.h: $(srcdir)/rpc/gendispatch.pl \
- $(QEMU_PROTOCOL) Makefile.am
- $(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclheader \
- qemu QEMU $(QEMU_PROTOCOL) \
- > access/viraccessapicheckqemu.h
-access/viraccessapicheckqemu.c: $(srcdir)/rpc/gendispatch.pl \
- $(QEMU_PROTOCOL) Makefile.am
- $(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclbody \
- qemu QEMU $(QEMU_PROTOCOL) access/viraccessapicheckqemu.h \
- > access/viraccessapicheckqemu.c
-
-access/viraccessapichecklxc.h: $(srcdir)/rpc/gendispatch.pl \
- $(LXC_PROTOCOL) Makefile.am
- $(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclheader \
- lxc LXC $(LXC_PROTOCOL) \
- > access/viraccessapichecklxc.h
-access/viraccessapichecklxc.c: $(srcdir)/rpc/gendispatch.pl \
- $(LXC_PROTOCOL) Makefile.am
- $(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclbody \
- lxc LXC $(LXC_PROTOCOL) access/viraccessapichecklxc.h \
- > access/viraccessapichecklxc.c
diff --git a/src/access/meson.build b/src/access/meson.build
new file mode 100644
index 00000000000..c5784fa4a98
--- /dev/null
+++ b/src/access/meson.build
@@ -0,0 +1,72 @@
+access_sources = [
+ 'viraccessperm.c',
+ 'viraccessmanager.c',
+ 'viraccessdrivernop.c',
+ 'viraccessdriverstack.c',
+]
+
+access_polkit_sources = [
+ 'viraccessdriverpolkit.c',
+]
+
+remote_path = meson.source_root() / 'src' / 'remote'
+
+access_gen_headers = []
+access_gen_sources = []
+
+foreach name : [ 'remote', 'qemu', 'lxc' ]
+ if name == 'remote'
+ header_file = 'viraccessapicheck.h'
+ source_file = 'viraccessapicheck.c'
+ else
+ header_file = 'viraccessapicheck@0@.h'.format(name)
+ source_file = 'viraccessapicheck@0@.c'.format(name)
+ endif
+ protocol_file = remote_path / '@0(a)_protocol.x'.format(name)
+
+ access_gen_headers += custom_target(
+ header_file,
+ output: header_file,
+ command: [
+ gendispatch_prog, '--mode=aclheader', name, name.to_upper(),
protocol_file,
+ ],
+ capture: true,
+ )
+
+ access_gen_sources += custom_target(
+ source_file,
+ output: source_file,
+ command: [
+ gendispatch_prog, '--mode=aclbody', name, name.to_upper(),
+ protocol_file, header_file,
+ ],
+ capture: true,
+ )
+endforeach
+
+if conf.has('WITH_POLKIT')
+ access_sources += access_polkit_sources
+endif
+
+virt_access_lib = static_library(
+ 'virt_access',
+ [
+ access_sources,
+ access_gen_headers,
+ access_gen_sources,
+ ],
+ dependencies: [
+ src_dep,
+ ],
+ include_directories: [
+ conf_inc_dir,
+ ]
+)
+
+access_inc_dir = include_directories('.')
+
+# Used by others where generated headers are required
+access_dep = declare_dependency(
+ include_directories: access_inc_dir,
+ sources: access_gen_headers,
+)
diff --git a/src/meson.build b/src/meson.build
index 4a2998f4bfc..c7993517760 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -80,3 +80,4 @@ src_dep = declare_dependency(
subdir('conf')
subdir('rpc')
+subdir('access')
diff --git a/src/rpc/meson.build b/src/rpc/meson.build
index b26939db9cc..f6e8c7adba5 100644
--- a/src/rpc/meson.build
+++ b/src/rpc/meson.build
@@ -1,4 +1,5 @@
genprotocol_prog = find_program('genprotocol.pl')
+gendispatch_prog = find_program('gendispatch.pl')
rpc_sources = [
'virnetmessage.c',
--
2.26.2