[gimp-help-2/buildsystem/remove-stylebase] [make] Remove configure option "--with-xsl"



commit 4449d9854df82fa9151693a7836def0d9269187e
Author: Ulf-D. Ehlert <ulfehlert svn gnome org>
Date:   Wed Jun 9 13:11:28 2010 +0200

    [make] Remove configure option "--with-xsl"
    
    Now users cannot configure gimp-help-2 to use a custom path to their
    DocBook XSL stylesheets any more. Instead, they are encouraged (ok,
    they are forced...) to configure their XML catalog so that the base
    canonical URI ("http://docbook.sourceforge.net/...";) is resolved
    automatically.
    As a compensation, a simple test for working DocBook XSL stylesheets
    is added which displays a warning if the canonical URI can't be
    resolved and a hint how to fix that.

 Makefile.GNU                                       |   14 ------
 acinclude.m4                                       |   47 ++++++++++++++++++++
 configure.ac                                       |   23 ++++-----
 make.d/test/have_docbook_xsl.sh                    |   26 +++++++++++
 .../{htmlalternate.xsl.in => htmlalternate.xsl}    |   16 +++---
 stylesheets/{plainhtml.xsl.in => plainhtml.xsl}    |   12 +++---
 6 files changed, 97 insertions(+), 41 deletions(-)
---
diff --git a/Makefile.GNU b/Makefile.GNU
index b323cb3..5d9bf06 100644
--- a/Makefile.GNU
+++ b/Makefile.GNU
@@ -603,20 +603,6 @@ log:
 
 
 ########################################################################
-####            Make XSL styesheets for HTML                        ####
-########################################################################
-
-# TODO
-stylesheets/plainhtml.xsl: stylesheets/plainhtml.xsl.in
-	$(msg) "[XSL] $@"
-	$(cmd) $(SED) -e s,@STYLEBASE@,http://docbook.sourceforge.net/release/xsl/current, $< > $@
-
-stylesheets/htmlalternate.xsl: stylesheets/htmlalternate.xsl.in
-	$(msg) "[XSL] $@"
-	$(cmd) cp $< $@
-
-
-########################################################################
 ####            Make HTML files:  XML --> HTML                      ####
 ########################################################################
 
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644
index 0000000..b70ba7a
--- /dev/null
+++ b/acinclude.m4
@@ -0,0 +1,47 @@
+# This file is part of the gimp-help-2 project.
+# Copyright (C) 2010 The GIMP Documentation Team
+# License: GPL
+#
+
+# GIMPHELP_DOCBOOK_CHECK_CONFIG([STYLEBASE])
+#
+# Check if DocBook XSL stylesheets are configured.
+# --------------------------------------------------------------
+AC_DEFUN([GIMPHELP_DOCBOOK_CHECK_CONFIG],
+[AC_CACHE_CHECK([for a working DocBook XSL Stylesheets configuration],
+[gh_cv_dcbk_xsl_conf],
+[gh_cv_dcbk_xsl_conf=unknown
+gh_tmpdir="${TMPDIR:-/tmp}"
+test -d "${gh_tmpdir}" && test -w "${gh_tmpdir}" || gh_tmpdir=.
+cat <<EOF>${gh_tmpdir}/docbooktest.xml
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+                         "http://www.docbook.org/xml/4.3/docbookx.dtd";>
+<article><para>Hello world!</para></article>
+EOF
+xsltproc --nonet --noout $1/xhtml/docbook.xsl ${gh_tmpdir}/docbooktest.xml >/dev/null 2>&1
+if test $? -eq 0; then
+    gh_cv_dcbk_xsl_conf=yes
+else
+    gh_cv_dcbk_xsl_conf=no
+fi]
+)
+rm -f ${gh_tmpdir}/docbooktest.xml
+HAVE_DOCBOOK_XSL=$gh_cv_dcbk_xsl_conf
+if test $gh_cv_dcbk_xsl_conf != yes; then
+    AC_MSG_WARN([
+    ***
+    *** Looks like your DocBook XSL Stylesheets don't work.
+    *** Possible reasons:
+    ***   (a) DocBook XSL Stylesheets are not installed;
+    ***   (b) DocBook XSL Stylesheets are not correctly configured
+    ***      (in this case you may have to add a catalog entry
+    ***        <rewriteURI uriStartString="$1/"
+    ***            file:///path/to/your/xml/docbook/stylesheets"/>
+    ***      or
+    ***        <rewriteSystem systemIdStartString="$1/"
+    ***            file:///path/to/your/xml/docbook/stylesheets"/>
+    ***      to your XML catalog file (usually /etc/xml/catalog)).
+    ***])
+fi
+])
diff --git a/configure.ac b/configure.ac
index 2d48ec5..3266c26 100644
--- a/configure.ac
+++ b/configure.ac
@@ -241,22 +241,21 @@ AM_CONDITIONAL(HAVE_PNGOPTIMIZERS, test -n "$PNGNQ" && test -n "$PNGCRUSH")
 
 STYLEBASE='http://docbook.sourceforge.net/release/xsl/current'
 
