[libvirt PATCH 197/351] meson: src: add support for building daemon binaries

Pavel Hrdina posted 351 patches 5 years, 6 months ago
There is a newer version of this series
[libvirt PATCH 197/351] meson: src: add support for building daemon binaries
Posted by Pavel Hrdina 5 years, 6 months ago
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 src/meson.build            | 51 ++++++++++++++++++++++++++++++++++++++
 src/remote/Makefile.inc.am | 41 ------------------------------
 2 files changed, 51 insertions(+), 41 deletions(-)

diff --git a/src/meson.build b/src/meson.build
index 13f231f4345..3774e2bb4ba 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -131,6 +131,14 @@ libvirt_libs = []
 #   * install_dir - installation directory (optional, default libdir / 'libvirt' / 'connection-driver'
 virt_modules = []
 
+# virt_daemons:
+#   each entry is a dictionary with following items:
+#   * name - binary name (rquired)
+#   * sources - binary sources (optional, default remote_daemon_sources)
+#   * c_args - compile arguments (optional, default [])
+#   * include = include_directories (optional, default [])
+virt_daemons = []
+
 
 # list subdirectories
 
@@ -458,3 +466,46 @@ foreach module : virt_modules
   )
   set_variable('@0@_module'.format(module['name'].underscorify()), mod)
 endforeach
+
+
+# build libvirt daemons
+
+foreach daemon : virt_daemons
+  bin = executable(
+    daemon['name'],
+    [
+      daemon.get('sources', [ remote_daemon_sources, remote_daemon_generated ]),
+      dtrace_gen_objects,
+    ],
+    c_args: [
+      daemon.get('c_args', []),
+    ],
+    include_directories: [
+      conf_inc_dir,
+      remote_inc_dir,
+      daemon.get('include', []),
+    ],
+    dependencies: [
+      access_dep,
+      dbus_dep,
+      gnutls_dep,
+      libnl_dep,
+      rpc_dep,
+      src_dep,
+      sasl_dep,
+      xdr_dep,
+    ],
+    link_with: [
+      admin_driver_lib,
+      libvirt_lib,
+      libvirt_lxc_lib,
+      libvirt_qemu_lib,
+    ],
+    link_args: [
+      libvirt_no_undefined,
+    ],
+    install: true,
+    install_dir: sbindir,
+    install_rpath: libdir,
+  )
+endforeach
diff --git a/src/remote/Makefile.inc.am b/src/remote/Makefile.inc.am
index 9866903847e..eb281a4c4da 100644
--- a/src/remote/Makefile.inc.am
+++ b/src/remote/Makefile.inc.am
@@ -1,46 +1,5 @@
 # vim: filetype=automake
 
-REMOTE_DAEMON_CFLAGS = \
-	$(AM_CFLAGS) \
-	$(GNUTLS_CFLAGS) \
-	$(SASL_CFLAGS) \
-	$(XDR_CFLAGS) \
-	$(DBUS_CFLAGS) \
-	$(LIBNL_CFLAGS) \
-	-I$(srcdir)/access \
-	-I$(builddir)/access \
-	-I$(srcdir)/conf \
-	-I$(srcdir)/rpc \
-	-I$(builddir)/rpc \
-	-I$(builddir)/remote \
-	$(NULL)
-
-REMOTE_DAEMON_LD_FLAGS = \
-	$(AM_LDFLAGS) \
-	$(NO_UNDEFINED_LDFLAGS) \
-	$(NULL)
-
-REMOTE_DAEMON_LD_ADD = \
-	libvirt_driver_admin.la \
-	libvirt-lxc.la \
-	libvirt-qemu.la \
-	libvirt.la \
-	$(LIBXML_LIBS) \
-	$(GNUTLS_LIBS) \
-	$(SASL_LIBS) \
-	$(XDR_LIBS) \
-	$(DBUS_LIBS) \
-	$(LIBNL_LIBS) \
-	$(NULL)
-
-if WITH_DTRACE_PROBES
-REMOTE_DAEMON_LD_ADD += ../src/libvirt_probes.lo
-endif WITH_DTRACE_PROBES
-
-REMOTE_DAEMON_LD_ADD += \
-	$(GLIB_LIBS) \
-	$(NULL)
-
 LOGROTATE_FILES_IN += \
 	remote/libvirtd.qemu.logrotate.in \
 	remote/libvirtd.lxc.logrotate.in \
-- 
2.26.2

Re: [libvirt PATCH 197/351] meson: src: add support for building daemon binaries
Posted by Peter Krempa 5 years, 6 months ago
On Thu, Jul 16, 2020 at 11:57:13 +0200, Pavel Hrdina wrote:
> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> ---
>  src/meson.build            | 51 ++++++++++++++++++++++++++++++++++++++
>  src/remote/Makefile.inc.am | 41 ------------------------------
>  2 files changed, 51 insertions(+), 41 deletions(-)
> 
> diff --git a/src/meson.build b/src/meson.build
> index 13f231f4345..3774e2bb4ba 100644
> --- a/src/meson.build
> +++ b/src/meson.build
> @@ -131,6 +131,14 @@ libvirt_libs = []
>  #   * install_dir - installation directory (optional, default libdir / 'libvirt' / 'connection-driver'
>  virt_modules = []
>  
> +# virt_daemons:
> +#   each entry is a dictionary with following items:
> +#   * name - binary name (rquired)

required

> +#   * sources - binary sources (optional, default remote_daemon_sources)

I'd go with no default here, but I see it's used in many cases.

> +#   * c_args - compile arguments (optional, default [])
> +#   * include = include_directories (optional, default [])
> +virt_daemons = []
> +
>  
>  # list subdirectories
>  

Re: [libvirt PATCH 197/351] meson: src: add support for building daemon binaries
Posted by Pavel Hrdina 5 years, 6 months ago
On Fri, Jul 24, 2020 at 08:45:24AM +0200, Peter Krempa wrote:
> On Thu, Jul 16, 2020 at 11:57:13 +0200, Pavel Hrdina wrote:
> > Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> > ---
> >  src/meson.build            | 51 ++++++++++++++++++++++++++++++++++++++
> >  src/remote/Makefile.inc.am | 41 ------------------------------
> >  2 files changed, 51 insertions(+), 41 deletions(-)
> > 
> > diff --git a/src/meson.build b/src/meson.build
> > index 13f231f4345..3774e2bb4ba 100644
> > --- a/src/meson.build
> > +++ b/src/meson.build
> > @@ -131,6 +131,14 @@ libvirt_libs = []
> >  #   * install_dir - installation directory (optional, default libdir / 'libvirt' / 'connection-driver'
> >  virt_modules = []
> >  
> > +# virt_daemons:
> > +#   each entry is a dictionary with following items:
> > +#   * name - binary name (rquired)
> 
> required
> 
> > +#   * sources - binary sources (optional, default remote_daemon_sources)
> 
> I'd go with no default here, but I see it's used in many cases.

The default is used for almost all daemons except for virtlockd and
virtlogd where we use different sources. Otherwise the sources would not
be required at all.

Pavel