[PATCH v2 RESEND 2/3] specs: build compose keys tables in specs/i18n/compose

Gaetan Nadon memsize at videotron.ca
Thu Aug 4 12:03:29 PDT 2011


Build the tables article together with the rest of the specs.
Make it transparent that the source in generated in nls.
Reuse docbook.am and get all the features such as olink.

The docbook article file stem and id must be the same. The new name
for the main article is libX11-keys. The new installation location
is $docdir/libX11/i18n/compose.

The nls dir retains the role of generating the DocBook/XML source
but does not build neither installs output formats or generated source.

The tables article now has to specify that each included locale
section is a dependency. It did not matter before as they were web links.

The xorg-sgml-doctools masterdb shall be updated to include this new doc.
Install location moved from doc/libX11/Compose to doc/libX11/i18n/compose.

Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
---
 Makefile.am                                  |    1 +
 configure.ac                                 |   15 ++++
 docbook-gen.am                               |   96 +++++++++++++++++++++++++
 nls/Makefile.am                              |   99 +-------------------------
 nls/xmlrules.in                              |   59 ---------------
 specs/i18n/Makefile.am                       |    2 +-
 specs/i18n/compose/.gitignore                |    2 +
 specs/i18n/compose/Makefile.am               |   29 ++++++++
 {nls => specs/i18n/compose}/compose-chart.pl |    2 +-
 9 files changed, 148 insertions(+), 157 deletions(-)
 create mode 100644 docbook-gen.am
 delete mode 100644 nls/xmlrules.in
 create mode 100644 specs/i18n/compose/.gitignore
 create mode 100644 specs/i18n/compose/Makefile.am
 rename {nls => specs/i18n/compose}/compose-chart.pl (99%)

diff --git a/Makefile.am b/Makefile.am
index 49c32bf..39e4bd9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,6 +3,7 @@ ORDER=src modules
 else
 ORDER=modules src
 endif
+# Order: nls before specs
 SUBDIRS=include $(ORDER) nls man specs
 
 ACLOCAL_AMFLAGS = -I m4
diff --git a/configure.ac b/configure.ac
index a449ba8..9eafeaf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -421,6 +421,20 @@ X11_LOCALEDIR="${X11_LOCALEDATADIR}"
 AX_DEFINE_DIR(XLOCALEDIR, X11_LOCALEDIR, [Location of libX11 locale data])
 AC_SUBST(X11_LOCALEDIR)
 
+locales="\
+ am_ET.UTF-8  armscii-8   C           el_GR.UTF-8  en_US.UTF-8  fi_FI.UTF-8 \
+ georgian-academy         georgian-ps ibm-cp1133   iscii-dev    isiri-3342 \
+ iso8859-1    iso8859-10  iso8859-11  iso8859-13   iso8859-14   iso8859-15 \
+ iso8859-2    iso8859-3   iso8859-4   iso8859-5    iso8859-6    iso8859-7 \
+ iso8859-8    iso8859-9   iso8859-9e  ja           ja.JIS       ja_JP.UTF-8\
+ ja.S90       ja.SJIS     ja.U90      ko           koi8-c       koi8-r \
+ koi8-u       ko_KR.UTF-8 microsoft-cp1251         microsoft-cp1255 \
+ microsoft-cp1256         mulelao-1   nokhchi-1    pt_BR.UTF-8  ru_RU.UTF-8 \
+ tatar-cyr    th_TH       th_TH.UTF-8 tscii-0      vi_VN.tcvn   vi_VN.viscii \
+ zh_CN        zh_CN.gb18030           zh_CN.gbk    zh_CN.UTF-8  zh_HK.big5 \
+ zh_HK.big5hkscs          zh_HK.UTF-8 zh_TW        zh_TW.big5   zh_TW.UTF-8"
+AC_SUBST(locales)
+
 XKEYSYMDB="${X11_DATADIR}/XKeysymDB"
 AX_DEFINE_DIR(XKEYSYMDB, XKEYSYMDB, [Location of keysym database])
 
