[PATCH v2 wayland 3/4] doc: Provide a fallback solution when Publican is not found

Tiago Vignatti tiago.vignatti at intel.com
Mon Nov 19 04:32:59 PST 2012


It provides a simple HTML solution extracted from DocBook. Also now XSLTPROC
is a strong requirement for building all the documentation (which is fair,
because is used for building both man-pages and the Wayland Manual).

Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
---
- changes since v1: now it uses a URL in the catalog file to find the given
  stylesheet (xhtml/docbook.xsl). This is the recommended way to do it. Also,
  this version strictly requires XSLTPROC for building all the documentation.

 configure.ac            |   24 +++++++++++++++---------
 doc/Wayland/Makefile.am |    5 ++++-
 doc/man/Makefile.am     |    4 ----
 3 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/configure.ac b/configure.ac
index a451948..7352a6f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -73,31 +73,37 @@ if test "x$enable_scanner" = "xyes"; then
 	AC_SUBST(EXPAT_LIBS)
 fi
 
-AC_PATH_PROG(XSLTPROC, xsltproc)
-AM_CONDITIONAL([HAVE_XSLTPROC], [test "x$XSLTPROC" != "x"])
-
+# Documentation
 AM_CONDITIONAL(BUILD_DOCS, [test x$enable_documentation = xyes])
 if test "x$enable_documentation" = "xyes"; then
-	AC_PATH_PROG(DOXYGEN, doxygen)
 
-	if test "x$DOXYGEN" = "x"; then
-		AC_MSG_ERROR([Documentation build requested but doxygen not found. Install doxygen or disable the documentation using --disable-documentation])
+	AC_PATH_PROG(DOXYGEN, doxygen)
+	if test "x$DOXYGEN" = "x" ; then
+		AC_MSG_ERROR([Documentation build requested, but doxygen not installed.])
+	fi
+	AC_PATH_PROG(XSLTPROC, xsltproc)
+	if test "x$XSLTPROC" = "x"; then
+		AC_MSG_ERROR([Documentation build requested, but xsltproc not installed.])
 	fi
 
 	AC_PATH_PROG(PUBLICAN, publican)
-
 	if test "x$PUBLICAN" != "x"; then
 		PUBLICAN_VERSION=`$PUBLICAN -v | cut -d'=' -f2`
 
 		if test [ 1 -eq `echo "${PUBLICAN_VERSION} < 2.8" | bc` ]; then
-			AC_MSG_ERROR([Publican version is not supported. Install publican >= 2.8 or disable the documentation using --disable-documentation])
+			AC_MSG_ERROR([Documentation build requested, but Publican version is < 2.8.])
+		fi
+	else
+		AC_PATH_PROG(XMLLINT, xmllint)
+		if test "x$XMLLINT" = "x"; then
+			AC_MSG_ERROR([Documentation build requested, but requirements not found.])
 		fi
+		AC_MSG_WARN([Publican not found; a fallback will be used for HTML documentation])
 	fi
 
 	AC_CONFIG_FILES([
 	doc/doxygen/wayland.doxygen
 	])
-
 fi
 AM_CONDITIONAL([HAVE_PUBLICAN], [test "x$PUBLICAN" != "x"])
 
diff --git a/doc/Wayland/Makefile.am b/doc/Wayland/Makefile.am
index 6c328ea..f120a01 100644
--- a/doc/Wayland/Makefile.am
+++ b/doc/Wayland/Makefile.am
@@ -68,7 +68,10 @@ Wayland: $(doc_targets)
 	@touch Wayland
 else
 Wayland: $(doc_targets)
-	$(AM_V_GEN)mkdir -p $(srcdir)/Wayland
+	$(AM_V_GEN)$(mkdir_p) $(srcdir)/Wayland/en-US/html/
+	$(AM_V_GEN)cp -rf $(srcdir)/en-US/images/ $(srcdir)/Wayland/en-US/html/
+	$(AM_V_GEN)$(XMLLINT) --xinclude $(builddir)/en-US/Wayland.xml > $(builddir)/en-US/resolved.xml
+	$(AM_V_GEN)$(XSLTPROC) http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl $(builddir)/en-US/resolved.xml > $(srcdir)/Wayland/en-US/html/index.html
 endif
 
 CLEANFILES = en-US/ProtocolSpec.xml en-US/ProtocolInterfaces.xml en-US/WaylandClientAPI.xml $(doc_targets)
diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am
index a6a5072..bace65e 100644
--- a/doc/man/Makefile.am
+++ b/doc/man/Makefile.am
@@ -15,8 +15,6 @@ CLEANFILES =
 EXTRA_DIST =
 man_MANS =
 
-if HAVE_XSLTPROC
-
 CLEANFILES += $(MANPAGES) $(MANPAGES_ALIASES)
 EXTRA_DIST += $(MANPAGES) $(MANPAGES_ALIASES) $(XML_FILES)
 man_MANS += $(MANPAGES) $(MANPAGES_ALIASES)
@@ -45,5 +43,3 @@ XSLTPROC_PROCESS_MAN = \
 	$(XSLTPROC_PROCESS_MAN)
 
 wl_display_connect_to_fd.3: wl_display_connect.3
-
-endif # HAVE_XSLTPROC
-- 
1.7.9.5



More information about the wayland-devel mailing list