Our build system doesn't currently install the various
example programs provided along libvirt; however, both the
upstream .spec file and the Debian packaging go out of
their way to make sure these useful demos are included in
the respective documentation packages.
Moreover, doing so without help from the upstream build
system is easy to get wrong: the libvirt-docs RPM package,
for example, ends up missing one of the examples and
including a bunch of empty .deps/ directories.
Install the examples in $(docdir) as part of our regular
procedure, so that users and downstreams don't have to do
anything special about them.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
examples/Makefile.am | 11 +++++++++++
libvirt.spec.in | 12 ------------
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/examples/Makefile.am b/examples/Makefile.am
index ee7d3e6b2c..c7688c7c3d 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -84,6 +84,17 @@ INSTALL_DATA_LOCAL += install-nwfilter-local
UNINSTALL_LOCAL += uninstall-nwfilter-local
endif WITH_NWFILTER
+examplesdir = $(docdir)/examples
+
install-data-local: $(INSTALL_DATA_LOCAL)
+ $(mkinstalldirs) $(DESTDIR)$(examplesdir)
+ for p in $(noinst_PROGRAMS); do \
+ d=$$(dirname $$p); \
+ $(mkinstalldirs) $(DESTDIR)$(examplesdir)/$$d; \
+ $(INSTALL_DATA) $(srcdir)/$${p}.c $(DESTDIR)$(examplesdir)/$$d/; \
+ done
uninstall-local: $(UNINSTALL_LOCAL)
+ for p in $(noinst_PROGRAMS); do \
+ rm -f $(DESTDIR)$(examplesdir)/$${p}.c; \
+ done
diff --git a/libvirt.spec.in b/libvirt.spec.in
index ea6a04c02a..5c27a44fc5 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1232,8 +1232,6 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y'
%{_specdir}/%{name}.spec)
%make_install %{?_smp_mflags} SYSTEMD_UNIT_DIR=%{_unitdir} V=1
-make %{?_smp_mflags} -C examples distclean V=1
-
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/lock-driver/*.la
@@ -1510,16 +1508,6 @@ exit 0
%doc %{_datadir}/gtk-doc/html/libvirt/*.html
%doc %{_datadir}/gtk-doc/html/libvirt/*.png
%doc %{_datadir}/gtk-doc/html/libvirt/*.css
-%doc examples/hellolibvirt
-%doc examples/object-events
-%doc examples/dominfo
-%doc examples/domsuspend
-%doc examples/dommigrate
-%doc examples/openauth
-%doc examples/xml
-%doc examples/rename
-%doc examples/systemtap
-%doc examples/admin
%files daemon
--
2.20.1