On 12-02-28 09:57 PM, Peter Hutterer wrote:
> Publican requires a read-write source tree, see
> http://bugzilla.redhat.com/show_bug.cgi?id=798484
>
> And it currently cannot build out-of-tree, so we need to copy the sources
> into the _build tree and generate Protocol.xml into that tree too (we'd have
> to do this anyway since automake creates a read-only source tree, so we
> can't just link).
>
> CC: Gaetan Nadon <gaetan.na...@videotron.ca>
> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
> ---
> Gaetan, if you have any better suggestions I'd love to hear them.
I have attached some work in progress patch. Based on "Generate the
docbook description for the protocol from wayland.xml" commit. It passes
distcheck, but it is barely tested.

The publican tool does not let us specify where the source is, so it
forces us to build where the source is. It also forces us to have all
the source in the same subdir. It is a huge bug if you ask me.

Out-of-source builds are not just for distcheck. I know distros and many
individuals who do all their builds out-of-source.  We cannot build in
the source tree, so we need to consider that all the source for publican
is "generated". This is not unusual, in libX11 all the nls doc is 100%
generated. The patch uses make rules to copy the source files into the
builddir rather than custom code. Hopefully it will be easier to maintain.

To have the en-US dirname preserved, I had to rename the source files to
en_US. Otherwise it would not work when srcdir=builddir as the target
name is the same as the source name. Maybe someone else has a solution.

I recall from libX11 that having a directory as a target (Wayland) has
issues. It's always considered out of date, IIRC.

I have not looked at the 'install' part of it, but I see problems right
away. We cannot use "cp" to install files. There is an automake INSTALL
command which varies by platform and by type of data to install and
which is configurable. I had done code to install  a subdir in the groff
days, so I should be able to derive from it.

It'd be good to figure out which files are required to be installed. The
pdf format does not build for em.

Misc: duplicate EXTRA_DIST=

I hope you are not planning on "disting" the generated files :-)






>From fd7a19ec0dee7b84a0042402aee3ea3f6e9f21df Mon Sep 17 00:00:00 2001
From: Gaetan Nadon <mems...@videotron.ca>
Date: Wed, 29 Feb 2012 16:24:25 -0500
Subject: [PATCH] publican: support out-of-source tree build

Applies to the publican branch after commit a678fd53e1
but before commit "hack up distcheck"

Signed-off-by: Gaetan Nadon <mems...@videotron.ca>
---
 doc/Wayland/Makefile.am                            |   61 ++++++++++++-------
 doc/Wayland/{en-US => en_US}/Architecture.xml      |    0
 doc/Wayland/{en-US => en_US}/Author_Group.xml      |    0
 doc/Wayland/{en-US => en_US}/Book_Info.xml         |    0
 doc/Wayland/{en-US => en_US}/Chapter.xml           |    0
 doc/Wayland/{en-US => en_US}/Preface.xml           |    0
 doc/Wayland/{en-US => en_US}/Revision_History.xml  |    0
 doc/Wayland/{en-US => en_US}/Wayland.ent           |    0
 doc/Wayland/{en-US => en_US}/Wayland.xml           |    0
 doc/Wayland/{en-US => en_US}/images/icon.svg       |    0
 .../images/wayland-architecture.png                |  Bin 29162 -> 29162 bytes
 doc/Wayland/{en-US => en_US}/images/wayland.png    |  Bin 5649 -> 5649 bytes
 .../{en-US => en_US}/images/x-architecture.png     |  Bin 37306 -> 37306 bytes
 13 files changed, 38 insertions(+), 23 deletions(-)
 rename doc/Wayland/{en-US => en_US}/Architecture.xml (100%)
 rename doc/Wayland/{en-US => en_US}/Author_Group.xml (100%)
 rename doc/Wayland/{en-US => en_US}/Book_Info.xml (100%)
 rename doc/Wayland/{en-US => en_US}/Chapter.xml (100%)
 rename doc/Wayland/{en-US => en_US}/Preface.xml (100%)
 rename doc/Wayland/{en-US => en_US}/Revision_History.xml (100%)
 rename doc/Wayland/{en-US => en_US}/Wayland.ent (100%)
 rename doc/Wayland/{en-US => en_US}/Wayland.xml (100%)
 rename doc/Wayland/{en-US => en_US}/images/icon.svg (100%)
 rename doc/Wayland/{en-US => en_US}/images/wayland-architecture.png (100%)
 rename doc/Wayland/{en-US => en_US}/images/wayland.png (100%)
 rename doc/Wayland/{en-US => en_US}/images/x-architecture.png (100%)

