X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=podwrapper.sh.in;h=967f44c93ed3ff03d984cf3677a3028006ca92be;hb=006607dea29e6b67fa35d7cd3086e00213890a8b;hp=d39d8173e3960c96e4f8e7bee1ab12ba8d1a3574;hpb=e1aca6323e33e0dd50e23dc0d638f5789c9188e4;p=libguestfs.git
diff --git a/podwrapper.sh.in b/podwrapper.sh.in
index d39d817..967f44c 100755
--- a/podwrapper.sh.in
+++ b/podwrapper.sh.in
@@ -1,6 +1,6 @@
#!/bin/bash -
# podwrapper.sh
-# Copyright (C) 2010 Red Hat Inc.
+# Copyright (C) 2010-2011 Red Hat Inc.
# @configure_input@
#
# This program is free software; you can redistribute it and/or modify
@@ -15,7 +15,7 @@
#
# 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.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Wrapper script around POD utilities which can include files in the
# POD and controls HTML generation.
@@ -30,6 +30,28 @@ PACKAGE_VERSION="@PACKAGE_VERSION@"
POD2MAN="@POD2MAN@"
POD2TEXT="@POD2TEXT@"
POD2HTML="@POD2HTML@"
+POD2_STDERR_OPTION="@POD2_STDERR_OPTION@"
+POD2_UTF8_OPTION="@POD2_UTF8_OPTION@"
+
+# This script could be run with any current directory, so if a source
+# or build path is required it must be relative to the following
+# absolute paths:
+abs_top_srcdir="@abs_top_srcdir@"
+abs_top_builddir="@abs_top_builddir@"
+
+if [ -z "$abs_top_srcdir" ]; then
+ echo "*** podwrapper.sh: error: abs_top_srcdir not defined"
+ echo "probably this is a very old version of autoconf and you need to"
+ echo "upgrade to a recent version"
+ exit 1
+fi
+
+if [ -z "$abs_top_builddir" ]; then
+ echo "*** podwrapper.sh: error: abs_top_builddir not defined"
+ echo "probably this is a very old version of autoconf and you need to"
+ echo "upgrade to a recent version"
+ exit 1
+fi
declare -a inserts
declare -a pattern
@@ -144,22 +166,42 @@ fi
# Now generate the final output format(s).
if [ -n "$man_output" ]; then
- "$POD2MAN" --stderr -u \
+ "$POD2MAN" "$POD2_STDERR_OPTION" "$POD2_UTF8_OPTION" \
--section "$section" -c "Virtualization Support" --name "$name" \
--release "$PACKAGE_NAME-$PACKAGE_VERSION" \
< $tmpdir/full.pod > "$man_output".tmp
- mv "$man_output".tmp "$man_output"
+ mv "$man_output".tmp "$man_output"
fi
if [ -n "$text_output" ]; then
- "$POD2TEXT" --stderr -u \
+ "$POD2TEXT" "$POD2_STDERR_OPTION" "$POD2_UTF8_OPTION" \
< $tmpdir/full.pod > "$text_output".tmp
- mv "$text_output".tmp "$text_output"
+ mv "$text_output".tmp "$text_output"
fi
if [ -n "$html_output" ]; then
+ mkdir -p "$abs_top_builddir/html"
"$POD2HTML" \
- --css "pod.css" --htmldir "$builddir/html" \
+ --css "pod.css" --htmldir "$abs_top_builddir/html" \
< $tmpdir/full.pod > "$html_output".tmp
- mv "$html_output".tmp "$html_output"
+ mv "$html_output".tmp "$html_output"
+
+ # Fix up some of the mess in the HTML output, mainly to make links
+ # between man pages work properly.
+
+ # Rewrite manpage(n) to manpage(n) if
+ # there is a linkable manual page.
+ sed_cmd="sed"
+ for f in $(cd "$abs_top_builddir/html" && ls -1 *.html); do
+ b=$(basename $f .html)
+ m=$(echo $b | sed 's/\(.*\)\.\([1-9]\)$/\1(\2)/')
+ sed_cmd="$sed_cmd -e 's,$m,$m,g'"
+ done
+ echo $sed_cmd
+ eval $sed_cmd < "$html_output" > "$html_output".tmp
+ mv "$html_output".tmp "$html_output"
+
+ # Fix links like L
+ sed 's,guestfs-\1(\([1-9]\)),guestfs-\1(\2),g' < "$html_output" > "$html_output".tmp
+ mv "$html_output".tmp "$html_output"
fi