[easytag] Replace man page with one generated from DocBook



commit b89684ee5dca7b6cb90614fb907034bf81efe7fe
Author: David King <amigadave amigadave com>
Date:   Fri Mar 15 17:26:05 2013 +0000

    Replace man page with one generated from DocBook
    
    Check for the required DocBook XML DTD and catalogs in configure. Add a
    --disable-man argument so that building the man page can be explicitly
    disabled.

 .gitignore                        |    3 +-
 Makefile.am                       |   17 ++++++--
 autogen.sh                        |    1 -
 configure.ac                      |   25 +++++++++++-
 doc/easytag.1.in                  |   62 ---------------------------
 doc/easytag.xml                   |   83 +++++++++++++++++++++++++++++++++++++
 doc/version.xml.in                |    1 +
 m4/gtkdoc_jh_check_xml_catalog.m4 |   16 +++++++
 m4/gtkdoc_jh_path_xml_catalog.m4  |   34 +++++++++++++++
 9 files changed, 173 insertions(+), 69 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index d30aff2..ec664f6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,8 @@ config.h.in
 config.log
 config.status
 configure
-doc/easytag.1
+/doc/easytag.1
+/doc/version.xml
 /easytag
 /easytag.desktop
 /easytag-*-setup.exe
diff --git a/Makefile.am b/Makefile.am
index bcaa505..3532888 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,8 +3,9 @@ ACLOCAL_AMFLAGS = -I m4
 DISTCHECK_CONFIGURE_FLAGS = \
        --enable-flac \
        --enable-id3v23 \
-       --enable-mp3 \
        --enable-ogg \
+       --enable-man \
+       --enable-mp3 \
        --enable-mp4 \
        --enable-speex \
        --enable-tests \
@@ -139,7 +140,14 @@ desktopdir = $(datadir)/applications
 desktop_in_files = easytag.desktop.in
 desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
 
-man_MANS = doc/easytag.1
+if ENABLE_MAN
+doc/easytag.1: doc/easytag.xml Makefile
+       $(AM_V_GEN)$(XSLTPROC) --nonet --param man.charmap.use.subset 0 \
+               --path $(builddir)/doc --output $(builddir)/doc/ \
+               http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
+
+nodist_man_MANS = doc/easytag.1
+endif
 
 pixmaps = \
        data/pixmaps/add_folder.xpm \
@@ -235,7 +243,7 @@ dist_noinst_DATA = \
        HACKING \
        README_win32.txt \
        \
-       doc/easytag.1.in \
+       doc/easytag.xml \
        doc/EasyTAG_Documentation.html \
        doc/EasyTAG_Documentation_fr.html \
        doc/EasyTAG_Documentation_sv.html \
@@ -327,11 +335,12 @@ TESTS = \
 endif
 
 CLEANFILES = \
+       $(check_SCRIPTS) \
        $(desktop_DATA) \
+       $(nodist_man_MANS) \
        easytag-win32-installer.nsi
 
 DISTCLEANFILES = \
-       $(man_MANS) \
        intltool-extract \
        intltool-merge \
        intltool-update \
diff --git a/autogen.sh b/autogen.sh
index c02087b..b196a32 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -3,6 +3,5 @@
 test -n "$srcdir" || srcdir=`dirname "$0"`
 test -n "$srcdir" || srcdir=.
 
-mkdir -p m4
 intltoolize --copy --force --automake && autoreconf --force --install --verbose --warnings=all "$srcdir"
 test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
diff --git a/configure.ac b/configure.ac
index 5aa03d1..259d17e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,6 +35,29 @@ AC_PROG_CXXCPP
 AC_PROG_SED
 PKG_PROG_PKG_CONFIG([0.24])
 
+dnl Man page, generated with xsltproc from DocBook XML.
+AC_ARG_ENABLE([man],
+    [AS_HELP_STRING([--disable-man], [Disable building the man page])])
+
+AS_IF([test "x$enable_man" != "xno"],
+    [AC_PATH_PROG([XSLTPROC], [xsltproc])
+     JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.4//EN],
+         [DocBook XML DTD V4.4], [have_docbookdtd=yes], [have_docbookdtd=no])
+     JH_CHECK_XML_CATALOG(
+         [http://docbook.sourceforge.net/release/xsl/current/html/refentry.xsl],
+         [DocBook XSL Stylesheets], [have_docbookxsl=yes],
+         [have_docbookxsl=no])
+     AS_IF([test "x$ac_cv_path_XSLTPROC" != "x" \
+         -a "x$have_docbookdtd" = "xyes" -a "x$have_docbookxsl" = "xyes"],
+         [have_manutils=yes],
+         [AS_IF([test "x$enable_man" = "xyes"],
+             [AC_MSG_ERROR(
+                 [man page generation requested but required utilities were not found])])
+          have_manutils=no])],
+    [have_manutils=no])
+
+AM_CONDITIONAL([ENABLE_MAN], [test "x$have_manutils" = "xyes"])
+
 dnl Check for testing utilities.
 AC_ARG_ENABLE([tests],
               [AS_HELP_STRING([--disable-tests], [Disable support for tests run during make check])])
