[libvirt PATCH 132/351] meson: src: build libvirt_rpc static libs

Pavel Hrdina phrdina at redhat.com
Thu Jul 16 09:56:08 UTC 2020


Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 src/Makefile.am         |  10 ----
 src/meson.build         |   1 +
 src/rpc/Makefile.inc.am | 119 ----------------------------------------
 src/rpc/meson.build     | 108 ++++++++++++++++++++++++++++++++++++
 4 files changed, 109 insertions(+), 129 deletions(-)
 delete mode 100644 src/rpc/Makefile.inc.am
 create mode 100644 src/rpc/meson.build

diff --git a/src/Makefile.am b/src/Makefile.am
index 01ae2596c31..ecc757c455a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -76,7 +76,6 @@ include access/Makefile.inc.am
 include logging/Makefile.inc.am
 include locking/Makefile.inc.am
 include admin/Makefile.inc.am
-include rpc/Makefile.inc.am
 include test/Makefile.inc.am
 include hypervisor/Makefile.inc.am
 include esx/Makefile.inc.am
@@ -272,15 +271,6 @@ GENERATED_SYM_FILES += \
 	$(NULL)
 
 
-
-%protocol.c: %protocol.x %protocol.h $(srcdir)/rpc/genprotocol.pl
-	$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/genprotocol.pl $(RPCGEN) -c \
-	       $< $(subst $(srcdir)/,,$@)
-
-%protocol.h: %protocol.x $(srcdir)/rpc/genprotocol.pl
-	$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/genprotocol.pl $(RPCGEN) -h \
-	       $< $(subst $(srcdir)/,,$@)
-
 check-local: check-augeas
 
 check-augeas: $(augeas_DATA) $(augeastest_DATA)
diff --git a/src/meson.build b/src/meson.build
index 34babecd9b0..4a2998f4bfc 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -79,3 +79,4 @@ src_dep = declare_dependency(
 )
 
 subdir('conf')
