From 88f3137cae3318cc5cfcf4367d2930cd80542745 Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Thu, 25 Jun 2020 15:42:06 +0200 Subject: [PATCH] meson: src: add code to build shared modules Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa Reviewed-by: Neal Gompa --- 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 65cfce3672..7ca5b8fa2c 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) 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 diff --git a/src/meson.build b/src/meson.build index 85590026b8..eb48fa1657 100644 --- a/src/meson.build +++ b/src/meson.build @@ -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