Reworked lxde-common man page generation.
authorJürgen Hötzel <juergen@archlinux.org>
Wed, 24 Jun 2009 21:37:57 +0000 (21:37 +0000)
committerJürgen Hötzel <juergen@archlinux.org>
Wed, 24 Jun 2009 21:37:57 +0000 (21:37 +0000)
Use Docbook-XML instead of SGML (files converted via sgml2xml-isoent
-x no-nl-in-tag): Removed SGML files.

Use xsltproc to generate manual pages (XSL-Stylesheet:
http://docbook.sourceforege.net/release/xsl/current/manpages/docbook.xsl)

Enable regeneration of man pages via "configure --enable-man"

acinclude.m4 [new file with mode: 0644]
configure.ac
man/Makefile.am
man/openbox-lxde.sgml [deleted file]
man/openbox-lxde.xml [new file with mode: 0644]

diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644 (file)
index 0000000..be626c5
--- /dev/null
@@ -0,0 +1,55 @@
+# Checks the location of the XML Catalog
+# Usage:
+#   JH_PATH_XML_CATALOG([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# Defines XMLCATALOG and XML_CATALOG_FILE substitutions
+AC_DEFUN([JH_PATH_XML_CATALOG],
+[
+  # check for the presence of the XML catalog
+  AC_ARG_WITH([xml-catalog],
+              AC_HELP_STRING([--with-xml-catalog=CATALOG],
+                             [path to xml catalog to use]),,
+              [with_xml_catalog=/etc/xml/catalog])
+  jh_found_xmlcatalog=true
+  XML_CATALOG_FILE="$with_xml_catalog"
+  AC_SUBST([XML_CATALOG_FILE])
+  AC_MSG_CHECKING([for XML catalog ($XML_CATALOG_FILE)])
+  if test -f "$XML_CATALOG_FILE"; then
+    AC_MSG_RESULT([found])
+  else
+    jh_found_xmlcatalog=false
+    AC_MSG_RESULT([not found])
+  fi
+
+  # check for the xmlcatalog program
+  AC_PATH_PROG(XMLCATALOG, xmlcatalog, no)
+  if test "x$XMLCATALOG" = xno; then
+    jh_found_xmlcatalog=false
+  fi
+
+  if $jh_found_xmlcatalog; then
+    ifelse([$1],,[:],[$1])
+  else
+    ifelse([$2],,[AC_MSG_ERROR([could not find XML catalog])],[$2])
+  fi
+])
+
+# Checks if a particular URI appears in the XML catalog
+# Usage:
+#   JH_CHECK_XML_CATALOG(URI, [FRIENDLY-NAME], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+AC_DEFUN([JH_CHECK_XML_CATALOG],
+[
+  AC_REQUIRE([JH_PATH_XML_CATALOG],[JH_PATH_XML_CATALOG(,[:])])dnl
+  AC_MSG_CHECKING([for ifelse([$2],,[$1],[$2]) in XML catalog])
+  if $jh_found_xmlcatalog && \
+     AC_RUN_LOG([$XMLCATALOG --noout "$XML_CATALOG_FILE" "$1" >&2]); then
+    AC_MSG_RESULT([found])
+    ifelse([$3],,,[$3
+])dnl
+  else
+    AC_MSG_RESULT([not found])
+    ifelse([$4],,
+       [AC_MSG_ERROR([could not find ifelse([$2],,[$1],[$2]) in XML catalog])],
+       [$4])
+  fi
+])
+
index 02a012b..b876b4b 100644 (file)
@@ -8,6 +8,12 @@ dnl AM_MAINTAINER_MODE
 AC_PROG_INSTALL
 AC_PROG_LN_S
 
