From 4bb4faf9771b81d6358f81b64a03d9c8653a1ae8 Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Thu, 25 Jun 2020 16:30:41 +0200 Subject: [PATCH] meson: src: build libvirt-lxc.so library 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 Reviewed-by: Peter Krempa Reviewed-by: Neal Gompa --- m4/virt-win-symbols.m4 | 3 --- src/Makefile.am | 20 ---------------- src/meson.build | 52 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 23 deletions(-) diff --git a/m4/virt-win-symbols.m4 b/m4/virt-win-symbols.m4 index dc5c5daa66..5ffee49187 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 3dcc7b6793..f97e35ada1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -38,7 +38,6 @@ INSTALL_DATA_LOCAL = UNINSTALL_LOCAL = SYM_FILES = USED_SYM_FILES = -GENERATED_SYM_FILES = augeas_DATA = augeastest_DATA = conf_DATA = @@ -63,10 +62,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 @@ -208,9 +203,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 @@ -231,8 +223,6 @@ check-augeas: $(augeas_DATA) $(augeastest_DATA) AUG_GENTEST_SCRIPT = $(top_srcdir)/scripts/augeas-gentest.py AUG_GENTEST = $(RUNUTF8) $(PYTHON) $(AUG_GENTEST_SCRIPT) -BUILT_SOURCES += $(GENERATED_SYM_FILES) - if WITH_DTRACE_PROBES BUILT_SOURCES += libvirt_functions.stp @@ -253,16 +243,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 0b11c1fd32..a0240c0ef6 100644 --- a/src/meson.build +++ b/src/meson.build @@ -321,3 +321,55 @@ 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: [ + meson_python_prog, python3_prog.path(), meson_gen_def_prog.path(), + '@INPUT@', '@OUTPUT@', + ], + ) + 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.47.2