[libvirt PATCH 168/351] meson: src: add code to build shared modules

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


Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 src/Makefile.am |  8 --------
 src/meson.build | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 71a55e235f2..a9fce0444ed 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -19,12 +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_LDFLAGS_MOD = \
-	-module \
-	-avoid-version \
-	$(LIBVIRT_NODELETE) \
-	$(AM_LDFLAGS)
-AM_LDFLAGS_MOD_NOUNDEF = $(AM_LDFLAGS_MOD) $(NO_UNDEFINED_LDFLAGS)
 
 nodist_conf_DATA =
 DRIVER_SOURCE_FILES =
@@ -81,8 +75,6 @@ include storage/Makefile.inc.am
 include remote/Makefile.inc.am
 
 
-moddir = $(libdir)/libvirt/connection-driver
-
 confdir = $(sysconfdir)/libvirt
 conf_DATA += libvirt.conf
 
diff --git a/src/meson.build b/src/meson.build
index 50f428da2ef..991991118ba 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -118,6 +118,19 @@ endif
 
 libvirt_libs = []
 
+# virt_modules:
+#   each entry is a dictionary with following items:
+#   * name - module name (required)
+#   * sources - module sources (optional, default [])
+#   * name_prefix - resulting library prefix (optional, default 'lib')
+#   * include - include_directories (optional, default [])
+#   * deps - dependencies (optional, default [])
+#   * link_with - static libraries to link with (optional, default [])
+#   * link_whole - static libraries to include (optional, default [])
+#   * link_args - arguments for linker (optional, default [])
+#   * install_dir - installation directory (optional, default libdir / 'libvirt' / 'connection-driver'
+virt_modules = []
+
 
 # list subdirectories
 
@@ -409,3 +422,37 @@ libvirt_admin_lib = shared_library(
   version: libvirt_lib_version,
   soversion: libvirt_so_version,
 )
+
+
+# build libvirt shared modules
+
+foreach module : virt_modules
+  mod = shared_module(
+    module['name'],
+    module.get('sources', []),
+    name_prefix: module.get('name_prefix', 'lib'),
+    include_directories: [
+      conf_inc_dir,
+      module.get('include', []),
+    ],
+    dependencies: [
+      src_dep,
+      module.get('deps', []),
+    ],
+    link_with: [
+      libvirt_lib,
+      module.get('link_with', []),
+    ],
+    link_whole: [
+      module.get('link_whole', []),
+    ],
+    link_args: [
+      libvirt_nodelete,
+      module.get('link_args', []),
+    ],
+    install: true,
+    install_dir: module.get('install_dir', libdir / 'libvirt' / 'connection-driver'),
+    install_rpath: libdir,
+  )
+  set_variable('@0 at _module'.format(module['name'].underscorify()), mod)
+endforeach
-- 
2.26.2




More information about the libvir-list mailing list