+AC_ARG_ENABLE(man,
+       [AC_HELP_STRING([--enable-man],
+               [regenerate roff man pages from Docbook @<:@default=no@:>@])],
+       [enable_man="${enableval}"],
+       [enable_man=no]
+)
 # xsessions data of path for GDM
 AC_ARG_WITH([xsession-path],
     AS_HELP_STRING(
@@ -18,6 +24,21 @@ AC_ARG_WITH([xsession-path],
 AC_SUBST(xsesspath)
 
 
+if test x"$enable_man" = x"yes"; then
+       AC_PATH_PROG([XSLTPROC], [xsltproc])
+       if test -z "$XSLTPROC"; then
+               enable_man=no
+       fi
+
+       dnl check for DocBook DTD and stylesheets in the local catalog.
+       JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
+               [DocBook XML DTD V4.1.2], [], enable_man=no)
+       JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
+               [DocBook XSL Stylesheets >= 1.70.1], [], enable_man=no)
+fi
+
+AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test "x$enable_man" != "xno")
+
 AC_OUTPUT([
   Makefile
   icon-theme/Makefile
index ce7f507..9ac604b 100644 (file)
@@ -1,11 +1,28 @@
-
 dist_man_MANS = lxde-logout.1 startlxde.1 openbox-lxde.1
 
-EXTRA_DIST = openbox-lxde.sgml
+man_MANS = \
+       openbox-lxde.1
+
+man_XMANS = \
+       openbox-lxde.xml
+
+EXTRA_DIST = \
+       $(man_MANS) \
+       $(man_XMANS)
+
+
+if ENABLE_REGENERATE_MAN
+
+openbox-lxde.1: openbox-lxde.xml
+       $(XSLTPROC) -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<        
 
-dist-hook: openbox-lxde.1
+CLEANFILES = $(man_MANS) 
+else
 
-openbox-lxde.1: openbox-lxde.sgml
-       (test -f "`which docbook-to-man`" && docbook-to-man $< > $@) || \
-       (test -f "`which db2man`" && db2man $< > $@) || \
-       (test -f "`which docbook2man`" && docbook2man $< && mv OPENBOX-LXDE.1 $@)
+$(man_MANS):
+       @echo ""
+       @echo "Error: you need to run configure with '--enable-man'"
+       @echo "       in order to regenerate man pages."
+       @echo ""
+       @false
+endif
diff --git a/man/openbox-lxde.sgml b/man/openbox-lxde.sgml
deleted file mode 100644 (file)
index 3f6060d..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
-
-<!-- Process this file with docbook-to-man to generate an nroff manual
-     page: `docbook-to-man manpage.sgml > manpage.1'.  You may view
-     the manual page with: `docbook-to-man manpage.sgml | nroff -man |
-     less'.  A typical entry in a Makefile or Makefile.am is:
-
-manpage.1: manpage.sgml
-       docbook-to-man $< > $@
-
-    
-       The docbook-to-man binary is found in the docbook-to-man package.
-       Please remember that if you create the nroff version in one of the
-       debian/rules file targets (such as build), you will need to include
-       docbook-to-man in your Build-Depends control field.
-
-  -->
-
-  <!-- Fill in your name for FIRSTNAME and SURNAME. -->
-  <!ENTITY dhfirstname "<firstname>Ying-Chun</firstname>">
-  <!ENTITY dhsurname   "<surname>Liu</surname>">
-  <!-- Please adjust the date whenever revising the manpage. -->
-  <!ENTITY dhdate      "<date>April  20, 2008</date>">
-  <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
-       allowed: see man(7), man(1). -->
-  <!ENTITY dhsection   "<manvolnum>1</manvolnum>">
-  <!ENTITY dhemail     "<email>grandpaul@gmail.com</email>">
-  <!ENTITY dhusername  "paulliu">
-  <!ENTITY dhucpackage "<refentrytitle>OPENBOX-LXDE</refentrytitle>">
-  <!ENTITY dhpackage   "openbox-lxde">
-
-  <!ENTITY debian      "<productname>Debian</productname>">
-  <!ENTITY gnu         "<acronym>GNU</acronym>">
-  <!ENTITY gpl         "&gnu; <acronym>GPL</acronym>">
-]>
-
-<refentry>
-  <refentryinfo>
-    <address>
-      &dhemail;
-    </address>
-    <author>
-      &dhfirstname;
-      &dhsurname;
-    </author>
-    <copyright>
-      <year>2008</year>
-      <holder>&dhusername;</holder>
-    </copyright>
-    &dhdate;
-  </refentryinfo>
-  <refmeta>
-    &dhucpackage;
-
-    &dhsection;
-  </refmeta>
-  <refnamediv>
-    <refname>&dhpackage;</refname>
-
-    <refpurpose>wrapper to run openbox for LXDE</refpurpose>
-  </refnamediv>
-  <refsynopsisdiv>
-    <cmdsynopsis>
-      <command>&dhpackage;</command>
-    </cmdsynopsis>
-  </refsynopsisdiv>
-  <refsect1>
-    <title>DESCRIPTION</title>
-
-    <para>This manual page documents briefly the
-      <command>&dhpackage;</command> command.</para>
-
-    <para><command>&dhpackage;</command> is a wrapper script which 
-    runs openbox with LXDE specific config file.
-    </para>
-   
-  </refsect1>
-  <refsect1>
-    <title>AUTHOR</title>
-
-    <para>This manual page was written by &dhusername; &dhemail; for
-      the &debian; system (but may be used by others).  Permission is
-      granted to copy, distribute and/or modify this document under
-      the terms of the &gnu; General Public License, Version 2 any 
-      later version published by the Free Software Foundation.
-    </para>
-    <para>
-         On Debian systems, the complete text of the GNU General Public
-         License can be found in /usr/share/common-licenses/GPL.
-    </para>
-    <para>
-          The source code of this manual page should be in 
-          <filename>.sgml</filename> format. It is better not to modify
-          the <filename>.1</filename> file directly.
-    </para>
-
-  </refsect1>
-</refentry>
-
-<!-- Keep this comment at the end of the file
-Local variables:
-mode: sgml
-sgml-omittag:t
-sgml-shorttag:t
-sgml-minimize-attributes:nil
-sgml-always-quote-attributes:t
-sgml-indent-step:2
-sgml-indent-data:t
-sgml-parent-document:nil
-sgml-default-dtd-file:nil
-sgml-exposed-tags:nil
-sgml-local-catalogs:nil
-sgml-local-ecat-files:nil
-End:
--->
diff --git a/man/openbox-lxde.xml b/man/openbox-lxde.xml
new file mode 100644 (file)
index 0000000..478e1a9
--- /dev/null
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<refentry>  <refentryinfo>    <address>      <email>grandpaul@gmail.com</email>
+    </address>
+    <author>      <firstname>Ying-Chun</firstname>
+      <surname>Liu</surname>
+    </author>
+    <copyright>      <year>2008</year>
+      <holder>paulliu</holder>
+    </copyright>
+    <date>April  20, 2008</date>
+  </refentryinfo>
+  <refmeta>    <refentrytitle>OPENBOX-LXDE</refentrytitle>
+
+    <manvolnum>1</manvolnum>
+  </refmeta>
+  <refnamediv>    <refname>openbox-lxde</refname>
+
+    <refpurpose>wrapper to run openbox for LXDE</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>    <cmdsynopsis>      <command>openbox-lxde</command>
+    </cmdsynopsis>
+  </refsynopsisdiv>
+  <refsect1>    <title>DESCRIPTION</title>
+
+    <para>This manual page documents briefly the
+      <command>openbox-lxde</command> command.</para>
+
+    <para><command>openbox-lxde</command> is a wrapper script which 
+    runs openbox with LXDE specific config file.
+    </para>
+   
+  </refsect1>
+  <refsect1>    <title>AUTHOR</title>
+
+    <para>This manual page was written by paulliu <email>grandpaul@gmail.com</email> for
+      the <productname>Debian</productname> system (but may be used by others).  Permission is
+      granted to copy, distribute and/or modify this document under
+      the terms of the <acronym>GNU</acronym> General Public License, Version 2 any 
+      later version published by the Free Software Foundation.
+    </para>
+    <para>       On Debian systems, the complete text of the GNU General Public
+         License can be found in /usr/share/common-licenses/GPL.
+    </para>
+    <para>          The source code of this manual page should be in 
+          <filename>.sgml</filename> format. It is better not to modify
+          the <filename>.1</filename> file directly.
+    </para>
+
+  </refsect1></refentry>