Reworked lxsession man page generation.
authorJürgen Hötzel <juergen@archlinux.org>
Wed, 24 Jun 2009 21:20:14 +0000 (21:20 +0000)
committerJürgen Hötzel <juergen@archlinux.org>
Wed, 24 Jun 2009 21:20:14 +0000 (21:20 +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/lxsession-logout.sgml [deleted file]
man/lxsession-logout.xml [new file with mode: 0644]
man/lxsession.sgml [deleted file]
man/lxsession.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 71ed2f8..8f1212a 100644 (file)
@@ -13,6 +13,13 @@ AM_PROG_CC_C_O
 AC_CHECK_FUNC([mkstemp],
    AC_DEFINE(HAS_MKSTEMP,1,[Define to 1 if you have the 'mkstemp' function.]))
 
+AC_ARG_ENABLE(man,
+       [AC_HELP_STRING([--enable-man],
+               [regenerate roff man pages from Docbook @<:@default=no@:>@])],
+       [enable_man="${enableval}"],
+       [enable_man=no]
+)
+
 PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.6.0])
 AC_SUBST(GTK_CFLAGS)
 AC_SUBST(GTK_LIBS)
@@ -51,6 +58,21 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
 ALL_LINGUAS="af ar cs da de es et eu fa fi fr gl hr hu id it ja ko lt ml ms nb nl nn pl ps pt pt_BR ru sk sl sv tr uk ur ur_PK vi zh_CN zh_TW"
 AM_GLIB_GNU_GETTEXT
 
+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
   lxsession/Makefile
index fcb6af5..be27702 100644 (file)
@@ -1,16 +1,33 @@
+man_MANS = \
+       lxsession.1 \
+       lxsession-logout.1
 
-dist_man_MANS = lxsession.1 lxsession-logout.1
+man_XMANS = \
+       lxsession.xml \
+       lxsession-logout.xml
 
-EXTRA_DIST = lxsession.sgml lxsession-logout.sgml
+EXTRA_DIST = \
+       $(man_MANS) \
+       $(man_XMANS)
 
-dist-hook: lxsession.1 lxsession-logout.1
 
-lxsession.1: lxsession.sgml
-       (test -f "`which docbook-to-man`" && docbook-to-man $< > $@) || \
-       (test -f "`which db2man`" && db2man $< > $@) || \
-       (test -f "`which docbook2man`" && docbook2man $< > $@)
+if ENABLE_REGENERATE_MAN
+
+lxsession.1: lxsession.xml
+       $(XSLTPROC) -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
+
+lxsession-logout.1: lxsession-logout.xml
+       $(XSLTPROC) -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<        
+
+CLEANFILES = $(man_MANS) 
+else
+
+$(man_MANS):
+       @echo ""
+       @echo "Error: you need to run configure with '--enable-man'"
+       @echo "       in order to regenerate man pages."
+       @echo ""
+       @false
+endif
+
 