@@ -451,6 +465,7 @@ AC_CONFIG_FILES([Makefile
 		nls/Makefile
 		specs/Makefile
 		specs/i18n/Makefile
+		specs/i18n/compose/Makefile
 		specs/i18n/framework/Makefile
 		specs/i18n/localedb/Makefile
 		specs/i18n/trans/Makefile
diff --git a/docbook-gen.am b/docbook-gen.am
new file mode 100644
index 0000000..292627e
--- /dev/null
+++ b/docbook-gen.am
@@ -0,0 +1,96 @@
+#
+# Generate output formats for a single DocBook/XML with/without chapters
+# This version of docbook.am handles cases where XML source is generated
+# The generated source must be cleaned, installed but not distributed
+#
+# Variables set by the calling Makefile:
+# shelfdir: the location where the docs/specs are installed. Typically $(docdir)
+# docbook:  the main DocBook/XML file, no chapters, appendix or image files
+# chapters: all files pulled in by an XInclude statement and images.
+#
+
+#
+# This makefile is intended for Users Documentation and Functional Specifications.
+# Do not use for Developer Documentation which is not installed and does not require olink.
+# Refer to http://www.x.org/releases/X11R7.6/doc/xorg-docs/ReleaseNotes.html#id2584393
+# for an explanation on documents classification.
+#
+
+# DocBook/XML generated output formats to be installed
+shelf_DATA = $(chapters) $(docbook)
+
+if HAVE_XMLTO
+#
+# Generate DocBook/XML output formats with or without stylesheets
+#
+
+# Stylesheets are available if the package xorg-sgml-doctools is installed
+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 = \
+	-x $(STYLESHEET_SRCDIR)/xorg-xhtml.xsl \
+	--stringparam html.stylesheet=$(STYLESHEET_SRCDIR)/xorg.css
+
+XMLTO_FO_FLAGS = \
+	-x $(STYLESHEET_SRCDIR)/xorg-fo.xsl
+endif HAVE_STYLESHEETS
+
+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
+
+#
+# Generate documents cross-reference target databases
+#
+
+# This is only possible if the xorg-sgml-doctools package is installed
+if HAVE_STYLESHEETS
+if HAVE_XSLTPROC
+
+# DocBook/XML generated document cross-reference database
+shelf_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 =					\
+	--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) \
+	http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl $<
+
+%.fo.db: %.xml $(chapters)
+	$(AM_V_GEN)$(XSLTPROC) $(XSLTPROC_FLAGS) \
+	http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl $<
+
+endif HAVE_XSLTPROC
+endif HAVE_STYLESHEETS
+endif HAVE_XMLTO
+
+CLEANFILES = $(shelf_DATA)
diff --git a/nls/Makefile.am b/nls/Makefile.am
index 94019a7..7dc4308 100644
--- a/nls/Makefile.am
+++ b/nls/Makefile.am
@@ -1,14 +1,10 @@
 
 x11localedir = $(X11_LOCALEDATADIR)
-specdir = $(docdir)/Compose
 CLEANFILES =
-XMLTO_FLAGS =
 SUFFIXES =
 
-include $(top_srcdir)/nls/xmlrules.in
-
 EXTRA_DIST = locale.alias.pre compose.dir.pre locale.dir.pre \
-	compose-check.pl compose-chart.pl
+	compose-check.pl
 
 x11locale_DATA = locale.alias locale.dir compose.dir
 
@@ -18,68 +14,6 @@ CLEANFILES += \
 	locale.dir locale.dir.l1 locale.dir.l2 \
 	XLC_LOCALE
 
-locales = \
-	am_ET.UTF-8		\
-	armscii-8		\
-	C			\
-	el_GR.UTF-8		\
-	en_US.UTF-8		\
-	fi_FI.UTF-8		\
-	georgian-academy	\
-	georgian-ps		\
-	ibm-cp1133		\
-	iscii-dev		\
-	isiri-3342		\
-	iso8859-1		\
-	iso8859-10		\
-	iso8859-11		\
-	iso8859-13		\
-	iso8859-14		\
-	iso8859-15		\
-	iso8859-2		\
-	iso8859-3		\
-	iso8859-4		\
-	iso8859-5		\
-	iso8859-6		\
-	iso8859-7		\
-	iso8859-8		\
-	iso8859-9		\
-	iso8859-9e		\
-	ja			\
-	ja.JIS			\
-	ja_JP.UTF-8		\
-	ja.S90			\
-	ja.SJIS			\
-	ja.U90			\
-	ko			\
-	koi8-c			\
-	koi8-r			\
-	koi8-u			\
-	ko_KR.UTF-8		\
-	microsoft-cp1251	\
-	microsoft-cp1255	\
-	microsoft-cp1256	\
-	mulelao-1		\
-	nokhchi-1		\
-	pt_BR.UTF-8		\
-	ru_RU.UTF-8		\
-	tatar-cyr		\
-	th_TH			\
-	th_TH.UTF-8		\
-	tscii-0			\
-	vi_VN.tcvn		\
-	vi_VN.viscii		\
-	zh_CN			\
-	zh_CN.gb18030		\
-	zh_CN.gbk		\
-	zh_CN.UTF-8		\
-	zh_HK.big5		\
-	zh_HK.big5hkscs		\
-	zh_HK.UTF-8		\
-	zh_TW			\
-	zh_TW.big5		\
-	zh_TW.UTF-8
-
 include $(top_srcdir)/cpprules.in
 
 # Global data files
@@ -103,16 +37,8 @@ locale.dir: locale.dir.pre
 	cat locale.dir.l2 locale.dir.l1 > locale.dir
 
 if HAVE_PERL
-doc_sources = Compose/index.xml
-
-Compose/index.xml:
-	@$(MKDIR_P) $(@D)
-	$(AM_V_GEN)$(PERL) $(srcdir)/compose-chart.pl \
-	 --index --output="$@" $(locales)
-
-clean-local: clean-Compose-dir
-clean-Compose-dir:
-	-rm -rf Compose
+TESTS_ENVIRONMENT = $(PERL)
+TESTS = $(srcdir)/compose-check.pl
 endif HAVE_PERL
 
 
@@ -124,22 +50,3 @@ nobase_x11locale_DATA = $(locales:%=%/XLC_LOCALE) $(locales:%=%/Compose)
 EXTRA_DIST += $(nobase_x11locale_DATA:%=%.pre)
 CLEANFILES += $(nobase_x11locale_DATA)
 
-if HAVE_PERL
-TESTS_ENVIRONMENT = $(PERL)
-TESTS = $(srcdir)/compose-check.pl
-
-COMPOSE_CHARTS = $(locales:%=%/Compose.xml)
-nodist_noinst_DATA = $(locales:%=Compose/%.xml)
-CLEANFILES += $(COMPOSE_CHARTS) $(doc_sources)
-
-XMLTO_FLAGS += -o $(@D)
-
-%/Compose.xml: %/Compose
-	$(AM_V_GEN)$(PERL) $(srcdir)/compose-chart.pl \
-	 --locale="$(@D)" --output="$@" $<
-
-Compose/%.xml: %/Compose.xml
-	@$(MKDIR_P) $(@D)
-	$(AM_V_GEN)cp $< $@
-
-endif HAVE_PERL
diff --git a/nls/xmlrules.in b/nls/xmlrules.in
deleted file mode 100644
index 5a6be24..0000000
--- a/nls/xmlrules.in
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-#
-
-if HAVE_XMLTO
-spec_DATA = $(doc_sources:.xml=.html)
-
-if HAVE_FOP
-spec_DATA += $(doc_sources:.xml=.ps) $(doc_sources:.xml=.pdf)
-endif
-
-if HAVE_XMLTO_TEXT
-spec_DATA += $(doc_sources:.xml=.txt)
-endif
-
-if HAVE_STYLESHEETS
-XMLTO_FLAGS += 			\
-	-m $(XSL_STYLESHEET)	\
-	--stringparam img.src.path=$(abs_builddir)/	\
-	--stringparam html.stylesheet=$(STYLESHEET_SRCDIR)/xorg.css
-endif
-
-CLEANFILES += $(spec_DATA)
-
-%.txt: %.xml $(dist_spec_DATA)
-	$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) txt $<
-
-%.html: %.xml $(dist_spec_DATA)
-	$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) xhtml-nochunks $<
-
-%.pdf: %.xml $(dist_spec_DATA)
-	$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop pdf $<
-
-%.ps: %.xml $(dist_spec_DATA)
-	$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop ps $<
-
-chunked-html: $(doc_sources)
-	$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) -o html xhtml $(doc_sources)
-
-endif HAVE_XMLTO
diff --git a/specs/i18n/Makefile.am b/specs/i18n/Makefile.am
index 019d56a..a69a51e 100644
--- a/specs/i18n/Makefile.am
+++ b/specs/i18n/Makefile.am
@@ -21,4 +21,4 @@
 # DEALINGS IN THE SOFTWARE.
 #
 