+subdir('rpc')
diff --git a/src/rpc/Makefile.inc.am b/src/rpc/Makefile.inc.am
deleted file mode 100644
index fe23b17a62b..00000000000
--- a/src/rpc/Makefile.inc.am
+++ /dev/null
@@ -1,119 +0,0 @@
-# vim: filetype=automake
-
-VIR_NET_RPC_GENERATED = \
-	rpc/virnetprotocol.h \
-	rpc/virnetprotocol.c \
-	rpc/virkeepaliveprotocol.h \
-	rpc/virkeepaliveprotocol.c \
-	$(NULL)
-
-noinst_LTLIBRARIES += \
-	libvirt-net-rpc.la \
-	libvirt-net-rpc-server.la \
-	libvirt-net-rpc-client.la \
-	$(NULL)
-
-libvirt_la_BUILT_LIBADD += \
-	libvirt-net-rpc.la \
-	libvirt-net-rpc-server.la \
-	libvirt-net-rpc-client.la \
-	$(NULL)
-
-libvirt_net_rpc_la_SOURCES = \
-	rpc/virnetmessage.h \
-	rpc/virnetmessage.c \
-	rpc/virnettlscontext.h \
-	rpc/virnettlscontext.c \
-	rpc/virnetsocket.h \
-	rpc/virnetsocket.c \
-	rpc/virkeepalive.h \
-	rpc/virkeepalive.c \
-	$(NULL)
-
-nodist_libvirt_net_rpc_la_SOURCES = \
-	$(VIR_NET_RPC_GENERATED) \
-	$(NULL)
-
-if WITH_SSH2
-libvirt_net_rpc_la_SOURCES += \
-	rpc/virnetsshsession.h \
-	rpc/virnetsshsession.c \
-	$(NULL)
-endif ! WITH_SSH2
-
-if WITH_SASL
-libvirt_net_rpc_la_SOURCES += \
-	rpc/virnetsaslcontext.h \
-	rpc/virnetsaslcontext.c \
-	$(NULL)
-endif ! WITH_SASL
-
-if WITH_LIBSSH
-libvirt_net_rpc_la_SOURCES += \
-	rpc/virnetlibsshsession.h \
-	rpc/virnetlibsshsession.c \
-	$(NULL)
-endif ! WITH_LIBSSH
-
-libvirt_net_rpc_la_CFLAGS = \
-	-I$(builddir)/rpc \
-	$(GNUTLS_CFLAGS) \
-	$(SASL_CFLAGS) \
-	$(SSH2_CFLAGS) \
-	$(LIBSSH_CFLAGS) \
-	$(XDR_CFLAGS) \
-	$(AM_CFLAGS) \
-	$(NULL)
-libvirt_net_rpc_la_LDFLAGS = \
-	$(GNUTLS_LIBS) \
-	$(SASL_LIBS) \
-	$(SSH2_LIBS)\
-	$(LIBSSH_LIBS) \
-	$(SECDRIVER_LIBS) \
-	$(AM_LDFLAGS) \
-	$(NULL)
-
-libvirt_net_rpc_server_la_SOURCES = \
-	rpc/virnetserverprogram.h \
-	rpc/virnetserverprogram.c \
-	rpc/virnetserverservice.h \
-	rpc/virnetserverservice.c \
-	rpc/virnetserverclient.h \
-	rpc/virnetserverclient.c \
-	rpc/virnetdaemon.h \
-	rpc/virnetdaemon.c \
-	rpc/virnetserver.h \
-	rpc/virnetserver.c \
-	$(NULL)
-libvirt_net_rpc_server_la_CFLAGS = \
-	-I$(builddir)/rpc \
-	$(DBUS_CFLAGS) \
-	$(XDR_CFLAGS) \
-	$(SASL_CFLAGS) \
-	$(AM_CFLAGS) \
-	$(NULL)
-libvirt_net_rpc_server_la_LDFLAGS = \
-	$(AM_LDFLAGS) \
-	$(DBUS_LIBS) \
-	$(NULL)
-
-libvirt_net_rpc_client_la_SOURCES = \
-	rpc/virnetclientprogram.h \
-	rpc/virnetclientprogram.c \
-	rpc/virnetclientstream.h \
-	rpc/virnetclientstream.c \
-	rpc/virnetclient.h \
-	rpc/virnetclient.c \
-	$(NULL)
-libvirt_net_rpc_client_la_CFLAGS = \
-	-I$(builddir)/rpc \
-	$(AM_CFLAGS) \
-	$(XDR_CFLAGS) \
-	$(NULL)
-libvirt_net_rpc_client_la_LDFLAGS = $(AM_LDFLAGS)
-
-if WITH_SASL
-libvirt_net_rpc_client_la_CFLAGS += \
-	$(SASL_CFLAGS) \
-	$(NULL)
-endif WITH_SASL
diff --git a/src/rpc/meson.build b/src/rpc/meson.build
new file mode 100644
index 00000000000..b26939db9cc
--- /dev/null
+++ b/src/rpc/meson.build
@@ -0,0 +1,108 @@
+genprotocol_prog = find_program('genprotocol.pl')
+
+rpc_sources = [
+  'virnetmessage.c',
+  'virnettlscontext.c',
+  'virnetsocket.c',
+  'virkeepalive.c',
+]
+
+if libssh_dep.found()
+  rpc_sources += 'virnetlibsshsession.c'
+endif
+
+if libssh2_dep.found()
+  rpc_sources += 'virnetsshsession.c'
+endif
+
+if sasl_dep.found()
+  rpc_sources += 'virnetsaslcontext.c'
+endif
+
+rpc_gen_headers = []
+rpc_gen_sources = []
+
+foreach name : [ 'virnet', 'virkeepalive' ]
+  protocol_file = files('@0 at protocol.x'.format(name))
+  header_file = '@0 at protocol.h'.format(name)
+  source_file = '@0 at protocol.c'.format(name)
+
+  rpc_gen_headers += custom_target(
+    header_file,
+    input: protocol_file,
+    output: header_file,
+    command: [
+      genprotocol_prog, rpcgen_prog, '-h', '@INPUT@', '@OUTPUT@',
+    ],
+  )
+
+  rpc_gen_sources += custom_target(
+    source_file,
+    input: protocol_file,
+    output: source_file,
+    command: [
+      genprotocol_prog, rpcgen_prog, '-c', '@INPUT@', '@OUTPUT@',
+    ],
+  )
+endforeach
+
+rpc_server_sources = [
+  'virnetserverprogram.c',
+  'virnetserverservice.c',
+  'virnetserverclient.c',
+  'virnetdaemon.c',
+  'virnetserver.c',
+]
+
+rpc_client_sources = [
+  'virnetclientprogram.c',
+  'virnetclientstream.c',
+  'virnetclient.c',
+]
+
+virt_rpc_lib = static_library(
+  'virt_net_rpc',
+  [
+    rpc_sources,
+    rpc_gen_headers,
+    rpc_gen_sources,
+  ],
+  dependencies: [
+    gnutls_dep,
+    libssh2_dep,
+    libssh_dep,
+    sasl_dep,
+    secdriver_dep,
+    src_dep,
+    xdr_dep,
+  ],
+)
+
+virt_rpc_server_lib = static_library(
+  'virt_net_rpc_server',
+  [
+    rpc_server_sources,
+    rpc_gen_headers,
+  ],
+  dependencies: [
+    dbus_dep,
+    sasl_dep,
+    src_dep,
+    xdr_dep,
+  ],
+)
+
+virt_rpc_client_lib = static_library(
+  'virt_net_rpc_client',
+  [
+    rpc_client_sources,
+    rpc_gen_headers,
+  ],
+  dependencies: [
+    sasl_dep,
+    src_dep,
+    xdr_dep,
+  ],
+)
+
+rpc_inc_dir = include_directories('.')
-- 
2.26.2




More information about the libvir-list mailing list