-lxsession-logout.1: lxsession-logout.sgml
-       (test -f "`which docbook-to-man`" && docbook-to-man $< > $@) || \
-       (test -f "`which db2man`" && db2man $< > $@) || \
-       (test -f "`which docbook2man`" && docbook2man $< > $@)
diff --git a/man/lxsession-logout.sgml b/man/lxsession-logout.sgml
deleted file mode 100644 (file)
index f38be07..0000000
+++ /dev/null
@@ -1,155 +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>March  2, 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>LXSESSION</refentrytitle>">
-  <!ENTITY dhpackage   "lxsession-logout">
-
-  <!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>program to logout from LXSession</refpurpose>
-  </refnamediv>
-  <refsynopsisdiv>
-    <cmdsynopsis>
-      <command>&dhpackage;</command>
-      <arg rep='repeat'><option>options</option></arg>
-    </cmdsynopsis>
-  </refsynopsisdiv>
-  <refsect1>
-    <title>DESCRIPTION</title>
-
-    <para>This manual page documents briefly the
-      <command>&dhpackage;</command> command.</para>
-
-    <para><command>&dhpackage;</command> is a program that to logout 
-       from LXSession. It gives a good-looking logout dialog.
-    </para>
-   
-  </refsect1>
-
-  <refsect1>
-    <title>OPTIONS</title>
-
-    <para>These programs follow the usual &gnu; command line syntax,
-      with long options starting with two dashes (`-').  A summary of
-      options is included below.  
-    </para>
-
-    <variablelist>
-      <varlistentry>
-        <term>
-          <option>--prompt <replaceable>Your custom message</replaceable></option>
-        </term>
-        <listitem>
-          <para>Customize the logout message.</para>
-        </listitem>
-      </varlistentry>
-      <varlistentry>
-        <term>
-          <option>--banner <replaceable>Your logo</replaceable></option>
-        </term>
-        <listitem>
-          <para>Customize the logout logo.</para>
-        </listitem>
-      </varlistentry>
-      <varlistentry>
-        <term>
-          <option>--side left|top|right|bottom</option>
-        </term>
-        <listitem>
-          <para>The position of the logo.</para>
-        </listitem>
-      </varlistentry>
-    </variablelist>
-  </refsect1>
-
-
-  <refsect1>
-    <title>SEE ALSO</title>
-
-    <para>lxsession (1).</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>
-
-  </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/lxsession-logout.xml b/man/lxsession-logout.xml
new file mode 100644 (file)
index 0000000..0111242
--- /dev/null
@@ -0,0 +1,78 @@
+<?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>March  2, 2008</date>
+  </refentryinfo>
+  <refmeta>    <refentrytitle>LXSESSION</refentrytitle>
+
+    <manvolnum>1</manvolnum>
+  </refmeta>
+  <refnamediv>    <refname>lxsession-logout</refname>
+
+    <refpurpose>program to logout from LXSession</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>    <cmdsynopsis>      <command>lxsession-logout</command>
+      <arg rep="repeat"><option>options</option></arg>
+    </cmdsynopsis>
+  </refsynopsisdiv>
+  <refsect1>    <title>DESCRIPTION</title>
+
+    <para>This manual page documents briefly the
+      <command>lxsession-logout</command> command.</para>
+
+    <para><command>lxsession-logout</command> is a program that to logout 
+       from LXSession. It gives a good-looking logout dialog.
+    </para>
+   
+  </refsect1>
+
+  <refsect1>    <title>OPTIONS</title>
+
+    <para>These programs follow the usual <acronym>GNU</acronym> command line syntax,
+      with long options starting with two dashes (`-').  A summary of
+      options is included below.  
+    </para>
+
+    <variablelist>      <varlistentry>        <term>          <option>--prompt <replaceable>Your custom message</replaceable></option>
+        </term>
+        <listitem>          <para>Customize the logout message.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>        <term>          <option>--banner <replaceable>Your logo</replaceable></option>
+        </term>
+        <listitem>          <para>Customize the logout logo.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>        <term>          <option>--side left|top|right|bottom</option>
+        </term>
+        <listitem>          <para>The position of the logo.</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+  </refsect1>
+
+
+  <refsect1>    <title>SEE ALSO</title>
+
+    <para>lxsession (1).</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>
+
+  </refsect1></refentry>
diff --git a/man/lxsession.sgml b/man/lxsession.sgml
deleted file mode 100644 (file)
index c7b35da..0000000
+++ /dev/null
@@ -1,124 +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>March  2, 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>LXSESSION</refentrytitle>">
-  <!ENTITY dhpackage   "lxsession">
-
-  <!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>a lightweight X session manager</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 program that provides a X11
-    session manager. It is the default X11 session manager of LXDE.
-    </para>
-
-    <para>A session manager is used to automatically start a set of 
-               applications and
-               set up a working desktop environment. Moreover, when 
-               the user logout, it
-               remembers the applications in use, and restart them 
-               the next time you login.
-    </para>
-   
-  </refsect1>
-  <refsect1>
-    <title>SEE ALSO</title>
-
-    <para>lxpanel (1), lxsession-logout(1).</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>
-
-  </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/lxsession.xml b/man/lxsession.xml
new file mode 100644 (file)
index 0000000..70b0cd2
--- /dev/null
@@ -0,0 +1,58 @@
+<?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>March  2, 2008</date>
+  </refentryinfo>
+  <refmeta>    <refentrytitle>LXSESSION</refentrytitle>
+
+    <manvolnum>1</manvolnum>
+  </refmeta>
+  <refnamediv>    <refname>lxsession</refname>
+
+    <refpurpose>a lightweight X session manager</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>    <cmdsynopsis>      <command>lxsession</command>
+    </cmdsynopsis>
+  </refsynopsisdiv>
+  <refsect1>    <title>DESCRIPTION</title>
+
+    <para>This manual page documents briefly the
+      <command>lxsession</command> command.</para>
+
+    <para><command>lxsession</command> is a program that provides a X11
+    session manager. It is the default X11 session manager of LXDE.
+    </para>
+
+    <para>A session manager is used to automatically start a set of 
+               applications and
+               set up a working desktop environment. Moreover, when 
+               the user logout, it
+               remembers the applications in use, and restart them 
+               the next time you login.
+    </para>
+   
+  </refsect1>
+  <refsect1>    <title>SEE ALSO</title>
+
+    <para>lxpanel (1), lxsession-logout(1).</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>
+
+  </refsect1></refentry>