2
2
# gendocs.sh -- generate a GNU manual in many formats. This script is
3
3
# mentioned in maintain.texi. See the help message below for usage details.
5
scriptversion=2010-05-04.09
5
scriptversion=2010-11-27.07
7
# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
8
# Free Software Foundation, Inc.
7
# Copyright 2003-2010 Free Software Foundation, Inc.
10
9
# This program is free software: you can redistribute it and/or modify
11
10
# it under the terms of the GNU General Public License as published by
23
22
# Original author: Mohit Agarwal.
24
23
# Send bug reports and any other correspondence to bug-texinfo@gnu.org.
25
# The latest version of this script, and the companion template, is
26
# available from Texinfo CVS:
27
# http://savannah.gnu.org/cgi-bin/viewcvs/texinfo/texinfo/util/gendocs.sh
28
# http://savannah.gnu.org/cgi-bin/viewcvs/texinfo/texinfo/util/gendocs_template
30
# An up-to-date copy is also maintained in Gnulib (gnu.org/software/gnulib).
26
32
prog=`basename "$0"`
95
101
first copy or symlink all Texinfo sources into a single directory.
96
102
(Part of the script's work is to make a tar.gz of the sources.)
98
You can set the environment variables MAKEINFO, TEXI2DVI, and DVIPS to
99
control the programs that get executed, and GENDOCS_TEMPLATE_DIR to
100
control where the gendocs_template file is looked for. (With --docbook,
101
the environment variables DOCBOOK2HTML, DOCBOOK2PDF, DOCBOOK2PS, and
102
DOCBOOK2TXT are also respected.)
104
You can set the environment variables MAKEINFO, TEXI2DVI, TEXI2HTML, and
105
DVIPS to control the programs that get executed, and
106
GENDOCS_TEMPLATE_DIR to control where the gendocs_template file is
107
looked for. With --docbook, the environment variables DOCBOOK2HTML,
108
DOCBOOK2PDF, DOCBOOK2PS, and DOCBOOK2TXT are also respected.
104
By default, makeinfo is run in the default (English) locale, since
105
that's the language of most Texinfo manuals. If you happen to have a
106
non-English manual and non-English web site, see the SETLANG setting
110
By default, makeinfo and texi2dvi are run in the default (English)
111
locale, since that's the language of most Texinfo manuals. If you
112
happen to have a non-English manual and non-English web site, see the
113
SETLANG setting in the source.
109
115
Email bug reports or enhancement requests to bug-texinfo@gnu.org.
186
192
cmd="$SETLANG $MAKEINFO -o $PACKAGE.info \"$srcfile\""
187
193
echo "Generating info files... ($cmd)"
190
tar czf $outdir/$PACKAGE.info.tar.gz $PACKAGE.info*
191
info_tgz_size=`calcsize $outdir/$PACKAGE.info.tar.gz`
196
tar czf "$outdir/$PACKAGE.info.tar.gz" $PACKAGE.info*
197
info_tgz_size=`calcsize "$outdir/$PACKAGE.info.tar.gz"`
192
198
# do not mv the info files, there's no point in having them available
193
199
# separately on the web.
195
cmd="${TEXI2DVI} \"$srcfile\""
201
cmd="$SETLANG ${TEXI2DVI} \"$srcfile\""
196
202
echo "Generating dvi ... ($cmd)"
201
207
${DVIPS} $PACKAGE -o
202
208
gzip -f -9 $PACKAGE.ps
203
209
ps_gz_size=`calcsize $PACKAGE.ps.gz`
204
mv $PACKAGE.ps.gz $outdir/
210
mv $PACKAGE.ps.gz "$outdir/"
206
212
# compress/finish dvi:
207
213
gzip -f -9 $PACKAGE.dvi
208
214
dvi_gz_size=`calcsize $PACKAGE.dvi.gz`
209
mv $PACKAGE.dvi.gz $outdir/
215
mv $PACKAGE.dvi.gz "$outdir/"
211
cmd="${TEXI2DVI} --pdf \"$srcfile\""
217
cmd="$SETLANG ${TEXI2DVI} --pdf \"$srcfile\""
212
218
echo "Generating pdf ... ($cmd)"
214
220
pdf_size=`calcsize $PACKAGE.pdf`
215
mv $PACKAGE.pdf $outdir/
221
mv $PACKAGE.pdf "$outdir/"
217
223
cmd="$SETLANG $MAKEINFO -o $PACKAGE.txt --no-split --no-headers \"$srcfile\""
218
224
echo "Generating ASCII... ($cmd)"
220
226
ascii_size=`calcsize $PACKAGE.txt`
221
gzip -f -9 -c $PACKAGE.txt >$outdir/$PACKAGE.txt.gz
222
ascii_gz_size=`calcsize $outdir/$PACKAGE.txt.gz`
223
mv $PACKAGE.txt $outdir/
227
gzip -f -9 -c $PACKAGE.txt >"$outdir/$PACKAGE.txt.gz"
228
ascii_gz_size=`calcsize "$outdir/$PACKAGE.txt.gz"`
229
mv $PACKAGE.txt "$outdir/"
233
239
cd ${split_html_dir} || exit 1
234
240
ln -sf ${PACKAGE}.html index.html
235
tar -czf $dotdot_outdir/${PACKAGE}.html_$1.tar.gz -- *.html
241
tar -czf "$abs_outdir/${PACKAGE}.html_$1.tar.gz" -- *.html
237
eval html_$1_tgz_size=`calcsize $outdir/${PACKAGE}.html_$1.tar.gz`
238
rm -f $outdir/html_$1/*.html
239
mkdir -p $outdir/html_$1/
240
mv ${split_html_dir}/*.html $outdir/html_$1/
243
eval html_$1_tgz_size=`calcsize "$outdir/${PACKAGE}.html_$1.tar.gz"`
244
rm -f "$outdir"/html_$1/*.html
245
mkdir -p "$outdir/html_$1/"
246
mv ${split_html_dir}/*.html "$outdir/html_$1/"
241
247
rmdir ${split_html_dir}
248
254
rm -rf $PACKAGE.html # in case a directory is left over
250
256
html_mono_size=`calcsize $PACKAGE.html`
251
gzip -f -9 -c $PACKAGE.html >$outdir/$PACKAGE.html.gz
252
html_mono_gz_size=`calcsize $outdir/$PACKAGE.html.gz`
253
mv $PACKAGE.html $outdir/
257
gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz"
258
html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"`
259
mv $PACKAGE.html "$outdir/"
255
261
cmd="$SETLANG $MAKEINFO --html -o $PACKAGE.html $htmlarg \"$srcfile\""
256
262
echo "Generating html by node... ($cmd)"
258
264
split_html_dir=$PACKAGE.html
260
266
cd ${split_html_dir} || exit 1
261
tar -czf $dotdot_outdir/${PACKAGE}.html_node.tar.gz -- *.html
267
tar -czf "$abs_outdir/${PACKAGE}.html_node.tar.gz" -- *.html
263
html_node_tgz_size=`calcsize $outdir/${PACKAGE}.html_node.tar.gz`
264
rm -f $outdir/html_node/*.html
265
mkdir -p $outdir/html_node/
266
mv ${split_html_dir}/*.html $outdir/html_node/
269
html_node_tgz_size=`calcsize "$outdir/${PACKAGE}.html_node.tar.gz"`
270
rm -f "$outdir"/html_node/*.html
271
mkdir -p "$outdir/html_node/"
272
mv ${split_html_dir}/*.html "$outdir/html_node/"
267
273
rmdir ${split_html_dir}
269
275
cmd="$SETLANG $TEXI2HTML --output $PACKAGE.html $htmlarg \"$srcfile\""
271
277
rm -rf $PACKAGE.html # in case a directory is left over
273
279
html_mono_size=`calcsize $PACKAGE.html`
274
gzip -f -9 -c $PACKAGE.html >$outdir/$PACKAGE.html.gz
275
html_mono_gz_size=`calcsize $outdir/$PACKAGE.html.gz`
276
mv $PACKAGE.html $outdir/
280
gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz"
281
html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"`
282
mv $PACKAGE.html "$outdir/"
279
285
html_split chapter
283
289
echo Making .tar.gz for sources...
284
290
d=`dirname $srcfile`
285
srcfiles=`ls $d/*.texinfo $d/*.texi $d/*.txi $d/*.eps 2>/dev/null` || true
286
tar cvzfh $outdir/$PACKAGE.texi.tar.gz $srcfiles
287
texi_tgz_size=`calcsize $outdir/$PACKAGE.texi.tar.gz`
293
srcfiles=`ls *.texinfo *.texi *.txi *.eps 2>/dev/null` || true
294
tar cvzfh "$abs_outdir/$PACKAGE.texi.tar.gz" $srcfiles
296
texi_tgz_size=`calcsize "$outdir/$PACKAGE.texi.tar.gz"`
289
298
if test -n "$docbook"; then
290
299
cmd="$SETLANG $MAKEINFO -o - --docbook \"$srcfile\" > ${srcdir}/$PACKAGE-db.xml"
291
300
echo "Generating docbook XML... ($cmd)"
293
302
docbook_xml_size=`calcsize $PACKAGE-db.xml`
294
gzip -f -9 -c $PACKAGE-db.xml >$outdir/$PACKAGE-db.xml.gz
295
docbook_xml_gz_size=`calcsize $outdir/$PACKAGE-db.xml.gz`
296
mv $PACKAGE-db.xml $outdir/
303
gzip -f -9 -c $PACKAGE-db.xml >"$outdir/$PACKAGE-db.xml.gz"
304
docbook_xml_gz_size=`calcsize "$outdir/$PACKAGE-db.xml.gz"`
305
mv $PACKAGE-db.xml "$outdir/"
298
cmd="${DOCBOOK2HTML} -o $split_html_db_dir ${outdir}/$PACKAGE-db.xml"
307
cmd="${DOCBOOK2HTML} -o $split_html_db_dir \"${outdir}/$PACKAGE-db.xml\""
299
308
echo "Generating docbook HTML... ($cmd)"
301
310
split_html_db_dir=html_node_db
303
312
cd ${split_html_db_dir} || exit 1
304
tar -czf $dotdot_outdir/${PACKAGE}.html_node_db.tar.gz -- *.html
313
tar -czf "$abs_outdir/${PACKAGE}.html_node_db.tar.gz" -- *.html
306
html_node_db_tgz_size=`calcsize $outdir/${PACKAGE}.html_node_db.tar.gz`
307
rm -f $outdir/html_node_db/*.html
308
mkdir -p $outdir/html_node_db
309
mv ${split_html_db_dir}/*.html $outdir/html_node_db/
315
html_node_db_tgz_size=`calcsize "$outdir/${PACKAGE}.html_node_db.tar.gz"`
316
rm -f "$outdir"/html_node_db/*.html
317
mkdir -p "$outdir/html_node_db"
318
mv ${split_html_db_dir}/*.html "$outdir/html_node_db/"
310
319
rmdir ${split_html_db_dir}
312
cmd="${DOCBOOK2TXT} ${outdir}/$PACKAGE-db.xml"
321
cmd="${DOCBOOK2TXT} \"${outdir}/$PACKAGE-db.xml\""
313
322
echo "Generating docbook ASCII... ($cmd)"
315
324
docbook_ascii_size=`calcsize $PACKAGE-db.txt`
316
mv $PACKAGE-db.txt $outdir/
325
mv $PACKAGE-db.txt "$outdir/"
318
cmd="${DOCBOOK2PS} ${outdir}/$PACKAGE-db.xml"
327
cmd="${DOCBOOK2PS} \"${outdir}/$PACKAGE-db.xml\""
319
328
echo "Generating docbook PS... ($cmd)"
321
gzip -f -9 -c $PACKAGE-db.ps >$outdir/$PACKAGE-db.ps.gz
322
docbook_ps_gz_size=`calcsize $outdir/$PACKAGE-db.ps.gz`
323
mv $PACKAGE-db.ps $outdir/
330
gzip -f -9 -c $PACKAGE-db.ps >"$outdir/$PACKAGE-db.ps.gz"
331
docbook_ps_gz_size=`calcsize "$outdir/$PACKAGE-db.ps.gz"`
332
mv $PACKAGE-db.ps "$outdir/"
325
cmd="${DOCBOOK2PDF} ${outdir}/$PACKAGE-db.xml"
334
cmd="${DOCBOOK2PDF} \"${outdir}/$PACKAGE-db.xml\""
326
335
echo "Generating docbook PDF... ($cmd)"
328
337
docbook_pdf_size=`calcsize $PACKAGE-db.pdf`
329
mv $PACKAGE-db.pdf $outdir/
338
mv $PACKAGE-db.pdf "$outdir/"
332
341
echo "Writing index file..."