]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: src: add code to build shared modules
authorPavel Hrdina <phrdina@redhat.com>
Thu, 25 Jun 2020 13:42:06 +0000 (15:42 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 3 Aug 2020 07:27:04 +0000 (09:27 +0200)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
src/Makefile.am
src/meson.build

index 65cfce3672937c0c5919b6e0d1fd487ee069dc33..7ca5b8fa2cf3a6e9566c359c6bd40067336941b2 100644 (file)
 # 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)
 
 BUILT_SOURCES =
 nodist_conf_DATA =
@@ -82,8 +76,6 @@ include storage/Makefile.inc.am
 include remote/Makefile.inc.am
 
 
-moddir = $(libdir)/libvirt/connection-driver
-
 confdir = $(sysconfdir)/libvirt
 conf_DATA += libvirt.conf
 
index 85590026b85c1cd99940e8493dc96db584d2d42f..eb48fa165793605a3aa251f84757d69088fac432 100644 (file)
@@ -127,6 +127,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
 
@@ -427,3 +440,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@_module'.format(module['name'].underscorify()), mod)
+endforeach