diff mbox

[v3] libstdc++/47145

Message ID 20110307161454.58c856a2@shotwell
State New
Headers show

Commit Message

Benjamin Kosnik March 8, 2011, 12:14 a.m. UTC
Conditionally set XSL_STYLE_DIR at configure time for either debian or
fedora/RHEL based systems. As discussed in bugzilla. 

For convenience, this patch steps around the STYLESHEET_FLAG question by
just punting to the net for validation only. STYLESHEET_FLAG is only
used in the validation makefile rules, and these are not in the
critical path for things like "make html" where local docbook
stylesheet files are required. So a bit of a hit time-wise is not a
major negative, whereas all developers being on the same page with
respect to validation and being able to do it even w/o the rest of the
stylesheets seems like a clear win. 

Matthias, this should allow you to kill

libstdc++-stylesheets:
  Fix libstdc++ stylesheet detection

from your 4.6.0 patchset

-benjamin

tested x86/linux
tested x86/linux -x- arm-eabi

Comments

Jonathan Wakely March 8, 2011, 9:19 a.m. UTC | #1
On 8 March 2011 00:14, Benjamin Kosnik wrote:
>
> Conditionally set XSL_STYLE_DIR at configure time for either debian or
> fedora/RHEL based systems. As discussed in bugzilla.
>
> For convenience, this patch steps around the STYLESHEET_FLAG question by
> just punting to the net for validation only.

But it still uses --nonet in that step, right? So it doesn't use the
network at all, the mapping from the canonical stylesheet URL to a
local file is done by the system's XML catalog, /etc/xml/catalog on my
Fedora box.

I thought we could do the same for the actual transformation rules
too, using the canonical URL with --nonet and letting the system map
it to a local file, and failing if the file is not present, because
--nonet prevents it fetching a remote stylesheet.

I suspect this is fine for the majority of people now and good enough for 4.6

Jonathan
Benjamin Kosnik March 8, 2011, 5:30 p.m. UTC | #2
> > For convenience, this patch steps around the STYLESHEET_FLAG
> > question by just punting to the net for validation only.
> 
> But it still uses --nonet in that step, right? So it doesn't use the
> network at all, the mapping from the canonical stylesheet URL to a
> local file is done by the system's XML catalog, /etc/xml/catalog on my
> Fedora box.

No, for validation only I took out --nonet. Meaning, 'make
doc-validate-docbook' searches for a schema on the net and validates
against that, not a local thing. It takes longer now to validate, but I
don't think it is onerous.

At least, that was my intent. Double check my work please.

Ideally we could move to RelaxNG anyway, at some point. uBut we will
probably have to do something similar about finding the canonical thing,
regardless of the specific schema used to validate.
 
> I thought we could do the same for the actual transformation rules
> too, using the canonical URL with --nonet and letting the system map
> it to a local file, and failing if the file is not present, because
> --nonet prevents it fetching a remote stylesheet.

I couldn't figure out how to make that work. I tried setting
XSL_STYLE_DIR to the docbook 5 URL but.... no dice. I'm not quite sure
what the problem is.

> I suspect this is fine for the majority of people now and good enough
> for 4.6

Yeah, me too.

It seems to be the way we need to go, at the very least. Baby steps.
Let's see if this at least unifies the linux users.

-benjamin
Jonathan Wakely March 8, 2011, 9:30 p.m. UTC | #3
On 8 March 2011 17:30, Benjamin Kosnik wrote:
>
>> > For convenience, this patch steps around the STYLESHEET_FLAG
>> > question by just punting to the net for validation only.
>>
>> But it still uses --nonet in that step, right? So it doesn't use the
>> network at all, the mapping from the canonical stylesheet URL to a
>> local file is done by the system's XML catalog, /etc/xml/catalog on my
>> Fedora box.
>
> No, for validation only I took out --nonet. Meaning, 'make
> doc-validate-docbook' searches for a schema on the net and validates
> against that, not a local thing. It takes longer now to validate, but I
> don't think it is onerous.
>
> At least, that was my intent. Double check my work please.

Ah, sorry, I missed that bit of the change, will take another look.
diff mbox

Patch

2011-03-04  Benjamin Kosnik  <bkoz@chula>

	    PR libstdc++/47145
	    * acinclude.m4 (GLIBCXX_CONFIGURE_DOCBOOK): Define.
	    * configure.ac: Use it.
	    * doc/Makefile.am (XSL_STYLE_DIR): Set at configure time.
	    * configure: Regenerate.
	    * doc/Makefile.in: Regenerate.


Index: configure.ac
===================================================================
--- configure.ac	(revision 170762)
+++ configure.ac	(working copy)
@@ -344,12 +344,8 @@ 
 # Check for docbook
 AC_CHECK_PROG([XSLTPROC], xsltproc, yes, no)
 AC_CHECK_PROG([XMLLINT], xmllint, yes, no)
+GLIBCXX_CONFIGURE_DOCBOOK
 
-glibcxx_stylesheets=no
-if test -f /usr/share/sgml/docbook/xsl-ns-stylesheets/VERSION; then
-  glibcxx_stylesheets=yes
-fi
-
 # Check for xml/html dependencies.
 AM_CONDITIONAL(BUILD_XML,
 	       test $ac_cv_prog_DOXYGEN = "yes" &&
@@ -378,7 +374,7 @@ 
 	       test $ac_cv_prog_PDFLATEX = "yes")
 
 AC_CHECK_PROG([RUBY], ruby, yes, no)
