Currently, the daemon requires libvirt-admin.so because the
functions encoding/decoding RPC messages for admin APIs live
there. But this makes it very hard to split admin API into its
own separate package: if libvirt-admin.so is going to live in a
separate package than the daemon, either both packages must be
installed or none.
Solve this by statically linking the RPC message handling
functions with the daemon.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
I'm a bit torn. I'm tempted to rewrite some parts of admin API so
that it follows the driver architecture we have for other areas,
e.g. domain drivers. Until then, this patch is needed.
daemon/Makefile.am | 2 +-
src/Makefile.am | 15 +++++++++++++--
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 927d16f..3b6aafe 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -152,7 +152,7 @@ libvirtd_admin_la_LDFLAGS = \
$(NO_INDIRECT_LDFLAGS) \
$(NULL)
libvirtd_admin_la_LIBADD = \
- ../src/libvirt-admin.la
+ ../src/libvirt-admin-rpc.la
man8_MANS = libvirtd.8
diff --git a/src/Makefile.am b/src/Makefile.am
index 9f8b638..7c3cef6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -592,7 +592,7 @@ $(srcdir)/lock_protocol-struct: \
$(srcdir)/%-struct: locking/lockd_la-%.lo
$(PDWTAGS)
$(srcdir)/admin_protocol-struct: \
- $(srcdir)/%-struct: admin/libvirt_admin_la-%.lo
+ $(srcdir)/%-struct: admin/%.lo
$(PDWTAGS)
else !WITH_REMOTE
@@ -2165,10 +2165,20 @@ libvirt_admin.syms: libvirt_admin_public.syms $(ADMIN_SYM_FILES)
\
# need to include it in the dist
EXTRA_DIST += admin/admin_remote.c
+noinst_LTLIBRARIES += \
+ libvirt-admin-rpc.la
+
+libvirt_admin_rpc_la_SOURCES = \
+ $(ADMIN_PROTOCOL_GENERATED)
+
+libvirt_admin_rpc_la_LDFLAGS = \
+ $(AM_LDFLAGS) \
+ $(CYGWIN_EXTRA_LDFLAGS) \
+ $(MINGW_EXTRA_LDFLAGS)
+
lib_LTLIBRARIES += libvirt-admin.la
libvirt_admin_la_SOURCES = \
libvirt-admin.c \
- $(ADMIN_PROTOCOL_GENERATED) \
$(DATATYPES_SOURCES)
libvirt_admin_la_LDFLAGS = \
@@ -2180,6 +2190,7 @@ libvirt_admin_la_LDFLAGS = \
libvirt_admin_la_LIBADD = \
libvirt.la \
+ libvirt-admin-rpc.la \
$(CYGWIN_EXTRA_LIBADD)
libvirt_admin_la_CFLAGS = \
--
2.8.4