-
-#  Allow to explicitely specify the stylesheet location
-#  in case the XML catalog doesn't exist or is broken.
-
+#  Do not allow to explicitely specify the stylesheet location any more.
 AC_ARG_WITH(xsl,
-            AS_HELP_STRING([--with-xsl=<basedir>],
-                           [path to the base of the DocBook Modular Stylesheets
-                            (deprecated - fix your DocBook Stylesheets package!)
-                           ]))
+            AS_HELP_STRING([--with-xsl=<basedir>], [obsolete]))
 
 if test "x$with_xsl" != "x"; then
-  STYLEBASE="$with_xsl"
-  AC_CHECK_FILE($STYLEBASE/xhtml/docbook.xsl, ,
-                AC_MSG_ERROR([** Couldn't find docbook.xsl in $STYLEBASE/xhtml]))
+    AC_MSG_WARN([
+    ** Ignoring '--with-xsl' -- this option is obsolete!
+    ** (Fix your DocBook XSL Stylesheets configuration if necessary!)])
 fi
 
+# Quick test for DocBook XSL Stylesheets
+
+GIMPHELP_DOCBOOK_CHECK_CONFIG($STYLEBASE)
+
+# TODO: remove this
 AC_SUBST(STYLEBASE)
 
 
@@ -295,8 +294,6 @@ AC_CONFIG_FILES([
 Makefile
 quickreference/Makefile
 omf/gimp-C.omf
-stylesheets/plainhtml.xsl
-stylesheets/htmlalternate.xsl
 ])
 
 AC_OUTPUT
diff --git a/make.d/test/have_docbook_xsl.sh b/make.d/test/have_docbook_xsl.sh
new file mode 100755
index 0000000..33521b8
--- /dev/null
+++ b/make.d/test/have_docbook_xsl.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+test -z "$2" || {
+    echo >&2 "Usage: $0 [stylebase]"
+    exit 64
+}
+
+stylebase=${1:-http://docbook.sourceforge.net/release/xsl/current}
+
+tmpdir="${TMPDIR:-/tmp}"
+test -d "${tmpdir}" && test -w "${tmpdir}" || tmpdir=.
+
+cat <<EOF>${tmpdir}/docbooktest.xml
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+                         "http://www.docbook.org/xml/4.3/docbookx.dtd";>
+<article><para>Hello world!</para></article>
+EOF
+
+xsltproc --nonet --noout --nomkdir --nowrite --novalid \
+    $stylebase/xhtml/docbook.xsl ${tmpdir}/docbooktest.xml >/dev/null 2>&1
+error=$?
+rm -f ${tmpdir}/docbooktest.xml
+
+exit $error
+
diff --git a/stylesheets/htmlalternate.xsl.in b/stylesheets/htmlalternate.xsl
similarity index 98%
rename from stylesheets/htmlalternate.xsl.in
rename to stylesheets/htmlalternate.xsl
index 4940d67..de6d3a2 100644
--- a/stylesheets/htmlalternate.xsl.in
+++ b/stylesheets/htmlalternate.xsl
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- This file is part of the gimp-help-2 project and is 
+<!-- This file is part of the gimp-help-2 project and is
      (C) 2002, 2003, 2004, 2005, 2006, 2007 Daniel Egger, Róman Joost
      You may use this file in accordance to the GNU Free Documentation License
      Version 1.1 which is available from http://www.gnu.org. -->
@@ -11,18 +11,18 @@
 
   <!--
       template: output.html.stylesheets
-  
+
       This is a modified copy of the docbook-xsl-1.72 template;
       it will replace the original template.
       Its string value is a list of HTML <link> tags with attribute
-      rel="stylesheet" as produced by the the original docbook-xsl 
+      rel="stylesheet" as produced by the the original docbook-xsl
       template, and (if xsl:parameter "html.stylesheet.alternate" is
       not empty) a list of HTML <link> tags with attributes
       rel="alternate stylesheet" and title="[filename without '.css']".
   -->
   <xsl:template name="output.html.stylesheets">
     <xsl:param name="stylesheets" select="''"/>
-  
+
     <xsl:choose>
       <xsl:when test="contains($stylesheets, ' ')">
         <link rel="stylesheet" href="{substring-before($stylesheets, ' ')}">
@@ -44,7 +44,7 @@
             </xsl:attribute>
           </xsl:if>
         </link>
-  
+
         <!-- here's our modification, calling the new template below -->
         <xsl:if test="$html.stylesheet.alternate != ''">
           <xsl:call-template name="output.html.stylesheet.alternates">
@@ -55,10 +55,10 @@
       </xsl:when>
     </xsl:choose>
   </xsl:template>
-  
+
   <!--
       template: output.html.stylesheets.alternates
-  
+
       This is also a modified copy of the docbook-xsl-1.72 template.
       It produces the HTML <link> tags for alternate styleshhets,
       using the file's basename without '.css' extension as the
@@ -67,7 +67,7 @@
   <xsl:template name="output.html.stylesheet.alternates">
     <!-- parameter: a space-separated list of filenames -->
     <xsl:param name="alternates" select="''"/>
-  
+
     <xsl:choose>
       <xsl:when test="contains($alternates, ' ')">
         <xsl:variable name="href" select="substring-before($alternates, ' ')"/>
diff --git a/stylesheets/plainhtml.xsl.in b/stylesheets/plainhtml.xsl
similarity index 98%
rename from stylesheets/plainhtml.xsl.in
rename to stylesheets/plainhtml.xsl
index 342d0f1..f80ec45 100644
--- a/stylesheets/plainhtml.xsl.in
+++ b/stylesheets/plainhtml.xsl
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- This file is part of the gimp-help-2 project and is 
+<!-- This file is part of the gimp-help-2 project and is
      (C) 2002, 2003, 2004, 2005, 2006 Daniel Egger, Róman Joost
      You may use this file in accordance to the GNU Free Documentation License
      Version 1.1 which is available from http://www.gnu.org. -->
      <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0"
          xmlns="http://www.w3.org/1999/xhtml";>
-         <xsl:import href="@STYLEBASE@/xhtml/chunk.xsl" />
+         <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk.xsl"; />
 
          <xsl:include href="htmlalternate.xsl" />
 
@@ -17,7 +17,7 @@
          <xsl:param name="chunk.section.depth" select="2" />
          <!-- doesn't work correctly currently
          <xsl:param name="chunk.tocs.and.lots" select="1" />
-         <xsl:param name="chunk.seperate.lots" select="1" /> 
+         <xsl:param name="chunk.seperate.lots" select="1" />
          -->
          <xsl:param name="chunker.output.indent" select="'yes'" />
 
@@ -90,8 +90,8 @@
              <xsl:variable name="row2" select="($prev and $navig.showtitles != 0)
                  or (generate-id($home) != generate-id(.)
                  or $nav.context = 'toc')
-                 or ($chunk.tocs.and.lots != 0                   
-                 and $nav.context != 'toc')                      
+                 or ($chunk.tocs.and.lots != 0
+                 and $nav.context != 'toc')
                  or ($next and $navig.showtitles != 0)"/>
 
              <xsl:if test="$suppress.navigation = '0' and $suppress.footer.navigation = '0'">
@@ -224,7 +224,7 @@
          </xsl:template>
 
          <!-- For unknown reasons the original version of the template starting
-         from August 2004 would unwind the path of the sourcecode several 
+         from August 2004 would unwind the path of the sourcecode several
          times into the processing of the fileref thus prepending the path
          a few times into the src attribute of the img tag -->
          <xsl:template name="mediaobject.filename">



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]