diff --git a/doc/Wayland/Makefile.am b/doc/Wayland/Makefile.am
index 099efb2..1899c09 100644
--- a/doc/Wayland/Makefile.am
+++ b/doc/Wayland/Makefile.am
@@ -1,31 +1,46 @@
 if HAVE_PUBLICAN
-EXTRA_DIST = Wayland
-noinst_DATA = Wayland
+noinst_DATA = Wayland $(publican_targets)
 
 publican_sources = \
-	$(srcdir)/en-US/Wayland.ent \
-	$(srcdir)/en-US/Architecture.xml \
-	$(srcdir)/en-US/Author_Group.xml \
-	$(srcdir)/en-US/Book_Info.xml \
-	$(srcdir)/en-US/Chapter.xml \
-	$(srcdir)/en-US/Preface.xml \
-	$(srcdir)/en-US/Wayland.xml \
-	$(srcdir)/en-US/Revision_History.xml \
-	$(srcdir)/en-US/images/icon.svg  \
-	$(srcdir)/en-US/images/wayland-architecture.png \
-	$(srcdir)/en-US/images/wayland.png  \
-	$(srcdir)/en-US/images/x-architecture.png
-
-
-Wayland: docbook-xsl publican.cfg $(publican_sources)
-	publican build --lang en-US --format html,pdf
-
-# This must be run befor the publican run
-docbook-xsl: $(top_srcdir)/protocol/wayland.xml protocol-to-docbook.xsl
-	$(AM_V_GEN)$(XSLTPROC) protocol-to-docbook.xsl $(top_srcdir)/protocol/wayland.xml > $(srcdir)/en-US/Protocol.xml
+	$(srcdir)/en_US/Wayland.ent \
+	$(srcdir)/en_US/Architecture.xml \
+	$(srcdir)/en_US/Author_Group.xml \
+	$(srcdir)/en_US/Book_Info.xml \
+	$(srcdir)/en_US/Chapter.xml \
+	$(srcdir)/en_US/Preface.xml \
+	$(srcdir)/en_US/Wayland.xml \
+	$(srcdir)/en_US/Revision_History.xml \
+	$(srcdir)/en_US/images/icon.svg  \
+	$(srcdir)/en_US/images/wayland-architecture.png \
+	$(srcdir)/en_US/images/wayland.png  \
+	$(srcdir)/en_US/images/x-architecture.png
+
+publican_targets = $(publican_sources:$(srcdir)/en_US%=$(builddir)/en-US%) \
+	en-US/Protocol.xml
+
+# The Protocol.xml is purely generated and required before running publican
+en-US/Protocol.xml: $(top_srcdir)/protocol/wayland.xml protocol-to-docbook.xsl
+	$(AM_V_GEN)$(MKDIR_P) en-US/images
+	$(AM_V_GEN)$(XSLTPROC) $(top_srcdir)/doc/Wayland/protocol-to-docbook.xsl \
+		$(top_srcdir)/protocol/wayland.xml > en-US/Protocol.xml
+
+# Run publican for the builddir on the generated (or copied) source
+# The output formats are generated in the Wayland sub directory
+Wayland: $(builddir)/en-US/Protocol.xml publican.cfg $(publican_sources)
+	$(AM_V_GEN)$(PUBLICAN) build --lang en-US --format html,pdf \
+		--config $(srcdir)/publican.cfg
+
+# Copy the en_US source files into en-US destination
+# This is required for out-of-source-tree build as publican does not allow us
+# to specify the location of the source code.
+$(builddir)/en-US/%: $(srcdir)/en_US/% $(builddir)/en-US/Protocol.xml
+	$(AM_V_GEN)cp -f $< $@
+
+CLEANFILES = en-US/Protocol.xml $(publican_targets)
 
 clean-local:
-	-rm -rf Wayland
+	$(AM_V_at)rm -fr en-US
+	$(AM_V_at)rm -fr Wayland
 
 install-data-local:
 	$(MKDIR_P) $(DESTDIR)$(docdir)
diff --git a/doc/Wayland/en-US/Architecture.xml b/doc/Wayland/en_US/Architecture.xml
similarity index 100%
rename from doc/Wayland/en-US/Architecture.xml
rename to doc/Wayland/en_US/Architecture.xml
diff --git a/doc/Wayland/en-US/Author_Group.xml b/doc/Wayland/en_US/Author_Group.xml
similarity index 100%
rename from doc/Wayland/en-US/Author_Group.xml
rename to doc/Wayland/en_US/Author_Group.xml
diff --git a/doc/Wayland/en-US/Book_Info.xml b/doc/Wayland/en_US/Book_Info.xml
similarity index 100%
rename from doc/Wayland/en-US/Book_Info.xml
rename to doc/Wayland/en_US/Book_Info.xml
diff --git a/doc/Wayland/en-US/Chapter.xml b/doc/Wayland/en_US/Chapter.xml
similarity index 100%
rename from doc/Wayland/en-US/Chapter.xml
rename to doc/Wayland/en_US/Chapter.xml
diff --git a/doc/Wayland/en-US/Preface.xml b/doc/Wayland/en_US/Preface.xml
similarity index 100%
rename from doc/Wayland/en-US/Preface.xml
rename to doc/Wayland/en_US/Preface.xml
diff --git a/doc/Wayland/en-US/Revision_History.xml b/doc/Wayland/en_US/Revision_History.xml
similarity index 100%
rename from doc/Wayland/en-US/Revision_History.xml
rename to doc/Wayland/en_US/Revision_History.xml
diff --git a/doc/Wayland/en-US/Wayland.ent b/doc/Wayland/en_US/Wayland.ent
similarity index 100%
rename from doc/Wayland/en-US/Wayland.ent
rename to doc/Wayland/en_US/Wayland.ent
diff --git a/doc/Wayland/en-US/Wayland.xml b/doc/Wayland/en_US/Wayland.xml
similarity index 100%
rename from doc/Wayland/en-US/Wayland.xml
rename to doc/Wayland/en_US/Wayland.xml
diff --git a/doc/Wayland/en-US/images/icon.svg b/doc/Wayland/en_US/images/icon.svg
similarity index 100%
rename from doc/Wayland/en-US/images/icon.svg
rename to doc/Wayland/en_US/images/icon.svg
diff --git a/doc/Wayland/en-US/images/wayland-architecture.png b/doc/Wayland/en_US/images/wayland-architecture.png
similarity index 100%
rename from doc/Wayland/en-US/images/wayland-architecture.png
rename to doc/Wayland/en_US/images/wayland-architecture.png
diff --git a/doc/Wayland/en-US/images/wayland.png b/doc/Wayland/en_US/images/wayland.png
similarity index 100%
rename from doc/Wayland/en-US/images/wayland.png
rename to doc/Wayland/en_US/images/wayland.png
diff --git a/doc/Wayland/en-US/images/x-architecture.png b/doc/Wayland/en_US/images/x-architecture.png
similarity index 100%
rename from doc/Wayland/en-US/images/x-architecture.png
rename to doc/Wayland/en_US/images/x-architecture.png
-- 
1.7.5.4

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to