-AC_CHECK_PROG([DBTOEPUB], dbtoepubm, yes, no)
+AC_CHECK_PROG([DBTOEPUB], dbtoepub, yes, no)
 AM_CONDITIONAL(BUILD_EPUB,
 	       test $ac_cv_prog_RUBY = "yes" &&
 	       test $ac_cv_prog_DBTOEPUB = "yes")
Index: acinclude.m4
===================================================================
--- acinclude.m4	(revision 170762)
+++ acinclude.m4	(working copy)
@@ -622,5 +621,48 @@ 
 
 
+dnl
+dnl Does any necessary configuration of the documentation directory.
+dnl
+dnl XSLTPROC must be set before this
+dnl
+dnl Sets:
+dnl  glibcxx_stylesheets
+dnl Substs:
+dnl  XSL_STYLE_DIR
+dnl
+AC_DEFUN([GLIBCXX_CONFIGURE_DOCBOOK], [
+
+AC_MSG_CHECKING([for stylesheets used in generation of documentation])
+glibcxx_stylesheets=no
+if test x${XSLTPROC} = xyes && echo '<title/>' | xsltproc --noout --nonet --xinclude http://docbook.sourceforge.net/release/xsl-ns/current/xhtml-1_1/docbook.xsl - 2>/dev/null; then
+  glibcxx_stylesheets=yes
+fi
+AC_MSG_RESULT($glibcxx_stylesheets)
+
+AC_MSG_CHECKING([for local stylesheet directory])
+glibcxx_local_stylesheets=no
+if test x"$glibcxx_stylesheets" = x"yes"; then
+  if test -d /usr/share/sgml/docbook/xsl-ns-stylesheets; then
+    glibcxx_local_stylesheets=yes
+    XSL_STYLE_DIR=/usr/share/sgml/docbook/xsl-ns-stylesheets
+  fi
+  if test -d /usr/share/xml/docbook/stylesheet/docbook-xsl-ns; then
+    glibcxx_local_stylesheets=yes
+    XSL_STYLE_DIR=/usr/share/xml/docbook/stylesheet/docbook-xsl-ns
+  fi
+fi
+AC_MSG_RESULT($glibcxx_local_stylesheets)
+
+if test x"$glibcxx_local_stylesheets" = x"yes"; then
+  AC_SUBST(XSL_STYLE_DIR)
+  AC_MSG_NOTICE($XSL_STYLE_DIR)
+else
+  glibcxx_stylesheets=no
+fi
+])
+
+
+dnl
 dnl Set up *_INCLUDES variables for all sundry Makefile.am's.
 dnl
 dnl Substs:
Index: doc/Makefile.am
===================================================================
--- doc/Makefile.am	(revision 170762)
+++ doc/Makefile.am	(working copy)
@@ -368,12 +368,9 @@ 
 
 XSLTPROC       = xsltproc
 XSLTPROC_FLAGS = --nonet --xinclude
-#XSL_STYLE_DIR = /usr/share/sgml/docbook/xsl-stylesheets
-XSL_STYLE_DIR = /usr/share/sgml/docbook/xsl-ns-stylesheets
+#XSL_STYLE_DIR = /usr/share/xml/docbook/stylesheet/docbook-xsl-ns
+#XSL_STYLE_DIR = /usr/share/sgml/docbook/xsl-ns-stylesheets
 XSL_FO_STYLE = $(XSL_STYLE_DIR)/fo/docbook.xsl
-#XSL_HTML_STYLE = $(XSL_STYLE_DIR)/xhtml/chunk.xsl
-#XSL_HTML_SINGLE_STYLE = $(XSL_STYLE_DIR)/xhtml/onechunk.xsl
-#XSL_HTML_SINGLE_STYLE = $(XSL_STYLE_DIR)/xhtml/docbook.xsl
 XSL_HTML_STYLE = $(XSL_STYLE_DIR)/xhtml-1_1/chunk.xsl
 XSL_HTML_SINGLE_STYLE = $(XSL_STYLE_DIR)/xhtml-1_1/docbook.xsl
 XSL_EPUB_STYLE = $(XSL_STYLE_DIR)/epub/docbook.xsl
@@ -398,13 +395,11 @@ 
 
 # Validate existing XML structure.
 XMLLINT = xmllint
-#LINT_FLAGS = --debug --xinclude --nsclean --postvalid --nowarning --nonet
-#LINT_FLAGS = --xinclude --postvalid --noent --noblanks --noout
-LINT_FLAGS = --debug --xinclude --noent --noblanks  --nonet --noout
-#SCHEMA_FLAGS = --relaxng /usr/share/xml/docbook5/schema/rng/5.0/docbookxi.rng
-SCHEMA_FLAGS = --dtdvalid /usr/share/xml/docbook5/schema/dtd/5.0/docbook.dtd
+LINT_FLAGS = --debug --xinclude --noent --noblanks --noout
+SCHEMA_FLAGS = http://www.docbook.org/xml/5.0/dtd/docbook.dtd
+#SCHEMA_FLAGS = --nonet /usr/share/xml/docbook5/schema/dtd/5.0/docbook.dtd
+XMLLINT_VALID_FLAGS = $(LINT_FLAGS) --dtdvalid $(SCHEMA_FLAGS)
 XMLLINT_FLAGS = --xinclude --nsclean --c14n --noent --noblanks --nocdata
-XMLLINT_VALID_FLAGS = $(LINT_FLAGS) $(SCHEMA_FLAGS)
 doc-xml-validate-docbook: $(xml_sources)
 	@echo "Generating XML validation log..."
 	$(XMLLINT) $(XMLLINT_VALID_FLAGS) ${top_srcdir}/doc/xml/spine.xml