build: Centralize all POD manipulation in 'podwrapper.sh' script.
authorRichard W.M. Jones <rjones@redhat.com>
Wed, 24 Nov 2010 15:19:33 +0000 (15:19 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Wed, 24 Nov 2010 20:12:08 +0000 (20:12 +0000)
13 files changed:
.gitignore
Makefile.am
README
cat/Makefile.am
configure.ac
fish/Makefile.am
fuse/Makefile.am
inspector/Makefile.am
po-docs/ja/Makefile.am
podwrapper.sh.in [new file with mode: 0755]
src/Makefile.am
test-tool/Makefile.am
tools/Makefile.am

index f66fdcc..ac7ebbd 100644 (file)
@@ -31,6 +31,7 @@ capitests/test*.img
 capitests/tests
 capitests/tests.c
 capitests/test*.tmp
+cat/stamp-virt-*.pod
 cat/virt-cat
 cat/virt-cat.1
 cat/virt-cat.static
@@ -87,9 +88,11 @@ fish/prepopts.c
 fish/prepopts.h
 fish/rc_protocol.c
 fish/rc_protocol.h
+fish/stamp-guestfish.pod
 fuse/guestmount
 fuse/guestmount.1
 fuse/guestmount.static
+fuse/stamp-guestmount.pod
 generator/.pod2text.data
 generator/generator
 generator/stamp-generator
@@ -144,6 +147,7 @@ images/ubuntu.img
 images/windows.img
 initramfs
 initramfs.timestamp
+inspector/stamp-virt-inspector.pod
 inspector/virt-inspector
 inspector/virt-inspector.1
 inspector/virt-inspector.static
@@ -254,6 +258,7 @@ po-docs/*/*.pl
 po-docs/*/*.pod
 po-docs/*/*.1
 po-docs/*/*.3
+podwrapper.sh
 python/bindtests.py
 python/guestfs.py
 python/guestfs-py.c
@@ -283,6 +288,7 @@ src/guestfs_protocol.h
 src/guestfs_protocol.x
 src/.libs/libguestfs.so
 src/libguestfs.syms
+src/stamp-guestfs.pod
 *.swp
 stamp-h1
 test1.img
index 35bf7a9..94a3017 100644 (file)
@@ -93,41 +93,6 @@ EXTRA_DIST = \
        .gitignore \
        m4/.gitignore
 
-# HTML versions of manual pages.
-
-noinst_DATA = html/guestfs.3.html html/guestfish.1.html
-
-html/guestfs.3.html: src/guestfs.pod \
-               src/guestfs-actions.pod \
-               src/guestfs-availability.pod \
-               src/guestfs-structs.pod
-       mkdir -p html
-       sed \
-         -e '/@ACTIONS@/rsrc/guestfs-actions.pod' \
-         -e 's/@ACTIONS@//' \
-         -e '/@AVAILABILITY@/rsrc/guestfs-availability.pod' \
-         -e 's/@AVAILABILITY@//' \
-         -e '/@STRUCTS@/rsrc/guestfs-structs.pod' \
-         -e 's/@STRUCTS@//' \
-         < $< | \
-       pod2html \
-         --css 'pod.css' \
-         --title "libguestfs API documentation" \
-         --htmldir html \
-         --outfile $@
-
-html/guestfish.1.html: fish/guestfish.pod fish/guestfish-actions.pod fish/guestfish-commands.pod
-       mkdir -p html
-       sed \
-         -e '/@ACTIONS@/rfish/guestfish-actions.pod' -e 's/@ACTIONS@//' \
-         -e '/@FISH_COMMANDS@/rfish/guestfish-commands.pod' -e 's/@FISH_COMMANDS@//' \
-         < $< | \
-       pod2html \
-         --css 'pod.css' \
-         --title "guestfish, libguestfs filesystem interactive shell" \
-         --htmldir html \
-         --outfile $@
-
 # Recipes web page.
 html/recipes.html: $(wildcard recipes/*.sh) $(wildcard recipes/*.html) $(wildcard recipes/*.example) Makefile make-recipes.sh
        mkdir -p html
diff --git a/README b/README
index c2a75b1..57021e9 100644 (file)
--- a/README
+++ b/README
@@ -70,8 +70,8 @@ Requirements
 
 - (Optional) FUSE to build the FUSE module
 
-- perldoc (pod2man, pod2text) to generate the manual pages and
-  other documentation.
+- perldoc (pod2man, pod2text, pod2html) to generate the manual pages
+  and other documentation.
 
 - (Optional) Readline to have nicer command-line editing in guestfish.
 
index 4dd7dfb..10a768b 100644 (file)
@@ -28,6 +28,8 @@ EXTRA_DIST = \
        test-virt-ls.sh \
        virt-ls.pod
 
+CLEANFILES = stamp-virt-cat.pod stamp-virt-ls.pod stamp-virt-filesystems.pod
+
 bin_PROGRAMS = virt-cat virt-filesystems virt-ls
 
 SHARED_SOURCE_FILES = \
@@ -90,50 +92,32 @@ noinst_DATA = \
        $(top_builddir)/html/virt-filesystems.1.html \
        $(top_builddir)/html/virt-ls.1.html
 
-virt-cat.1: virt-cat.pod
-       $(POD2MAN) \
-         --section 1 \
-         -c "Virtualization Support" \
-         --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
-         $< > $@-t && mv $@-t $@
-
-$(top_builddir)/html/virt-cat.1.html: virt-cat.pod
-       mkdir -p $(top_builddir)/html
-       cd $(top_builddir) && pod2html \
-         --css 'pod.css' \
-         --htmldir html \
-         --outfile html/$@ \
-         $(abs_srcdir)/$<
-
-virt-filesystems.1: virt-filesystems.pod
-       $(POD2MAN) \
-         --section 1 \
-         -c "Virtualization Support" \
-         --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
-         $< > $@-t && mv $@-t $@
-
-$(top_builddir)/html/virt-filesystems.1.html: virt-filesystems.pod
-       mkdir -p $(top_builddir)/html
-       cd $(top_builddir) && pod2html \
-         --css 'pod.css' \
-         --htmldir html \
-         --outfile html/$@ \
-         $(abs_srcdir)/$<
-
-virt-ls.1: virt-ls.pod
-       $(POD2MAN) \
-         --section 1 \
-         -c "Virtualization Support" \
-         --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
-         $< > $@-t && mv $@-t $@
-
-$(top_builddir)/html/virt-ls.1.html: virt-ls.pod
-       mkdir -p $(top_builddir)/html
-       cd $(top_builddir) && pod2html \
-         --css 'pod.css' \
-         --htmldir html \
-         --outfile html/$@ \
-         $(abs_srcdir)/$<
+virt-cat.1 $(top_builddir)/html/virt-cat.1.html: stamp-virt-cat.pod
+
+stamp-virt-cat.pod: virt-cat.pod
+       $(top_srcdir)/podwrapper.sh \
+         --man virt-cat.1 \
+         --html $(top_builddir)/html/virt-cat.1.html \
+         $<
+       touch $@
+
+virt-ls.1 $(top_builddir)/html/virt-ls.1.html: stamp-virt-ls.pod
+
+stamp-virt-ls.pod: virt-ls.pod
+       $(top_srcdir)/podwrapper.sh \
+         --man virt-ls.1 \
+         --html $(top_builddir)/html/virt-ls.1.html \
+         $<
+       touch $@
+
+virt-filesystems.1 $(top_builddir)/html/virt-filesystems.1.html: stamp-virt-filesystems.pod
+
+stamp-virt-filesystems.pod: virt-filesystems.pod
+       $(top_srcdir)/podwrapper.sh \
+         --man virt-filesystems.1 \
+         --html $(top_builddir)/html/virt-filesystems.1.html \
+         $<
+       touch $@
 
 # Tests.
 
index 48d4240..352bfe8 100644 (file)
@@ -205,13 +205,16 @@ AC_CHECK_PROG([GPERF],[gperf],[gperf],[no])
 test "x$GPERF" = "xno" &&
      AC_MSG_ERROR([gperf must be installed])
 
-dnl Check for pod2man and pod2text.
+dnl Check for pod2man, pod2text, pod2html.
 AC_CHECK_PROG([POD2MAN],[pod2man],[pod2man],[no])
 test "x$POD2MAN" = "xno" &&
      AC_MSG_ERROR([pod2man must be installed])
 AC_CHECK_PROG([POD2TEXT],[pod2text],[pod2text],[no])
 test "x$POD2TEXT" = "xno" &&
      AC_MSG_ERROR([pod2text must be installed])
+AC_CHECK_PROG([POD2HTML],[pod2html],[pod2html],[no])
+test "x$POD2HTML" = "xno" &&
+     AC_MSG_ERROR([pod2html must be installed])
 
 dnl Check for mkisofs.
 AC_PATH_PROGS([MKISOFS],[mkisofs],[no],
@@ -837,6 +840,8 @@ AC_CONFIG_HEADERS([config.h])
 dnl http://www.mail-archive.com/automake@gnu.org/msg10204.html
 AC_CONFIG_FILES([appliance/update.sh],
                 [chmod +x appliance/update.sh])
+AC_CONFIG_FILES([podwrapper.sh],
+                [chmod +x podwrapper.sh])
 AC_CONFIG_FILES([Makefile
                  generator/Makefile
                  src/Makefile fish/Makefile po/Makefile.in examples/Makefile
index 2d8c16b..01ed59c 100644 (file)
@@ -17,6 +17,8 @@
 
 include $(top_srcdir)/subdir-rules.mk
 
+CLEANFILES = stamp-guestfish.pod
+
 bin_PROGRAMS = guestfish
 
 generator_built = \
@@ -133,22 +135,20 @@ guestfish.static$(EXEEXT): $(guestfish_OBJECTS) $(guestfish_DEPENDENCIES)
        $(guestfish_LINK) $(guestfish_OBJECTS) -static $(guestfish_LDADD) $(guestfish_LIBS) $(LIBVIRT_LIBS) $(LIBXML2_LIBS) -ltinfo -lpcre -lhivex -lmagic -lz -lm
 
 # Manual page.
-# guestfish-actions.pod and guestfish-commands.pod are autogenerated.
-# There is no include mechanism for POD, so we have to do it by hand.
 
 man_MANS = guestfish.1
-
-guestfish.1: guestfish.pod guestfish-actions.pod guestfish-commands.pod
-       sed \
-         -e '/@ACTIONS@/rguestfish-actions.pod' -e 's/@ACTIONS@//' \
-         -e '/@FISH_COMMANDS@/rguestfish-commands.pod' -e 's/@FISH_COMMANDS@//' \
-         < $< | \
-       $(POD2MAN) \
-         --section 1 \
-         -c "Virtualization Support" \
-         --name "guestfish" \
-         --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
-         > $@
+noinst_DATA = $(top_builddir)/html/guestfish.1.html
+
+guestfish.1 $(top_builddir)/html/guestfish.1.html: stamp-guestfish.pod
+
+stamp-guestfish.pod: guestfish.pod guestfish-actions.pod guestfish-commands.pod
+       $(top_srcdir)/podwrapper.sh \
+         --man guestfish.1 \
+         --html $(top_builddir)/html/guestfish.1.html \
+         --insert guestfish-actions.pod:@ACTIONS@ \
+         --insert guestfish-commands.pod:@FISH_COMMANDS@ \
+         $<
+       touch $@
 
 # Bash completion script.
 
index 5fe57bb..692da6e 100644 (file)
@@ -19,6 +19,8 @@ include $(top_srcdir)/subdir-rules.mk
 
 EXTRA_DIST = guestmount.pod test-fuse.sh
 
+CLEANFILES = stamp-guestmount.pod
+
 if HAVE_FUSE
 
 bin_PROGRAMS = guestmount
@@ -62,25 +64,16 @@ guestmount.static$(EXEEXT): $(guestmount_OBJECTS) $(guestmount_DEPENDENCIES)
 # Documentation.
 
 man_MANS = guestmount.1
+noinst_DATA = $(top_builddir)/html/guestmount.1.html
+
+guestmount.1 $(top_builddir)/html/guestmount.1.html: stamp-guestmount.pod
 
-guestmount.1: guestmount.pod
-       $(POD2MAN) \
-         --section 1 \
-         -c "Virtualization Support" \
-         --name "guestmount" \
-         --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
-         $< > $@-t; mv $@-t $@
-
-noinst_DATA = \
-       $(top_builddir)/html/guestmount.1.html
-
-$(top_builddir)/html/guestmount.1.html: guestmount.pod
-       mkdir -p $(top_builddir)/html
-       cd $(top_builddir) && pod2html \
-         --css 'pod.css' \
-         --htmldir html \
-         --outfile html/guestmount.1.html \
-         fuse/guestmount.pod
+stamp-guestmount.pod: guestmount.pod
+       $(top_srcdir)/podwrapper.sh \
+         --man guestmount.1 \
+         --html $(top_builddir)/html/guestmount.1.html \
+         $<
+       touch $@
 
 # Tests.
 
index cb77279..d1dcb6d 100644 (file)
@@ -27,6 +27,8 @@ EXTRA_DIST = \
        run-inspector-locally \
        virt-inspector.pod
 
+CLEANFILES = stamp-virt-inspector.pod
+
 docdir = @docdir@
 dist_doc_DATA = \
        virt-inspector.rng \
@@ -62,25 +64,16 @@ virt_inspector_LDADD = \
 
 # Manual pages and HTML files for the website.
 man_MANS = virt-inspector.1
+noinst_DATA = $(top_builddir)/html/virt-inspector.1.html
+
+virt-inspector.1 $(top_builddir)/html/virt-inspector.1.html: stamp-virt-inspector.pod
 
-noinst_DATA = \
-       $(top_builddir)/html/virt-inspector.1.html
-
-virt-inspector.1: virt-inspector.pod
-       $(POD2MAN) \
-         --section 1 \
-         -c "Virtualization Support" \
-         --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
-         $< > $@-t && mv $@-t $@
-
-$(top_builddir)/html/virt-inspector.1.html: virt-inspector.pod
-       mkdir -p $(top_builddir)/html
-       cd $(top_builddir) && pod2html \
-         --css 'pod.css' \
-         --title 'virt-inspector, display OS version, kernel, drivers, mount points, applications, etc. in a virtual machine' \
-         --htmldir html \
-         --outfile html/virt-inspector.1.html \
-         inspector/$<
+stamp-virt-inspector.pod: virt-inspector.pod
+       $(top_srcdir)/podwrapper.sh \
+         --man virt-inspector.1 \
+         --html $(top_builddir)/html/virt-inspector.1.html \
+         $<
+       touch $@
 
 if HAVE_XMLLINT
 
index 0082288..24eb24e 100644 (file)
@@ -46,54 +46,35 @@ if HAVE_PO4A
 all-local: $(MANPAGES)
 
 guestfs.3: guestfs.pod guestfs-actions.pod guestfs-availability.pod guestfs-structs.pod
-       sed \
-         -e '/@ACTIONS@/rguestfs-actions.pod' \
-         -e 's/@ACTIONS@//' \
-         -e '/@AVAILABILITY@/rguestfs-availability.pod' \
-         -e 's/@AVAILABILITY@//' \
-         -e '/@STRUCTS@/rguestfs-structs.pod' \
-         -e 's/@STRUCTS@//' \
-       < $< | \
-       $(POD2MAN) -u \
+       $(top_srcdir)/podwrapper.sh \
          --section 3 \
-         -c "Virtualization Support" \
-         --name "guestfs" \
-         --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
-         > $@-t; mv $@-t $@
+         --man $@ \
+         --insert guestfs-actions.pod:@ACTIONS@ \
+         --insert guestfs-availability.pod:@AVAILABILITY@ \
+         --insert guestfs-structs.pod:@STRUCTS@ \
+         $<
 
 guestfish.1: guestfish.pod guestfish-actions.pod guestfish-commands.pod
-       sed \
-         -e '/@ACTIONS@/rguestfish-actions.pod' -e 's/@ACTIONS@//' \
-         -e '/@FISH_COMMANDS@/rguestfish-commands.pod' -e 's/@FISH_COMMANDS@//' \
-         < $< | \
-       $(POD2MAN) -u \
-         --section 1 \
-         -c "Virtualization Support" \
-         --name "guestfish" \
-         --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
-         > $@-t; mv $@-t $@
+       $(top_srcdir)/podwrapper.sh \
+         --man $@ \
+         --insert guestfish-actions.pod:@ACTIONS@ \
+         --insert guestfish-commands.pod:@FISH_COMMANDS@ \
+         $<
 
 guestmount.1: guestmount.pod
-       $(POD2MAN) -u \
-         --section 1 \
-         -c "Virtualization Support" \
-         --name "guestmount" \
-         --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
-         $< > $@-t; mv $@-t $@
+       $(top_srcdir)/podwrapper.sh \
+         --man $@ \
+         $<
 
 libguestfs-test-tool.1: libguestfs-test-tool.pod
-       $(POD2MAN) -u \
-         --section 1 \
-         -c "Virtualization Support" \
-         --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
-         $< > $@-t; mv $@-t $@
+       $(top_srcdir)/podwrapper.sh \
+         --man $@ \
+         $<
 
 virt-%.1: virt-%.pl
-       $(POD2MAN) -u \
-         --section 1 \
-         -c "Virtualization Support" \
-         --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
-         $< > $@-t && mv $@-t $@
+       $(top_srcdir)/podwrapper.sh \
+         --man $@ \
+         $<
 
 else
 
diff --git a/podwrapper.sh.in b/podwrapper.sh.in
new file mode 100755 (executable)
index 0000000..d39d817
--- /dev/null
@@ -0,0 +1,165 @@
+#!/bin/bash -
+# podwrapper.sh
+# Copyright (C) 2010 Red Hat Inc.
+# @configure_input@
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# Wrapper script around POD utilities which can include files in the
+# POD and controls HTML generation.
+
+unset CDPATH
+
+set -e
+#set -x
+
+PACKAGE_NAME="@PACKAGE_NAME@"
+PACKAGE_VERSION="@PACKAGE_VERSION@"
+POD2MAN="@POD2MAN@"
+POD2TEXT="@POD2TEXT@"
+POD2HTML="@POD2HTML@"
+
+declare -a inserts
+declare -a pattern
+declare -a indent
+nr_inserts=0
+
+TEMP=`getopt \
+        -o '' \
+        --long section:,name:,man:,text:,html:,insert:,verbatim: \
+        -n podwrapper.sh -- "$@"`
+if [ $? != 0 ]; then
+    echo "podwrapper.sh: problem parsing the command line arguments"
+    exit 1
+fi
+eval set -- "$TEMP"
+
+while true; do
+    case "$1" in
+        --section)
+            section="$2"
+            shift 2;;
+        --name)
+            name="$2"
+            shift 2;;
+        --man)
+            [ -z "$man_output" ] || {
+                echo "podwrapper.sh: --text option specified more than once"
+                exit 1
+            }
+            man_output="$2"
+            shift 2;;
+        --text)
+            [ -z "$text_output" ] || {
+                echo "podwrapper.sh: --text option specified more than once"
+                exit 1
+            }
+            text_output="$2"
+            shift 2;;
+        --html)
+            [ -z "$html_output" ] || {
+                echo "podwrapper.sh: --html option specified more than once"
+                exit 1
+            }
+            html_output="$2"
+            shift 2;;
+        --insert)
+            inserts[$nr_inserts]=`echo "$2" | awk -F: '{print $1}'`
+            pattern[$nr_inserts]=`echo "$2" | awk -F: '{print $2}'`
+            indent[$nr_inserts]=no
+            ((++nr_inserts))
+            shift 2;;
+        --verbatim)
+            inserts[$nr_inserts]=`echo "$2" | awk -F: '{print $1}'`
+            pattern[$nr_inserts]=`echo "$2" | awk -F: '{print $2}'`
+            indent[$nr_inserts]=yes
+            ((++nr_inserts))
+            shift 2;;
+        --)
+            shift; break;;
+        *)
+            echo "podwrapper.sh: internal error in option parsing"
+            exit 1;;
+    esac
+done
+
+# The remaining argument is the input POD file.
+if [ $# -ne 1 ]; then
+    echo "podwrapper.sh [--options] input.pod"
+    exit 1
+fi
+input="$1"
+
+#echo "input=$input"
+#echo "man_output=$man_output"
+#echo "text_output=$text_output"
+#echo "html_output=$html_output"
+#for i in `seq 0 $(($nr_inserts-1))`; do
+#    echo "insert $i: ${inserts[$i]} (pattern: ${pattern[$i]} indent: ${indent[$i]})"
+#done
+
+# Should be at least one sort of output.
+[ -z "$man_output" -a -z "$text_output" -a -z "$html_output" ] && {
+    echo "podwrapper.sh: no output specified"
+    exit 1
+}
+
+# If name and section are not set, make some sensible defaults.
+[ -z "$section" ] && section=1
+[ -z "$name" ] && name=$(basename "$input" .pod)
+
+# Perform the insertions to produce a temporary POD file.
+tmpdir="$(mktemp -d)"
+trap "rm -rf $tmpdir; exit $?" EXIT
+
+if [ $nr_inserts -gt 0 ]; then
+    cmd="sed"
+
+    for i in `seq 0 $(($nr_inserts-1))`; do
+        if [ "${indent[$i]}" = "yes" ]; then
+            sed 's/^/ /' < "${inserts[$i]}" > $tmpdir/$i
+        else
+            cp "${inserts[$i]}" $tmpdir/$i
+        fi
+
+        cmd="$cmd -e /${pattern[$i]}/r$tmpdir/$i -e s/${pattern[$i]}//"
+    done
+
+    $cmd < "$input" > $tmpdir/full.pod
+else
+    cp "$input" $tmpdir/full.pod
+fi
+
+# Now generate the final output format(s).
+if [ -n "$man_output" ]; then
+    "$POD2MAN" --stderr -u \
+        --section "$section" -c "Virtualization Support" --name "$name" \
+        --release "$PACKAGE_NAME-$PACKAGE_VERSION" \
+        < $tmpdir/full.pod > "$man_output".tmp
+        mv "$man_output".tmp "$man_output"
+fi
+
+if [ -n "$text_output" ]; then
+    "$POD2TEXT" --stderr -u \
+        < $tmpdir/full.pod > "$text_output".tmp
+        mv "$text_output".tmp "$text_output"
+fi
+
+if [ -n "$html_output" ]; then
+    "$POD2HTML" \
+        --css "pod.css" --htmldir "$builddir/html" \
+        < $tmpdir/full.pod > "$html_output".tmp
+        mv "$html_output".tmp "$html_output"
+fi
index 79ec1d0..4827e27 100644 (file)
@@ -17,6 +17,8 @@
 
 include $(top_srcdir)/subdir-rules.mk
 
+CLEANFILES = stamp-guestfs.pod
+
 generator_built = \
        guestfs_protocol.x \
        guestfs.h \
@@ -165,30 +167,25 @@ guestfs_protocol.h: guestfs_protocol.x
 endif
 
 # Manual page.
-# guestfs-actions.pod, guestfs-availability.pod and guestfs-structs.pod
-# are autogenerated.  There is no include mechanism for POD, so we
-# have to do it by hand.
 
 man_MANS = guestfs.3 libguestfs.3
+noinst_DATA = $(top_builddir)/html/guestfs.3.html
+
+guestfs.3 $(top_builddir)/html/guestfs.3.html: stamp-guestfs.pod
 
-guestfs.3: guestfs.pod \
+stamp-guestfs.pod: guestfs.pod \
                guestfs-actions.pod \
                guestfs-availability.pod \
                guestfs-structs.pod
-       sed \
-         -e '/@ACTIONS@/rguestfs-actions.pod' \
-         -e 's/@ACTIONS@//' \
-         -e '/@AVAILABILITY@/rguestfs-availability.pod' \
-         -e 's/@AVAILABILITY@//' \
-         -e '/@STRUCTS@/rguestfs-structs.pod' \
-         -e 's/@STRUCTS@//' \
-         < $< | \
-       $(POD2MAN) \
+       $(top_srcdir)/podwrapper.sh \
          --section 3 \
-         -c "Virtualization Support" \
-         --name "guestfs" \
-         --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
-         > $@
+         --man guestfs.3 \
+         --html $(top_builddir)/html/guestfs.3.html \
+         --insert guestfs-actions.pod:@ACTIONS@ \
+         --insert guestfs-availability.pod:@AVAILABILITY@ \
+         --insert guestfs-structs.pod:@STRUCTS@ \
+         $<
+       touch $@
 
 # Check user doesn't try to do 'make all' or 'make check' as root.
 # https://www.redhat.com/archives/libguestfs/2010-April/msg00098.html
index c28d131..908d2a0 100644 (file)
@@ -46,8 +46,6 @@ libguestfs-test-tool.static$(EXEEXT): $(libguestfs_test_tool_OBJECTS) $(libguest
        $(libguestfs_test_tool_LINK) $(libguestfs_test_tool_OBJECTS) -static $(libguestfs_test_tool_LDADD) $(libguestfs_test_tool_LIBS) $(LIBVIRT_LIBS) $(LIBXML2_LIBS) -lpcre -lhivex -lmagic -lz -lm
 
 libguestfs-test-tool.1: libguestfs-test-tool.pod
-       $(POD2MAN) \
-         --section 1 \
-         -c "Virtualization Support" \
-         --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
-         $< > $@
+       $(top_srcdir)/podwrapper.sh \
+         --man $@ \
+         $<
index c5131bd..4ab8369 100644 (file)
@@ -49,19 +49,14 @@ man_MANS = virt-df.1 $(patsubst %,virt-%.1,$(filter-out df,$(tools)))
 noinst_DATA = $(tools:%=$(top_builddir)/html/virt-%.1.html)
 
 virt-%.1: virt-%
-       $(POD2MAN) \
-         --section 1 \
-         -c "Virtualization Support" \
-         --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
-         $< > $@-t && mv $@-t $@
+       $(top_srcdir)/podwrapper.sh \
+         --man $@ \
+         $<
 
 $(top_builddir)/html/virt-%.1.html: virt-%
-       mkdir -p $(top_builddir)/html
-       cd $(top_builddir) && pod2html \
-         --css 'pod.css' \
-         --htmldir html \
-         --outfile html/$<.1.html \
-         tools/$<
+       $(top_srcdir)/podwrapper.sh \
+         --html $@ \
+         $<
 
 # Tests.