From 755a22b9820d554d1dd8b82fd3c3ad1d3d688c81 Mon Sep 17 00:00:00 2001
From: James Youngman
Date: Sun, 5 May 2019 16:49:12 +0100
Subject: [PATCH] doc: add a tool for updating the online manual.
To: address@hidden
* build-aux/update-online-manual.sh: add a script (originally
written in 2005 but not previously included in the source
distribution) which automates the updating of the online manual.
* doc/Makefile.am: Add some targets useful for update-online-manual.sh.
* doc/find-maint.texi (Documentation): Explain how to check out
the web pages and how to update the findutils documentation there.
---
build-aux/update-online-manual.sh | 243 ++++++++++++++++++++++++++++++++++++++
doc/Makefile.am | 25 +++-
doc/find-maint.texi | 13 ++
3 files changed, 279 insertions(+), 2 deletions(-)
create mode 100755 build-aux/update-online-manual.sh
diff --git a/build-aux/update-online-manual.sh b/build-aux/update-online-manual.sh
new file mode 100755
index 00000000..bfce0465
--- /dev/null
+++ b/build-aux/update-online-manual.sh
@@ -0,0 +1,243 @@
+#! /bin/sh
+# Copyright (C) 2019 Free Software Foundation, Inc.
+#
+# 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 3 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, see .
+
+##
+## This script updates the online manual for findutils.
+##
+## When you run it, make sure you are in the "manual" directory.
+PACKAGE=findutils
+TITLE="Findutils"
+TEXIBASE=find
+
+set -e
+
+usage() {
+cat <&2
+ exit 1
+fi
+
+BUILDDIR="$1"
+DOC_OUTPUT_DIR="`pwd`"
+
+echo Current directory is `pwd`
+
+echo "Are we in the right place? "
+for f in $checkfiles
+do
+ if test -e "$f"; then
+ echo " $f seems to be there"
+ else
+ printf " No, %s is missing.\n" "$f" >&2
+ exit 1
+ fi
+done
+echo "Yes, we are in the right place"
+
+
+printf "Can we see the build directory? "
+if [ -d "$BUILDDIR" ]; then
+ echo Yes.
+else
+ echo "No." >&2 ; exit 1
+fi
+
+printf "Does the build directory have a 'doc' subdirectory? "
+if [ -d "$BUILDDIR/doc" ]; then
+ echo Yes.
+else
+ echo "No." >&2 ; exit 1
+fi
+BUILDDIR="$BUILDDIR"/doc
+
+printf "Does the (doc) build directory have a Makefile? "
+if [ -f "$BUILDDIR"/Makefile ]; then
+ echo Yes.
+else
+ echo "No." >&2 ; exit 1
+fi
+
+
+##
+## Figure out where the source code lives by asking Make.
+##
+REL_SRCDIR="$(cd $BUILDDIR && grep '^srcdir =' Makefile | cut -d= -f2)"
+echo Build directory is $BUILDDIR.
+echo Relative path to source directory is $REL_SRCDIR
+
+SRCDIR="$(cd $BUILDDIR && cd $REL_SRCDIR && /bin/pwd)"
+unset REL_SRCDIR
+echo Source directory is $SRCDIR.
+
+
+if true
+then
+ ##
+ ## Build (most of) the files we need.
+ ## We collect them from the build directory afterwards.
+ ##
+ make -C "$BUILDDIR" $targets
+ cp ${BUILDDIR}/${TEXIBASE}.texi.tar.gz texi/${TEXIBASE}.texi.tar.gz
+ cp ${BUILDDIR}/${TEXIBASE}-info.tar.gz info/${TEXIBASE}-info.tar.gz
+
+ echo Collecting the PostScript file...
+ rm -f ps/${TEXIBASE}.ps.gz
+ gzip -9 < ${BUILDDIR}/${TEXIBASE}.ps > ps/${TEXIBASE}.ps.gz
+
+ echo Collecting the DVI file...
+ cp $BUILDDIR/${TEXIBASE}.dvi dvi/
+ rm dvi/${TEXIBASE}.dvi.gz
+ gzip -9 dvi/${TEXIBASE}.dvi
+
+
+ echo "Collecting the text files (compressed and uncompressed)..."
+ rm -f text/${TEXIBASE}.txt text/${TEXIBASE}.txt.gz
+ cp $BUILDDIR/${TEXIBASE}.txt text/
+ gzip -9 text/${TEXIBASE}.txt
+ cp $BUILDDIR/${TEXIBASE}.txt text/
+
+ echo "Collecting the all-in-one-file HTML (compressed and uncompressed)..."
+ rm -f html_mono/${TEXIBASE}.html html_mono/${TEXIBASE}.html.gz
+ cp $BUILDDIR/${TEXIBASE}_mono.html html_mono/${TEXIBASE}.html
+ gzip -9 html_mono/${TEXIBASE}.html
+ cp $BUILDDIR/${TEXIBASE}_mono.html html_mono/${TEXIBASE}.html
+
+
+ echo "Collecting the file-per-node HTML tar file..."
+ rm -f html_node/${PACKAGE}.texi_html_node.tar.gz
+ find html_node/${TEXIBASE}_html -name '*.html' -type f -delete
+ cp $BUILDDIR/${PACKAGE}.texi_html_node.tar.gz html_node/
+
+ echo "Unpacking the node-per-node HTML tar file..."
+ ( cd html_node && tar zxf ${PACKAGE}.texi_html_node.tar.gz && mv ${TEXIBASE}.html/*.html ${TEXIBASE}_html )
+
+fi
+
+size () {
+ du -sh --apparent-size "$1" | awk '{print $1;}'
+}
+
+
+linkfor() {
+ what="$1"
+ type="$2"
+ shift 2
+ printf '%s (%s %s)' \
+ "$what" "$*" "$(size $what)" "$type"
+}
+
+##
+##
+## Now the rather complex bit; generate the index page!
+##
+##
+echo "Generating the index page..."
+cat >${TEXIBASE}.html <
+Finding Files: Table of Contents - GNU Project - Free Software Foundation (FSF)
+
+
+
+
+
+
Findutils: Table of Contents
+
+This manual is available in the following formats:
+
+
+
+
+ $(linkfor html_mono/${TEXIBASE}.html "characters" HTML)
+ entirely on one web page.
+
+
+ $(linkfor html_mono/${TEXIBASE}.html.gz "gzipped characters" HTML)
+ entirely on one web page.
+