@@ -302,7 +325,7 @@ dnl -------------------------------
 AC_CHECK_FUNCS([ftruncate gettimeofday mkstemp truncate])
 
 AC_CONFIG_FILES([ Makefile
-                  doc/easytag.1
+                  doc/version.xml
                   po/Makefile.in
                ])
 AC_OUTPUT
diff --git a/doc/easytag.xml b/doc/easytag.xml
new file mode 100644
index 0000000..cad9952
--- /dev/null
+++ b/doc/easytag.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
+               "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd";
+[<!ENTITY version SYSTEM "version.xml">]>
+<refentry id="easytag">
+
+<refmeta>
+<refentrytitle>easytag</refentrytitle>
+<manvolnum>1</manvolnum>
+<refmiscinfo class="manual">User Commands</refmiscinfo>
+<refmiscinfo class="source">EasyTAG</refmiscinfo>
+<refmiscinfo class="version">&version;</refmiscinfo>
+</refmeta>
+
+<refnamediv>
+<refname>easytag</refname>
+<refpurpose>tag editor for MP3, Ogg Vorbis files and more</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+<cmdsynopsis>
+<command>easytag</command>
+<arg choice="opt">OPTION</arg>
+</cmdsynopsis>
+<cmdsynopsis>
+<command>easytag</command>
+<arg choice="opt"><replaceable>PATH</replaceable></arg>
+</cmdsynopsis>
+</refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>
+<command>easytag</command> is a utility for viewing and editing tags for MP3,
+MP2, MP4/AAC, FLAC, Ogg Vorbis, MusePack, Monkey's Audio and WavPack files. Its
+simple and nice GTK+ interface makes tagging easier under Linux or
+Windows.</para>
+</refsect1>
+
+<refsect1><title>Invocation</title>
+<para><command>easytag</command> can take an <replaceable>option</replaceable>
+or a <replaceable>path</replaceable> as arguments.</para>
+
+<refsect2><title>Options</title>
+<variablelist>
+
+<varlistentry>
+<term><option>--help</option>, <option>-h</option></term>
+<listitem><para>Print brief help and exit.</para></listitem>
+</varlistentry>
+
+<varlistentry>
+<term><option>--version</option>, <option>-v</option></term>
+<listitem><para>Print the version and exit.</para></listitem>
+</varlistentry>
+
+</variablelist>
+</refsect2>
+
+<refsect2><title>Paths</title>
+<para>Either an absolute or a relative <replaceable>path</replaceable> can be
+supplied, which will open the path in the browser on startup.</para>
+</refsect2>
+
+</refsect1>
+
+<refsect1><title>See also</title>
+<para>EasyTAG help manual</para>
+</refsect1>
+
+<refsect1><title>Author</title>
+<para>
+<command>easytag</command> was written by Jérôme Couderc
+<email>easytag gmail com</email>, Kip Warner
+<email>kip thevertigo com</email> and David King
+<email>amigadave amigadave com</email>.
+</para>
+
+<para>
+This manual page was written by David King
+<email>amigadave amigadave com</email>.
+</para>
+</refsect1>
+</refentry>
diff --git a/doc/version.xml.in b/doc/version.xml.in
new file mode 100644
index 0000000..a24f987
--- /dev/null
+++ b/doc/version.xml.in
@@ -0,0 +1 @@
+ PACKAGE_VERSION@
diff --git a/m4/gtkdoc_jh_check_xml_catalog.m4 b/m4/gtkdoc_jh_check_xml_catalog.m4
new file mode 100644
index 0000000..618c1c9
--- /dev/null
+++ b/m4/gtkdoc_jh_check_xml_catalog.m4
@@ -0,0 +1,16 @@
+dnl Checks if a particular URI appears in the XML catalog
+dnl Usage:
+dnl    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])
+       else
+               AC_MSG_RESULT([not found])
+               ifelse([$4],,[AC_MSG_ERROR([could not find ifelse([$2],,[$1],[$2]) in XML catalog])],[$4])
+       fi
+])
diff --git a/m4/gtkdoc_jh_path_xml_catalog.m4 b/m4/gtkdoc_jh_path_xml_catalog.m4
new file mode 100644
index 0000000..1618906
--- /dev/null
+++ b/m4/gtkdoc_jh_path_xml_catalog.m4
@@ -0,0 +1,34 @@
+dnl Checks the location of the XML Catalog
+dnl Usage:
+dnl    JH_PATH_XML_CATALOG([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+dnl Defines XMLCATALOG and XML_CATALOG_FILE substitutions
+AC_DEFUN([JH_PATH_XML_CATALOG],
+[
+       dnl check for the presence of the XML catalog
+       AC_ARG_WITH([xml-catalog],
+               AS_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
+
+       dnl 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
+])


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