-SUBDIRS=framework localedb trans
+SUBDIRS=compose framework localedb trans
diff --git a/specs/i18n/compose/.gitignore b/specs/i18n/compose/.gitignore
new file mode 100644
index 0000000..c8f2485
--- /dev/null
+++ b/specs/i18n/compose/.gitignore
@@ -0,0 +1,2 @@
+# Generated DocBook XML from a perl script
+*.xml
diff --git a/specs/i18n/compose/Makefile.am b/specs/i18n/compose/Makefile.am
new file mode 100644
index 0000000..5d167bb
--- /dev/null
+++ b/specs/i18n/compose/Makefile.am
@@ -0,0 +1,29 @@
+if ENABLE_SPECS
+if HAVE_PERL
+
+# Main DocBook/XML files (DOCTYPE book)
+docbook = libX11-keys.xml
+
+# Included chapters, appendix, images
+chapters = $(locales:%=%.xml)
+
+# The location where the DocBook/XML generated formats are installed
+shelfdir = $(docdir)/i18n/compose
+
+# Generate DocBook/XML output formats with or without stylesheets
+# The XML source is generated and cleaned but not distributed
+include $(top_srcdir)/docbook-gen.am
+
+# Generated DocBook/XML source files using a perl script
+%.xml: $(top_builddir)/nls/%/Compose
+	$(AM_V_GEN)$(PERL) $(srcdir)/compose-chart.pl \
+	 --locale="$(@:.xml=)" --output="$@" $<
+
+libX11-keys.xml: $(locales:%=%.xml)
+	$(AM_V_GEN)$(PERL) $(srcdir)/compose-chart.pl \
+	 --index --output="$@" $(locales)
+
+endif HAVE_PERL
+endif ENABLE_SPECS
+
+EXTRA_DIST =  compose-chart.pl
diff --git a/nls/compose-chart.pl b/specs/i18n/compose/compose-chart.pl
similarity index 99%
rename from nls/compose-chart.pl
rename to specs/i18n/compose/compose-chart.pl
index 053c860..e2ac850 100755
--- a/nls/compose-chart.pl
+++ b/specs/i18n/compose/compose-chart.pl
@@ -82,7 +82,7 @@ if ($make_index) {
 	    qq(<?xml version="1.0" encoding="$charset" ?>),
 	    q(<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"),
 	    q( "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">),
-	    q(<article id="compose-index">),
+	    q(<article id="libX11-keys">),
 	    q(  <articleinfo>),
 	    q(    <title>Xlib Compose Key Charts</title>),
 	    q(  </articleinfo>),
-- 
1.7.4.1



More information about the xorg-devel mailing list