We have to compile the libvirt-admin.so outside of src/admin directory
because it depends on libvirt.so.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
configure.ac | 1 -
m4/virt-win-symbols.m4 | 31 ----------------
src/Makefile.am | 1 -
src/admin/Makefile.inc.am | 75 ---------------------------------------
src/admin/meson.build | 43 ++++++++++++++++++++++
src/meson.build | 44 +++++++++++++++++++++++
src/remote/meson.build | 2 ++
7 files changed, 89 insertions(+), 108 deletions(-)
delete mode 100644 m4/virt-win-symbols.m4
diff --git a/configure.ac b/configure.ac
index e6c7e50bb14..af52f957cb2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -91,7 +91,6 @@ PKG_PROG_PKG_CONFIG
dnl MinGW checks
-LIBVIRT_WIN_CHECK_SYMBOLS
LIBVIRT_WIN_CHECK_WINDRES
diff --git a/m4/virt-win-symbols.m4 b/m4/virt-win-symbols.m4
deleted file mode 100644
index 5ffee491877..00000000000
--- a/m4/virt-win-symbols.m4
+++ /dev/null
@@ -1,31 +0,0 @@
-dnl The MinGW symbols checks
-dnl
-dnl Copyright (C) 2016 Red Hat, Inc.
-dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License, or (at your option) any later version.
-dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library. If not, see
-dnl <
http://www.gnu.org/licenses/>.
-dnl
-
-AC_DEFUN([LIBVIRT_WIN_CHECK_SYMBOLS], [
- LIBVIRT_ADMIN_SYMBOL_FILE=admin/libvirt_admin.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
- ;;
- esac
- AC_SUBST([LIBVIRT_ADMIN_SYMBOL_FILE])
-])
diff --git a/src/Makefile.am b/src/Makefile.am
index 45aee9bea1d..71a55e235f2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -29,7 +29,6 @@ AM_LDFLAGS_MOD_NOUNDEF = $(AM_LDFLAGS_MOD) $(NO_UNDEFINED_LDFLAGS)
nodist_conf_DATA =
DRIVER_SOURCE_FILES =
STATEFUL_DRIVER_SOURCE_FILES =
-lib_LTLIBRARIES =
noinst_LTLIBRARIES =
mod_LTLIBRARIES =
INSTALL_DATA_DIRS =
diff --git a/src/admin/Makefile.inc.am b/src/admin/Makefile.inc.am
index afe44437b74..bdaed14cd19 100644
--- a/src/admin/Makefile.inc.am
+++ b/src/admin/Makefile.inc.am
@@ -1,65 +1,9 @@
# vim: filetype=automake
-ADMIN_PROTOCOL = $(srcdir)/admin/admin_protocol.x
-
-ADMIN_PROTOCOL_GENERATED = \
- admin/admin_client.h \
- $(NULL)
-
-GENERATED_SYM_FILES += admin/libvirt_admin.syms admin/libvirt_admin.def
-
ADMIN_SYM_FILES = $(srcdir)/admin/libvirt_admin_private.syms
conf_DATA += admin/libvirt-admin.conf
-lib_LTLIBRARIES += libvirt-admin.la
-
-libvirt_admin_la_SOURCES = \
- admin/libvirt-admin.c \
- $(DATATYPES_SOURCES)
-
-nodist_libvirt_admin_la_SOURCES = \
- $(ADMIN_PROTOCOL_GENERATED)
-
-libvirt_admin_la_LDFLAGS = \
- $(VERSION_SCRIPT_FLAGS)$(LIBVIRT_ADMIN_SYMBOL_FILE) \
- -version-info $(LIBVIRT_VERSION_INFO) \
- $(LIBVIRT_NODELETE) \
- $(AM_LDFLAGS) \
- $(NULL)
-
-libvirt_admin_la_LIBADD = \
- libvirt.la \
- $(XDR_LIBS) \
- $(CAPNG_LIBS) \
- $(YAJL_LIBS) \
- $(DEVMAPPER_LIBS) \
- $(LIBXML_LIBS) \
- $(GLIB_LIBS) \
- $(SSH2_LIBS) \
- $(SASL_LIBS) \
- $(GNUTLS_LIBS) \
- $(LIBSSH_LIBS)
-
-if WITH_DTRACE_PROBES
-libvirt_admin_la_LIBADD += libvirt_probes.lo
-endif WITH_DTRACE_PROBES
-
-libvirt_admin_la_CFLAGS = \
- $(AM_CFLAGS) \
- -I$(builddir)/admin \
- -I$(builddir)/access \
- -I$(srcdir)/remote \
- -I$(srcdir)/rpc \
- -I$(builddir)/rpc \
- $(XDR_CFLAGS) \
- $(CAPNG_CFLAGS) \
- $(YAJL_CFLAGS) \
- $(SSH2_CFLAGS) \
- $(SASL_CFLAGS) \
- $(GNUTLS_CFLAGS) \
- $(LIBSSH_CFLAGS)
-
if WITH_LINUX
check-admin-symfile: admin/libvirt_admin.syms libvirt-admin.la
$(AM_V_GEN)$(RUNUTF8) $(PYTHON) $(top_srcdir)/scripts/check-symfile.py \
@@ -77,22 +21,3 @@ check-admin-drivername:
$(srcdir)/admin/libvirt_admin_public.syms
check-admin: check-admin-symfile check-admin-symsorting check-admin-drivername
-
-admin/admin_client.h: $(srcdir)/rpc/gendispatch.pl \
- $(ADMIN_PROTOCOL) Makefile.am
- $(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=client \
- admin ADMIN $(ADMIN_PROTOCOL) \
- > admin/admin_client.h
-
-admin/libvirt_admin.syms: admin/libvirt_admin_public.syms $(ADMIN_SYM_FILES) \
- $(top_builddir)/config.status
- $(AM_V_GEN)rm -f $@-tmp $@ ; \
- printf '# WARNING: generated from the following:\n# $^\n\n' >$@-tmp
&& \
- cat $(srcdir)/admin/libvirt_admin_public.syms >>$@-tmp && \
- printf '\n\n# Private symbols\n\n' >>$@-tmp && \
- printf 'LIBVIRT_ADMIN_PRIVATE_$(VERSION) {\n\n' >>$@-tmp && \
- printf 'global:\n\n' >>$@-tmp && \
- cat $(ADMIN_SYM_FILES) >>$@-tmp && \
- printf '\n\nlocal:\n*;\n\n};' >>$@-tmp && \
- chmod a-w $@-tmp && \
- mv $@-tmp admin/libvirt_admin.syms
diff --git a/src/admin/meson.build b/src/admin/meson.build
index 31d1a437fbe..3522d789a00 100644
--- a/src/admin/meson.build
+++ b/src/admin/meson.build
@@ -35,6 +35,47 @@ admin_driver_generated += custom_target(
capture: true,
)
+admin_sources = files(
+ 'libvirt-admin.c',
+)
+
+admin_client_generated = custom_target(
+ 'admin_client.h',
+ input: admin_driver_protocol,
+ output: 'admin_client.h',
+ command: [
+ gendispatch_prog, '--mode=client', 'admin', 'ADMIN',
'@INPUT@',
+ ],
+ capture: true,
+)
+
+libvirt_admin_syms = custom_target(
+ 'libvirt_admin.syms',
+ input: [
+ 'libvirt_admin_public.syms',
+ 'libvirt_admin_private.syms',
+ ],
+ output: 'libvirt_admin.syms',
+ command: [ gen_sym_files_prog, 'LIBVIRT_ADMIN_PRIVATE_' +
meson.project_version(), '@INPUT@' ],
+ capture: true,
+)
+libvirt_admin_syms_file = libvirt_admin_syms
+if host_machine.system() == 'windows'
+ libvirt_admin_def = custom_target(
+ 'libvirt_admin.def',
+ input: libvirt_admin_syms,
+ output: 'libvirt_admin.def',
+ command: [ gen_def_files_prog, '@INPUT@' ],
+ capture: true,
+ )
+ libvirt_admin_syms_file = libvirt_admin_def
+endif
+
+libvirt_admin_syms_flags = '@0@@1(a)'.format(
+ version_script_flags,
+ libvirt_admin_syms_file.full_path(),
+)
+
admin_driver_lib = static_library(
'virt_admin_driver',
[
@@ -50,3 +91,5 @@ admin_driver_lib = static_library(
)
libvirt_libs += admin_driver_lib
+
+admin_inc_dir = include_directories('.')
diff --git a/src/meson.build b/src/meson.build
index f324b165f99..9c088014415 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -355,3 +355,47 @@ libvirt_lxc_lib = shared_library(
version: libvirt_lib_version,
soversion: libvirt_so_version,
)
+
+
+# libvirt-admin.so
+
+libvirt_admin_lib = shared_library(
+ 'virt-admin',
+ [
+ admin_sources,
+ admin_client_generated,
+ admin_driver_generated,
+ datatypes_sources,
+ dtrace_gen_objects,
+ ],
+ dependencies: [
+ capng_dep,
+ devmapper_dep,
+ gnutls_dep,
+ libssh2_dep,
+ libssh_dep,
+ sasl_dep,
+ src_dep,
+ rpc_dep,
+ xdr_dep,
+ yajl_dep,
+ ],
+ include_directories: [
+ admin_inc_dir,
+ remote_inc_dir,
+ ],
+ link_args: [
+ libvirt_admin_syms_flags,
+ libvirt_nodelete,
+ ],
+ link_with: [
+ libvirt_lib,
+ ],
+ link_depends: [
+ libvirt_admin_syms_file,
+ ],
+ install: true,
+ install_rpath: libdir,
+ version: libvirt_lib_version,
+ soversion: libvirt_so_version,
+)
diff --git a/src/remote/meson.build b/src/remote/meson.build
index a667f15ecf2..3de6c5ee1f4 100644
--- a/src/remote/meson.build
+++ b/src/remote/meson.build
@@ -65,3 +65,5 @@ if conf.has('WITH_REMOTE')
else
sym_files += 'libvirt_remote.syms'
endif
+
+remote_inc_dir = include_directories('.')
--
2.26.2