~ubuntu-branches/ubuntu/trusty/libtasn1-3/trusty-proposed

« back to all changes in this revision

Viewing changes to build-aux/gendocs.sh

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Metzler
  • Date: 2011-02-12 16:38:16 UTC
  • mfrom: (4.2.2 experimental)
  • Revision ID: james.westby@ubuntu.com-20110212163816-c32zjlxe94c7ecvo
Tags: 2.9-2
* Upload to unstable.
* Downgrade libtasn1-3 priority to standard.
* Drop superfluous code from debian/rules.
* set CFLAGS += -Wall, the latest combination of cdbs + dpkg-dev does not
  seem to set it by default.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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.
4
4
 
5
 
scriptversion=2010-05-04.09
 
5
scriptversion=2010-11-27.07
6
6
 
7
 
# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
8
 
# Free Software Foundation, Inc.
 
7
# Copyright 2003-2010 Free Software Foundation, Inc.
9
8
#
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
22
21
#
23
22
# Original author: Mohit Agarwal.
24
23
# Send bug reports and any other correspondence to bug-texinfo@gnu.org.
 
24
#
 
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
 
29
#
 
30
# An up-to-date copy is also maintained in Gnulib (gnu.org/software/gnulib).
25
31
 
26
32
prog=`basename "$0"`
27
33
srcdir=`pwd`
44
50
 
45
51
version="gendocs.sh $scriptversion
46
52
 
47
 
Copyright 2009 Free Software Foundation, Inc.
 
53
Copyright 2010 Free Software Foundation, Inc.
48
54
There is NO warranty.  You may redistribute this software
49
55
under the terms of the GNU General Public License.
50
56
For more information about these matters, see the files named COPYING."
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.)
97
103
 
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.
103
109
 
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
107
 
in the source.
 
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.
108
114
 
109
115
Email bug reports or enhancement requests to bug-texinfo@gnu.org.
110
116
"
177
183
fi
178
184
 
179
185
case $outdir in
180
 
  /*) dotdot_outdir="$outdir";;
181
 
  *) dotdot_outdir="../$outdir";;
 
186
  /*) abs_outdir=$outdir;;
 
187
  *)  abs_outdir=$srcdir/$outdir;;
182
188
esac
183
189
 
184
190
echo Generating output formats for $srcfile
186
192
cmd="$SETLANG $MAKEINFO -o $PACKAGE.info \"$srcfile\""
187
193
echo "Generating info files... ($cmd)"
188
194
eval "$cmd"
189
 
mkdir -p $outdir/
190
 
tar czf $outdir/$PACKAGE.info.tar.gz $PACKAGE.info*
191
 
info_tgz_size=`calcsize $outdir/$PACKAGE.info.tar.gz`
 
195
mkdir -p "$outdir/"
 
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.
194
200
 
195
 
cmd="${TEXI2DVI} \"$srcfile\""
 
201
cmd="$SETLANG ${TEXI2DVI} \"$srcfile\""
196
202
echo "Generating dvi ... ($cmd)"
197
203
eval "$cmd"
198
204
 
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/"
205
211
 
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/"
210
216
 
211
 
cmd="${TEXI2DVI} --pdf \"$srcfile\""
 
217
cmd="$SETLANG ${TEXI2DVI} --pdf \"$srcfile\""
212
218
echo "Generating pdf ... ($cmd)"
213
219
eval "$cmd"
214
220
pdf_size=`calcsize $PACKAGE.pdf`
215
 
mv $PACKAGE.pdf $outdir/
 
221
mv $PACKAGE.pdf "$outdir/"
216
222
 
217
223
cmd="$SETLANG $MAKEINFO -o $PACKAGE.txt --no-split --no-headers \"$srcfile\""
218
224
echo "Generating ASCII... ($cmd)"
219
225
eval "$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/"
224
230
 
225
231
html_split()
226
232
{
232
238
  (
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
236
242
  )
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}
242
248
}
243
249
 
248
254
  rm -rf $PACKAGE.html  # in case a directory is left over
249
255
  eval "$cmd"
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/"
254
260
 
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
259
265
  (
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
262
268
  )
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}
268
274
else
269
275
  cmd="$SETLANG $TEXI2HTML --output $PACKAGE.html $htmlarg \"$srcfile\""
271
277
  rm -rf $PACKAGE.html  # in case a directory is left over
272
278
  eval "$cmd"
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/"
277
283
 
278
284
  html_split node
279
285
  html_split chapter
282
288
 
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`
 
291
(
 
292
  cd "$d"
 
293
  srcfiles=`ls *.texinfo *.texi *.txi *.eps 2>/dev/null` || true
 
294
  tar cvzfh "$abs_outdir/$PACKAGE.texi.tar.gz" $srcfiles
 
295
)
 
296
texi_tgz_size=`calcsize "$outdir/$PACKAGE.texi.tar.gz"`
288
297
 
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)"
292
301
  eval "$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/"
297
306
 
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)"
300
309
  eval "$cmd"
301
310
  split_html_db_dir=html_node_db
302
311
  (
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
305
314
  )
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}
311
320
 
312
 
  cmd="${DOCBOOK2TXT} ${outdir}/$PACKAGE-db.xml"
 
321
  cmd="${DOCBOOK2TXT} \"${outdir}/$PACKAGE-db.xml\""
313
322
  echo "Generating docbook ASCII... ($cmd)"
314
323
  eval "$cmd"
315
324
  docbook_ascii_size=`calcsize $PACKAGE-db.txt`
316
 
  mv $PACKAGE-db.txt $outdir/
 
325
  mv $PACKAGE-db.txt "$outdir/"
317
326
 
318
 
  cmd="${DOCBOOK2PS} ${outdir}/$PACKAGE-db.xml"
 
327
  cmd="${DOCBOOK2PS} \"${outdir}/$PACKAGE-db.xml\""
319
328
  echo "Generating docbook PS... ($cmd)"
320
329
  eval "$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/"
324
333
 
325
 
  cmd="${DOCBOOK2PDF} ${outdir}/$PACKAGE-db.xml"
 
334
  cmd="${DOCBOOK2PDF} \"${outdir}/$PACKAGE-db.xml\""
326
335
  echo "Generating docbook PDF... ($cmd)"
327
336
  eval "$cmd"
328
337
  docbook_pdf_size=`calcsize $PACKAGE-db.pdf`
329
 
  mv $PACKAGE-db.pdf $outdir/
 
338
  mv $PACKAGE-db.pdf "$outdir/"
330
339
fi
331
340
 
332
341
echo "Writing index file..."
363
372
   -e "s,%%SCRIPTURL%%,$scripturl,g" \
364
373
   -e "s!%%SCRIPTNAME%%!$prog!g" \
365
374
   -e "$CONDS" \
366
 
$GENDOCS_TEMPLATE_DIR/gendocs_template >$outdir/index.html
 
375
$GENDOCS_TEMPLATE_DIR/gendocs_template >"$outdir/index.html"
367
376
 
368
377
echo "Done, see $outdir/ subdirectory for new files."
369
378