[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] build: shipped files must not depend on BUILT_SOURCES



'make distcheck' was failing with:
make[3]: Entering directory `/home/eblake/libvirt-tmp2/libvirt-1.1.1/_build/docs'
perl ../../docs/genaclperms.pl ../../src/access/viraccessperm.h > ../../docs/aclperms.htmlinc
/bin/sh: ../../docs/aclperms.htmlinc: Permission denied

when simulating the case of a user doing a VPATH build from a
read-only source tree.  The culprit?  BUILT_SOURCES are _always_
built, and so must NOT be built into srcdir and need not be part
of the tarball.  On the other hand, shipped files must never
depend on files in the builddir.  While it would be possible to
fix the problem by generating aclperms.htmlinc into builddir,
we then have the problem that we ship acl.html - we'd have to
rejigger a lot of things to not ship pre-built html.  So this
patch goes the other direction - we don't need BUILT_SOURCES,
but instead ensure that we have proper dependencies so that
all files in srcdir are up-to-date at the time the tarball is
created.  And because we ship html files in the tarball, that
implies we don't expect users to be able to rebuild them, so
we must not clean any files that would trigger a rebuild except
under the maintainer rules.

* docs/Makefile.am (BUILT_SOURCES): Delete.
(CLEANFILES): Downgrade aclperms.htmlinc cleanup...
(maintainer-clean-local): ...and move hvsupport.html.in...
(MAINTAINERCLEANFILES): ...to a maintainer action.
(hvsupport.html.in): Write into srcdir.
(hvsupport.html): Ensure files are built in order.
(aclperms.htmlinc): Honor silent make.
(EXTRA_DIST): Ship aclperms.htmlinc.

Signed-off-by: Eric Blake <eblake redhat com>
---

Pushing under the build-breaker rule.  Still not there, but
getting much closer; now 'make distcheck' fails with:
rm -f Makefile
ERROR: files left in build directory after distclean:
./src/virtlockd.8

 docs/Makefile.am | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/docs/Makefile.am b/docs/Makefile.am
index 9939cc8..410c256 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -25,8 +25,6 @@ DOC_SOURCE_DIR=../src

 DEVHELP_DIR=$(datadir)/gtk-doc/html/libvirt

-BUILT_SOURCES=hvsupport.html.in
-
 apihtml =			\
   html/index.html		\
   html/libvirt-libvirt.html	\
@@ -89,9 +87,15 @@ internals_html_in = \
   $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/internals/*.html.in))
 internals_html = $(internals_html_in:%.html.in=%.html)

+# todo.html is special - it is shipped in the tarball, but we
+# have a dedicated 'todo' target to rebuild it from a proper
+# config file, all other users are able to build it locally.
+# For all other files, since we ship pre-built html in the
+# tarball, we must also ship the sources, even when those
+# sources are themselves generated.
 dot_html_in = $(notdir $(wildcard $(srcdir)/*.html.in)) \
   todo.html.in \
-  hvsupport.html.in
+  $(srcdir)/hvsupport.html.in
 dot_html = $(dot_html_in:%.html.in=%.html)

 dot_php_in = $(notdir $(wildcard $(srcdir)/*.php.in))
@@ -136,25 +140,22 @@ EXTRA_DIST=					\
   $(xml) $(qemu_xml) $(lxc_xml) $(fig) $(png) $(css) \
   $(patches) $(dot_php_in) $(dot_php_code_in) $(dot_php)\
   $(internals_html_in) $(internals_html) \
-  sitemap.html.in \
+  sitemap.html.in aclperms.htmlinc \
   todo.pl hvsupport.pl todo.cfg-example

-BUILT_SOURCES += aclperms.htmlinc
-
-CLEANFILES = $(srcdir)/aclperms.htmlinc
-
 acl.html:: $(srcdir)/aclperms.htmlinc

 $(srcdir)/aclperms.htmlinc: $(top_srcdir)/src/access/viraccessperm.h \
         $(srcdir)/genaclperms.pl Makefile.am
-	$(PERL) $(srcdir)/genaclperms.pl $< > $@
+	$(AM_V_GEN)$(PERL) $(srcdir)/genaclperms.pl $< > $@

 MAINTAINERCLEANFILES = \
   $(addprefix $(srcdir)/,$(dot_html)) \
   $(addprefix $(srcdir)/,$(apihtml)) \
   $(addprefix $(srcdir)/,$(devhelphtml)) \
   $(addprefix $(srcdir)/,$(internals_html)) \
-  $(addprefix $(srcdir)/,$(dot_php))
+  $(addprefix $(srcdir)/,$(dot_php)) \
+  $(srcdir)/hvsupport.html.in $(srcdir)/aclperms.htmlinc

 all-am: web

@@ -183,7 +184,9 @@ todo:
 	rm -f todo.html.in
 	$(MAKE) todo.html

-hvsupport.html.in: $(srcdir)/hvsupport.pl \
+hvsupport.html:: $(srcdir)/hvsupport.html.in
+
+$(srcdir)/hvsupport.html.in: $(srcdir)/hvsupport.pl \
 		$(srcdir)/../src/libvirt_public.syms \
 	$(srcdir)/../src/libvirt_qemu.syms $(srcdir)/../src/libvirt_lxc.syms \
 	$(srcdir)/../src/driver.h
@@ -295,7 +298,7 @@ clean-local:

 maintainer-clean-local: clean-local
 	rm -rf $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml \
-		todo.html.in hvsupport.html.in
+		todo.html.in
 	rm -rf $(srcdir)/libvirt-qemu-api.xml $(srcdir)/libvirt-qemu-refs.xml
 	rm -rf $(srcdir)/libvirt-lxc-api.xml $(srcdir)/libvirt-lxc-refs.xml
 	rm -rf $(APIBUILD_STAMP)
-- 
1.8.3.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]