[PATCH xorg-docs v2 2/2] Replace XMLTO with XSLTPROC, XMLLINT and W3M tools
Gaetan Nadon
memsize at videotron.ca
Tue Mar 22 09:17:11 PDT 2011
Xmlto is a script that selects the appropriate back-end
based on options and tools availability.
Xmlto uses an xsl "fragment" which is not compatible with
the standard use of xsl stylesheets. The customization for
xhtml and fo cannot be used with xsltproc in that context.
It makes adoption of docbook features like olink and profiling
significantly more difficult.
The tools that xmlto invokes will be called directly by the makefile,
which are xmllint for validation, xsltproc, and w3m for text format.
Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
---
Finished the makefile conversion and added -path to xmllint to find defs.ent
.gitignore | 1 +
configure.ac | 5 +-
docbook.am | 106 ++++++++++++++++++++++------------------
general/Makefile.am | 4 +-
general/fonts/Makefile.am | 4 +-
general/graphics/Makefile.am | 4 +-
general/input/Makefile.am | 4 +-
general/platforms/Makefile.am | 4 +-
specs/CTEXT/Makefile.am | 4 +-
specs/ICCCM/Makefile.am | 4 +-
specs/XLFD/Makefile.am | 4 +-
specs/Xext/Makefile.am | 2 -
specs/Xserver/Makefile.am | 4 +-
13 files changed, 71 insertions(+), 79 deletions(-)
diff --git a/.gitignore b/.gitignore
index 04042e4..3097848 100644
--- a/.gitignore
+++ b/.gitignore
@@ -81,3 +81,4 @@ core
*.pdf
*.txt
*.db
+*.fo
diff --git a/configure.ac b/configure.ac
index 615d31a..d2af60d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,10 +39,11 @@ XORG_MACROS_VERSION(1.12)
XORG_DEFAULT_OPTIONS
XORG_ENABLE_DOCS
XORG_ENABLE_SPECS
-XORG_WITH_XMLTO(0.0.22)
+XORG_CHECK_SGML_DOCTOOLS(1.5)
XORG_WITH_XSLTPROC
+XORG_WITH_XMLLINT
XORG_WITH_FOP
-XORG_CHECK_SGML_DOCTOOLS(1.5)
+XORG_WITH_W3M
AC_CONFIG_FILES([Makefile
general/Makefile
diff --git a/docbook.am b/docbook.am
index 10d0053..9809646 100644
--- a/docbook.am
+++ b/docbook.am
@@ -20,76 +20,86 @@ shelf_DATA =
# DocBook/XML file with chapters, appendix and images it includes
dist_shelf_DATA = $(docbook) $(chapters)
-#
-# Generate DocBook/XML output formats with or without stylesheets
-#
-
-# Stylesheets are available if the package xorg-sgml-doctools is installed
+if HAVE_XSLTPROC
if HAVE_STYLESHEETS
-# The location where all cross reference databases are installed
-sgmldbsdir = $(XORG_SGML_PATH)/X11/dbs
-masterdb = "$(sgmldbsdir)/masterdb$(suffix $@).xml"
-XMLTO_FLAGS = \
- --searchpath "$(XORG_SGML_PATH)/X11" \
- --stringparam target.database.document=$(masterdb) \
- --stringparam current.docid="$(<:.xml=)" \
- --stringparam collect.xref.targets="no"
-
-XMLTO_XHTML_FLAGS = \
- -m $(STYLESHEET_SRCDIR)/xorg-xhtml.xsl \
- --stringparam html.stylesheet=$(STYLESHEET_SRCDIR)/xorg.css
-
-XMLTO_FO_FLAGS = \
- -m $(STYLESHEET_SRCDIR)/xorg-fo.xsl
-endif HAVE_STYLESHEETS
+if HAVE_XMLLINT
+XMLLINT_FLAGS = --noout --nonet --xinclude --postvalid --noent \
+ --path "$(XORG_SGML_PATH)/X11"
-shelf_DATA += $(docbook:.xml=.html)
-%.html: %.xml $(chapters)
- $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) $(XMLTO_XHTML_FLAGS) xhtml-nochunks $<
-
-if HAVE_FOP
-shelf_DATA += $(docbook:.xml=.pdf) $(docbook:.xml=.ps)
-%.pdf: %.xml $(chapters)
- $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) $(XMLTO_FO_FLAGS) --with-fop pdf $<
-%.ps: %.xml $(chapters)
- $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) $(XMLTO_FO_FLAGS) --with-fop ps $<
-endif HAVE_FOP
-
-if HAVE_XMLTO_TEXT
-shelf_DATA += $(docbook:.xml=.txt)
-%.txt: %.xml $(chapters)
- $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) $(XMLTO_XHTML_FLAGS) txt $<
-endif HAVE_XMLTO_TEXT
+endif HAVE_XMLLINT
#
-# Generate documents cross-reference target databases
+# Generate DocBook/XML document cross-reference database
#
-# This is only possible if the xorg-sgml-doctools package is installed
-if HAVE_STYLESHEETS
-if HAVE_XSLTPROC
+# The location where all cross reference databases are installed
+sgmldbsdir = $(XORG_SGML_PATH)/X11/dbs
# DocBook/XML generated document cross-reference database
sgmldbs_DATA = $(docbook:.xml=.html.db) $(docbook:.xml=.fo.db)
-# Generate DocBook/XML document cross-reference database
# Flags for the XSL Transformation processor generating xref target databases
-XSLTPROC_FLAGS = \
+XSLTPROC_DB_FLAGS = \
--path "$(XORG_SGML_PATH)/X11" \
--stringparam targets.filename "$@" \
--stringparam collect.xref.targets "only" \
--nonet --xinclude
%.html.db: %.xml $(chapters)
- $(AM_V_GEN)$(XSLTPROC) $(XSLTPROC_FLAGS) \
+ $(AM_V_at)$(XMLLINT) $(XMLLINT_FLAGS) $<
+ $(AM_V_GEN)$(XSLTPROC) $(XSLTPROC_DB_FLAGS) \
http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl $<
%.fo.db: %.xml $(chapters)
- $(AM_V_GEN)$(XSLTPROC) $(XSLTPROC_FLAGS) \
+ $(AM_V_at)$(XMLLINT) $(XMLLINT_FLAGS) $<
+ $(AM_V_GEN)$(XSLTPROC) $(XSLTPROC_DB_FLAGS) \
http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl $<
-endif HAVE_XSLTPROC
+#
+# Generate DocBook/XML output formats (html/ps/pdf/txt)
+#
+
+masterdb = "$(sgmldbsdir)/masterdb$(suffix $@).xml"
+XSLTPROC_FLAGS = \
+ -o $@ \
+ --path "$(XORG_SGML_PATH)/X11" \
+ --stringparam target.database.document $(masterdb) \
+ --stringparam current.docid "$(<:.xml=)" \
+ --stringparam collect.xref.targets "no" \
+ --nonet \
+ --xinclude
+XSLTPROC_XHTML_FLAGS = \
+ --stringparam html.stylesheet "$(STYLESHEET_SRCDIR)/xorg.css" \
+ "$(STYLESHEET_SRCDIR)/xorg-xhtml.xsl"
+XSLTPROC_FO_FLAGS = \
+ "$(STYLESHEET_SRCDIR)/xorg-fo.xsl"
+
+shelf_DATA += $(docbook:.xml=.html)
+%.html: %.xml $(chapters)
+ $(AM_V_at)$(XMLLINT) $(XMLLINT_FLAGS) $<
+ $(AM_V_GEN)$(XSLTPROC) $(XSLTPROC_FLAGS) $(XSLTPROC_XHTML_FLAGS) $<
+
+if HAVE_FOP
+shelf_DATA += $(docbook:.xml=.pdf) $(docbook:.xml=.ps)
+nodist_noinst_DATA = $(docbook:.xml=.fo)
+%.fo: %.xml $(chapters)
+ $(AM_V_at)$(XMLLINT) $(XMLLINT_FLAGS) $< >$@
+ $(AM_V_GEN)$(XSLTPROC) $(XSLTPROC_FLAGS) $(XSLTPROC_FO_FLAGS) $<
+%.pdf: %.fo
+ $(AM_V_GEN)$(FOP) $(FOP_FLAGS) $(FOP_FLAGS) -fo $< -pdf $@
+%.ps: %.fo
+ $(AM_V_GEN)$(FOP) $(FOP_FLAGS) $(FOP_FLAGS) -fo $< -ps $@
+endif HAVE_FOP
+
+if HAVE_W3M
+W3M_FLAGS = -T text/html -dump -cols 70
+shelf_DATA += $(docbook:.xml=.txt)
+%.txt: %.html
+ $(AM_V_GEN)$(W3M) $(W3M_FLAGS) $< >$@
+endif HAVE_W3M
+
endif HAVE_STYLESHEETS
+endif HAVE_XSLTPROC
-CLEANFILES = $(shelf_DATA) $(sgmldbs_DATA)
+CLEANFILES = $(shelf_DATA) $(nodist_noinst_DATA) $(sgmldbs_DATA)
diff --git a/general/Makefile.am b/general/Makefile.am
index cddb7e1..2bb8c0c 100644
--- a/general/Makefile.am
+++ b/general/Makefile.am
@@ -2,7 +2,6 @@
SUBDIRS = fonts input graphics platforms
if ENABLE_DOCS
-if HAVE_XMLTO
# Main DocBook/XML files (DOCTYPE book)
docbook = \
@@ -14,8 +13,7 @@ docbook = \
# The location where the DocBook/XML files and their generated formats are installed
shelfdir = $(docdir)
-# Generate DocBook/XML output formats with or without stylesheets
+# Generate DocBook/XML output formats
include $(top_srcdir)/docbook.am
-endif HAVE_XMLTO
endif ENABLE_DOCS
diff --git a/general/fonts/Makefile.am b/general/fonts/Makefile.am
index d7f0944..e08e322 100644
--- a/general/fonts/Makefile.am
+++ b/general/fonts/Makefile.am
@@ -1,6 +1,5 @@
if ENABLE_DOCS
-if HAVE_XMLTO
# Main DocBook/XML files (DOCTYPE book)
docbook = fonts.xml
@@ -8,8 +7,7 @@ docbook = fonts.xml
# The location where the DocBook/XML files and their generated formats are installed
shelfdir = $(docdir)/fonts
-# Generate DocBook/XML output formats with or without stylesheets
+# Generate DocBook/XML output formats
include $(top_srcdir)/docbook.am
-endif HAVE_XMLTO
endif ENABLE_DOCS
diff --git a/general/graphics/Makefile.am b/general/graphics/Makefile.am
index 80cb437..67c78a5 100644
--- a/general/graphics/Makefile.am
+++ b/general/graphics/Makefile.am
@@ -1,6 +1,5 @@
if ENABLE_DOCS
-if HAVE_XMLTO
# Main DocBook/XML files (DOCTYPE book)
docbook = dps.xml
@@ -8,8 +7,7 @@ docbook = dps.xml
# The location where the DocBook/XML files and their generated formats are installed
shelfdir = $(docdir)/graphics
-# Generate DocBook/XML output formats with or without stylesheets
+# Generate DocBook/XML output formats
include $(top_srcdir)/docbook.am
-endif HAVE_XMLTO
endif ENABLE_DOCS
diff --git a/general/input/Makefile.am b/general/input/Makefile.am
index 5133f68..e54722d 100644
--- a/general/input/Makefile.am
+++ b/general/input/Makefile.am
@@ -1,6 +1,5 @@
if ENABLE_DOCS
-if HAVE_XMLTO
# Main DocBook/XML files (DOCTYPE book)
docbook = XKB-Config.xml XKB-Enhancing.xml
@@ -8,8 +7,7 @@ docbook = XKB-Config.xml XKB-Enhancing.xml
# The location where the DocBook/XML files and their generated formats are installed
shelfdir = $(docdir)/input
-# Generate DocBook/XML output formats with or without stylesheets
+# Generate DocBook/XML output formats
include $(top_srcdir)/docbook.am
-endif HAVE_XMLTO
endif ENABLE_DOCS
diff --git a/general/platforms/Makefile.am b/general/platforms/Makefile.am
index ee6c806..95db6d9 100644
--- a/general/platforms/Makefile.am
+++ b/general/platforms/Makefile.am
@@ -1,6 +1,5 @@
if ENABLE_DOCS
-if HAVE_XMLTO
# Main DocBook/XML files (DOCTYPE book)
docbook = Darwin.xml Solaris.xml
@@ -8,8 +7,7 @@ docbook = Darwin.xml Solaris.xml
# The location where the DocBook/XML files and their generated formats are installed
shelfdir = $(docdir)/platforms
-# Generate DocBook/XML output formats with or without stylesheets
+# Generate DocBook/XML output formats
include $(top_srcdir)/docbook.am
-endif HAVE_XMLTO
endif ENABLE_DOCS
diff --git a/specs/CTEXT/Makefile.am b/specs/CTEXT/Makefile.am
index f4a1a90..d809a8d 100644
--- a/specs/CTEXT/Makefile.am
+++ b/specs/CTEXT/Makefile.am
@@ -1,6 +1,5 @@
if ENABLE_SPECS
-if HAVE_XMLTO
# Main DocBook/XML files (DOCTYPE book)
docbook = ctext.xml
@@ -8,8 +7,7 @@ docbook = ctext.xml
# The location where the DocBook/XML files and their generated formats are installed
shelfdir = $(docdir)/ctext
-# Generate DocBook/XML output formats with or without stylesheets
+# Generate DocBook/XML output formats
include $(top_srcdir)/docbook.am
-endif HAVE_XMLTO
endif ENABLE_SPECS
diff --git a/specs/ICCCM/Makefile.am b/specs/ICCCM/Makefile.am
index 9e1fc34..634fa8f 100644
--- a/specs/ICCCM/Makefile.am
+++ b/specs/ICCCM/Makefile.am
@@ -1,6 +1,5 @@
if ENABLE_SPECS
-if HAVE_XMLTO
# Main DocBook/XML files (DOCTYPE book)
docbook = icccm.xml
@@ -8,8 +7,7 @@ docbook = icccm.xml
# The location where the DocBook/XML files and their generated formats are installed
shelfdir = $(docdir)/icccm
-# Generate DocBook/XML output formats with or without stylesheets
+# Generate DocBook/XML output formats
include $(top_srcdir)/docbook.am
-endif HAVE_XMLTO
endif ENABLE_SPECS
diff --git a/specs/XLFD/Makefile.am b/specs/XLFD/Makefile.am
index 73cd69c..4c2e14b 100644
--- a/specs/XLFD/Makefile.am
+++ b/specs/XLFD/Makefile.am
@@ -1,6 +1,5 @@
if ENABLE_SPECS
-if HAVE_XMLTO
# Main DocBook/XML files (DOCTYPE book)
docbook = xlfd.xml
@@ -8,8 +7,7 @@ docbook = xlfd.xml
# The location where the DocBook/XML files and their generated formats are installed
shelfdir = $(docdir)/xlfd
-# Generate DocBook/XML output formats with or without stylesheets
+# Generate DocBook/XML output formats
include $(top_srcdir)/docbook.am
-endif HAVE_XMLTO
endif ENABLE_SPECS
diff --git a/specs/Xext/Makefile.am b/specs/Xext/Makefile.am
index 1133dfe..f9c4253 100644
--- a/specs/Xext/Makefile.am
+++ b/specs/Xext/Makefile.am
@@ -1,6 +1,5 @@
if ENABLE_SPECS
-if HAVE_XMLTO
# Main DocBook/XML files (DOCTYPE book)
docbook = lbxalg.xml
@@ -11,5 +10,4 @@ shelfdir = $(docdir)/xext
# Generate DocBook/XML output formats with or without stylesheets
include $(top_srcdir)/docbook.am
-endif HAVE_XMLTO
endif ENABLE_SPECS
diff --git a/specs/Xserver/Makefile.am b/specs/Xserver/Makefile.am
index 71d486f..294b715 100644
--- a/specs/Xserver/Makefile.am
+++ b/specs/Xserver/Makefile.am
@@ -1,6 +1,5 @@
if ENABLE_SPECS
-if HAVE_XMLTO
# Main DocBook/XML files (DOCTYPE book)
docbook = analysis.xml appgroup.xml secint.xml XACE-Spec.xml
@@ -8,8 +7,7 @@ docbook = analysis.xml appgroup.xml secint.xml XACE-Spec.xml
# The location where the DocBook/XML files and their generated formats are installed
shelfdir = $(docdir)/Xserver
-# Generate DocBook/XML output formats with or without stylesheets
+# Generate DocBook/XML output formats
include $(top_srcdir)/docbook.am
-endif HAVE_XMLTO
endif ENABLE_SPECS
--
1.6.0.4
More information about the xorg-devel
mailing list