examples: Install under $(docdir)

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@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Andrea Bolognani 2019-05-10 16:32:22 +02:00
parent 6716c997f6
commit 4faaaa8b27
2 changed files with 11 additions and 12 deletions

View File

@ -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

View File

@ -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