[libvirt PATCH 155/351] meson: src: build libvirt-lxc.so library

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


There are two extra dependencies compared to automake, apparmor and
selinux.  It looks like libtool is doing some magic and inheriting
dependencies from libvirt.la which inherits these dependencies from
other libraries.

Without these two dependencies in meson the compilation fails.

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 m4/virt-win-symbols.m4 |  3 ---
 src/Makefile.am        | 18 ---------------
 src/meson.build        | 50 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+), 21 deletions(-)

diff --git a/m4/virt-win-symbols.m4 b/m4/virt-win-symbols.m4
index dc5c5daa660..5ffee491877 100644
--- a/m4/virt-win-symbols.m4
+++ b/m4/virt-win-symbols.m4
@@ -19,16 +19,13 @@ dnl
 
 AC_DEFUN([LIBVIRT_WIN_CHECK_SYMBOLS], [
   LIBVIRT_ADMIN_SYMBOL_FILE=admin/libvirt_admin.syms
-  LIBVIRT_LXC_SYMBOL_FILE='$(srcdir)/libvirt_lxc.syms'
   case "$host" in
     *-*-mingw* )
       # Also set the symbol file to .def, so src/Makefile generates libvirt.def
       # from libvirt.syms and passes libvirt.def instead of libvirt.syms to the
       # linker
       LIBVIRT_ADMIN_SYMBOL_FILE=admin/libvirt_admin.def
-      LIBVIRT_LXC_SYMBOL_FILE=libvirt_lxc.def
       ;;
   esac
   AC_SUBST([LIBVIRT_ADMIN_SYMBOL_FILE])
-  AC_SUBST([LIBVIRT_LXC_SYMBOL_FILE])
 ])
diff --git a/src/Makefile.am b/src/Makefile.am
index 5655655ee32..45aee9bea1d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -37,7 +37,6 @@ INSTALL_DATA_LOCAL =
 UNINSTALL_LOCAL =
 SYM_FILES =
 USED_SYM_FILES =
-GENERATED_SYM_FILES =
 augeas_DATA =
 augeastest_DATA =
 conf_DATA =
@@ -62,10 +61,6 @@ COMMON_UNIT_VARS = \
 	-e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
 	$(NULL)
 
-# Set these variables before we include any of the subdirs as libvirt-admin.la
-# has to be installed after libvirt.la.
-lib_LTLIBRARIES += libvirt-lxc.la
-
 include util/Makefile.inc.am
 include security/Makefile.inc.am
 include access/Makefile.inc.am
@@ -205,9 +200,6 @@ check-local: check-protocol check-symfile check-symsorting \
 # All .syms files should be placed in exactly one of these three lists,
 # depending on whether they are stored in git and/or used in the build.
 SYM_FILES += $(USED_SYM_FILES)
-GENERATED_SYM_FILES += \
-	libvirt_lxc.def \
-	$(NULL)
 
 
 check-local: check-augeas
@@ -246,16 +238,6 @@ libvirt_functions.stp: $(RPC_PROBE_FILES) $(top_srcdir)/scripts/gensystemtap.py
 
 endif WITH_DTRACE_PROBES
 
-libvirt_lxc_la_SOURCES = libvirt-lxc.c
-libvirt_lxc_la_LDFLAGS = \
-		$(VERSION_SCRIPT_FLAGS)$(LIBVIRT_LXC_SYMBOL_FILE) \
-		-version-info $(LIBVIRT_VERSION_INFO) \
-		$(LIBVIRT_NODELETE) \
-		$(AM_LDFLAGS) \
-		$(NULL)
-libvirt_lxc_la_CFLAGS = $(AM_CFLAGS)
-libvirt_lxc_la_LIBADD = libvirt.la
-
 install-sysconfig:
 	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
 	for f in $(SYSCONF_FILES:%.sysconf=%) ; \
diff --git a/src/meson.build b/src/meson.build
index a7fbff674c6..f324b165f99 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -305,3 +305,53 @@ libvirt_qemu_lib = shared_library(
   version: libvirt_lib_version,
   soversion: libvirt_so_version,
 )
+
+
+# libvirt-lxc.so symbol files
+
+libvirt_lxc_syms = meson.current_source_dir() / 'libvirt_lxc.syms'
+libvirt_lxc_syms_file = libvirt_lxc_syms
+libvirt_lxc_syms_path = libvirt_lxc_syms
+if host_machine.system() == 'windows'
+  libvirt_lxc_def = custom_target(
+    'libvirt_lxc.def',
+    input: libvirt_lxc_syms,
+    output: 'libvirt_lxc.def',
+    command: [ gen_def_files_prog, '@INPUT@' ],
+    capture: true,
+  )
+  libvirt_lxc_syms_file = libvirt_lxc_def
+  libvirt_lxc_syms_path = libvirt_lxc_def.full_path()
+endif
+
+
+# libvirt-lxc.so
+
+libvirt_lxc_syms_flags = '@0@@1@'.format(
+  version_script_flags,
+  libvirt_lxc_syms_path,
+)
+
+libvirt_lxc_lib = shared_library(
+  'virt-lxc',
+  'libvirt-lxc.c',
+  dependencies: [
+    apparmor_dep,
+    selinux_dep,
+    src_dep,
+  ],
+  link_args: [
+    libvirt_nodelete,
+    libvirt_lxc_syms_flags,
+  ],
+  link_with: [
+    libvirt_lib,
+  ],
+  link_depends: [
+    libvirt_lxc_syms_file,
+  ],
+  install: true,
+  install_rpath: libdir,
+  version: libvirt_lib_version,
+  soversion: libvirt_so_version,
+)
-- 
2.26.2




More information about the libvir-list mailing list