Debian Codegraph @

build-aux/gendocs.sh

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`. -e
2 # gendocs.sh -- generate a GNU manual in many formats. This script is
3 # mentioned in maintain.texi. See the help message below for usage details.
4
5 scriptversion=2026-01-01.00
6
7 # Copyright 2003-2026 Free Software Foundation, Inc.
8 #
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <https://www.gnu.org/licenses/>.
21 #
22 # Original author: Mohit Agarwal.
23 # Send bug reports and any other correspondence to [email protected].
24 #
25 # The latest version of this script, and the companion template, is
26 # available from the Gnulib repository:
27 #
28 # https://git.savannah.gnu.org/cgit/gnulib.git/tree/build-aux/gendocs.sh
29 # https://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/gendocs_template
30
31 # TODO:
32 # - image importing was only implemented for HTML generated by
33 # makeinfo. But it should be simple enough to adjust.
34 # - images are not imported in the source tarball. All the needed
35 # formats (PDF, PNG, etc.) should be included.
36
37 prog=`basenamescip-shell system . . basename. "$0"`
38 srcdir=`pwdscip-shell system . . pwd.`
39
40 scripturl="https://git.savannah.gnu.org/cgit/gnulib.git/plain/build-aux/gendocs.sh"
41 templateurl="https://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/gendocs_template"
42
43 : "${SETLANG="env LANG= LC_TIME= LC_MESSAGES= LC_ALL= LANGUAGE="}"
44 : "${MAKEINFO="makeinfo"}"
45 : "${TEXI2DVI="texi2dvi"}"
46 : "${DOCBOOK2HTML="docbook2html"}"
47 : "${DOCBOOK2PDF="docbook2pdf"}"
48 : "${DOCBOOK2TXT="docbook2txt"}"
49 : "${GENDOCS_TEMPLATE_DIR="."}"
50 : "${PERL="perl"}"
51 : "${TEXI2HTML="texi2html"}"
52 unset CDPATH
53 unset use_texi2html
54
55 MANUAL_TITLE=
56 PACKAGE=
57 EMAIL[email protected] # please override with --email
58 commonarg= # passed to all makeinfo/texi2html invocations.
59 dirargs= # passed to all tools (-I dir).
60 dirs= # -I directories.
61 htmlarg="--css-ref=https://www.gnu.org/software/gnulib/manual.css -c TOP_NODE_UP_URL=/manual"
62 default_htmlarg=true
63 infoarg=--no-split
64 generate_ascii=true
65 generate_html=true
66 generate_info=true
67 generate_tex=true
68 outdir=manual
69 unset source_extra
70 split=node
71 srcfile=
72 texarg="-t @finalout"
73
74 version="gendocs.sh $scriptversion
75
76 Copyright 2026 Free Software Foundation, Inc.
77 There is NO warranty. You may redistribute this software
78 under the terms of the GNU General Public License.
79 For more information about these matters, see the files named COPYING."
80
81 usage="Usage: $prog [OPTION]... PACKAGE MANUAL-TITLE
82
83 Generate output in various formats from PACKAGE.texinfo (or .texi or
84 .txi) source. See the GNU Maintainers document for a more extensive
85 discussion:
86 https://www.gnu.org/prep/maintain_toc.html
87
88 Options:
89 --email ADR use ADR as contact in generated web pages; always give this.
90
91 -s SRCFILE read Texinfo from SRCFILE, instead of PACKAGE.{texinfo|texi|txi}
92 -o OUTDIR write files into OUTDIR, instead of manual/.
93 -I DIR append DIR to the Texinfo search path.
94 --common ARG pass ARG in all invocations.
95 --html ARG pass ARG to makeinfo or texi2html for HTML targets,
96 instead of '$htmlarg'.
97 --info ARG pass ARG to makeinfo for Info, instead of --no-split.
98 --no-ascii skip generating the plain text output.
99 --no-html skip generating the html output.
100 --no-info skip generating the info output.
101 --no-tex skip generating the dvi and pdf output.
102 --source ARG include ARG in tar archive of sources.
103 --split HOW make split HTML by node, section, chapter; default node.
104 --tex ARG pass ARG to texi2dvi for DVI and PDF, instead of -t @finalout.
105
106 --texi2html use texi2html to make HTML target, with all split versions.
107 --docbook convert through DocBook too (xml, txt, html, pdf).
108
109 --help display this help and exit successfully.
110 --version display version information and exit successfully.
111
112 Simple example: $prog --email [email protected] emacs \"GNU Emacs Manual\"
113
114 Typical sequence:
115 cd PACKAGESOURCE/doc
116 wget \"$scripturl\"
117 wget \"$templateurl\"
118 $prog --email BUGLIST MANUAL \"GNU MANUAL - One-line description\"
119
120 Output will be in a new subdirectory \"manual\" (by default;
121 use -o OUTDIR to override). Move all the new files into your web CVS
122 tree, as explained in the Web Pages node of maintain.texi.
123
124 Please use the --email ADDRESS option so your own bug-reporting
125 address will be used in the generated HTML pages.
126
127 MANUAL-TITLE is included as part of the HTML <title> of the overall
128 manual/index.html file. It should include the name of the package being
129 documented. manual/index.html is created by substitution from the file
130 $GENDOCS_TEMPLATE_DIR/gendocs_template. (Feel free to modify the
131 generic template for your own purposes.)
132
133 If you have several manuals, you'll need to run this script several
134 times with different MANUAL values, specifying a different output
135 directory with -o each time. Then write (by hand) an overall index.html
136 with links to them all.
137
138 If a manual's Texinfo sources are spread across several directories,
139 first copy or symlink all Texinfo sources into a single directory.
140 (Part of the script's work is to make a tar.gz of the sources.)
141
142 As implied above, by default monolithic Info files are generated.
143 If you want split Info, or other Info options, use --info to override.
144
145 You can set the environment variables MAKEINFO, TEXI2DVI, TEXI2HTML,
146 and PERL to control the programs that get executed, and
147 GENDOCS_TEMPLATE_DIR to control where the gendocs_template file is
148 looked for. With --docbook, the environment variables DOCBOOK2HTML,
149 DOCBOOK2PDF, and DOCBOOK2TXT are also consulted.
150
151 By default, makeinfo and texi2dvi are run in the default (English)
152 locale, since that's the language of most Texinfo manuals. If you
153 happen to have a non-English manual and non-English web site, see the
154 SETLANG setting in the source.
155
156 Email bug reports or enhancement requests to [email protected].
157 "
158
159 while testscip-shell system . . test. $# -gt 0; do
160 case $1 in
161 -s) shift; srcfile=$1;;
162 -o) shift; outdir=$1;;
163 -I) shift; dirargs="$dirargs -I '$1'"; dirs="$dirs $1";;
164 --common) shift; commonarg=$1;;
165 --docbook) docbook=yes;;
166 --email) shift; EMAIL=$1;;
167 --html) shift; default_htmlarg=false; htmlarg=$1;;
168 --info) shift; infoarg=$1;;
169 --no-ascii) generate_ascii=false;;
170 --no-html) generate_html=false;;
171 --no-info) generate_info=false;;
172 --no-tex) generate_tex=false;;
173 --source) shift; source_extra=$1;;
174 --split) shift; split=$1;;
175 --tex) shift; texarg=$1;;
176 --texi2html) use_texi2html=1;;
177
178 --help) echoscip-shell system . . echo. "$usage"; exit 0;;
179 --version) echoscip-shell system . . echo. "$version"; exit 0;;
180 -*)
181 echoscip-shell system . . echo. "$0: Unknown option \`$1'." >&2
182 echoscip-shell system . . echo. "$0: Try \`--help' for more information." >&2
183 exit 1;;
184 *)
185 if testscip-shell system . . test. -z "$PACKAGE"; then
186 PACKAGE=$1
187 elif testscip-shell system . . test. -z "$MANUAL_TITLE"; then
188 MANUAL_TITLE=$1
189 else
190 echoscip-shell system . . echo. "$0: extra non-option argument \`$1'." >&2
191 exit 1
192 fi;;
193 esac
194 shift
195 done
196
197 # makeinfo uses the dirargs, but texi2dvi doesn't.
198 commonarg=" $dirargs $commonarg"
199
200 # For most of the following, the base name is just $PACKAGE
201 base=$PACKAGE
202
203 if $default_htmlarg && testscip-shell system . . test. -n "$use_texi2html"; then
204 # The legacy texi2html doesn't support TOP_NODE_UP_URL
205 htmlarg="--css-ref=https://www.gnu.org/software/gnulib/manual.css"
206 fi
207
208 if testscip-shell system . . test. -n "$srcfile"; then
209 # but here, we use the basename of $srcfile
210 base=`basenamescip-shell system . . basename. "$srcfile"`
211 case $base in
212 *.txi|*.texi|*.texinfo) base=`echoscip-shell system . . echo. "$base"|sedscip-shell system . . sed. 's/\.[texinfo]*$//'`;;
213 esac
214 PACKAGE=$base
215 elif testscip-shell system . . test. -s "$srcdir/$PACKAGE.texinfo"; then
216 srcfile=$srcdir/$PACKAGE.texinfo
217 elif testscip-shell system . . test. -s "$srcdir/$PACKAGE.texi"; then
218 srcfile=$srcdir/$PACKAGE.texi
219 elif testscip-shell system . . test. -s "$srcdir/$PACKAGE.txi"; then
220 srcfile=$srcdir/$PACKAGE.txi
221 else
222 echoscip-shell system . . echo. "$0: cannot find .texinfo or .texi or .txi for $PACKAGE in $srcdir." >&2
223 exit 1
224 fi
225
226 if testscip-shell system . . test. ! -r $GENDOCS_TEMPLATE_DIR/gendocs_template; then
227 echoscip-shell system . . echo. "$0: cannot read $GENDOCS_TEMPLATE_DIR/gendocs_template." >&2
228 echoscip-shell system . . echo. "$0: it is available from $templateurl." >&2
229 exit 1
230 fi
231
232 # Function to return size of $1 in something resembling kilobytes.
233 calcsizescip-shell shell libtasn1-6 4.21.0-2 calcsize().()
234 {
235 set `lsscip-shell system . . ls. -ks "$1"`
236 echoscip-shell system . . echo. $1
237 }
238
239 # copy_images OUTDIR HTML-FILE...
240 # -------------------------------
241 # Copy all the images needed by the HTML-FILEs into OUTDIR.
242 # Look for them in . and the -I directories; this is simpler than what
243 # makeinfo supports with -I, but hopefully it will suffice.
244 copy_imagesscip-shell shell libtasn1-6 4.21.0-2 copy_images().()
245 {
246 local odir
247 odir=$1
248 shift
249 $PERL -n -e "
250 BEGIN {
251 \$me = '$prog';
252 \$odir = '$odir';
253 @dirs = qw(. $dirs);
254 }
255 " -e '
256 /<img src="(.*?)"/g && ++$need{$1};
257
258 END {
259 #print "$me: @{[sort keys %need]}\n"; # for debugging, show images found.
260 FILE: for my $f (sort keys %need) {
261 for my $d (@dirs) {
262 if (-f "$d/$f") {
263 use File::Basename;
264 my $dest = dirname ("$odir/$f");
265 #
266 use File::Path;
267 -d $dest || mkpath ($dest)
268 || die "$me: cannot mkdir $dest: $!\n";
269 #
270 use File::Copy;
271 copy ("$d/$f", $dest)
272 || die "$me: cannot copy $d/$f to $dest: $!\n";
273 next FILE;
274 }
275 }
276 die "$me: $ARGV: cannot find image $f\n";
277 }
278 }
279 ' -- "$@" || exit 1
280 }
281
282 case $outdir in
283 /*) abs_outdir=$outdir;;
284 *) abs_outdir=$srcdir/$outdir;;
285 esac
286
287 echoscip-shell system . . echo. "Making output for $srcfile"
288 echoscip-shell system . . echo. " in `pwdscip-shell system . . pwd.`"
289 mkdirscip-shell system . . mkdir. -p "$outdir/"
290
291 #
292 if $generate_info; then
293 cmd="$SETLANG $MAKEINFO -o $PACKAGE.info $commonarg $infoarg \"$srcfile\""
294 echoscip-shell system . . echo. "Generating info... ($cmd)"
295 rmscip-shell system . . rm. -f $PACKAGE.info* # get rid of any strays
296 eval "$cmd"
297 tarscip-shell system . . tar. czf "$outdir/$PACKAGE.info.tar.gz" $PACKAGE.info*
298 lsscip-shell system . . ls. -l "$outdir/$PACKAGE.info.tar.gz"
299 info_tgz_size=`calcsizescip-shell shell libtasn1-6 4.21.0-2 calcsize(). "$outdir/$PACKAGE.info.tar.gz"`
300 # do not mv the info files, there's no point in having them available
301 # separately on the web.
302 fi # end info
303
304 #
305 if $generate_tex; then
306 cmd="$SETLANG $TEXI2DVI $dirargs $texarg \"$srcfile\""
307 printfscip-shell system . . printf. "\nGenerating dvi... (%s)\n" "$cmd"
308 eval "$cmd"
309 # compress/finish dvi:
310 gzipscip-shell system . . gzip. -f -9 $PACKAGE.dvi
311 dvi_gz_size=`calcsizescip-shell shell libtasn1-6 4.21.0-2 calcsize(). $PACKAGE.dvi.gz`
312 mvscip-shell system . . mv. $PACKAGE.dvi.gz "$outdir/"
313 lsscip-shell system . . ls. -l "$outdir/$PACKAGE.dvi.gz"
314
315 cmd="$SETLANG $TEXI2DVI --pdf $dirargs $texarg \"$srcfile\""
316 printfscip-shell system . . printf. "\nGenerating pdf... (%s)\n" "$cmd"
317 eval "$cmd"
318 pdf_size=`calcsizescip-shell shell libtasn1-6 4.21.0-2 calcsize(). $PACKAGE.pdf`
319 mvscip-shell system . . mv. $PACKAGE.pdf "$outdir/"
320 lsscip-shell system . . ls. -l "$outdir/$PACKAGE.pdf"
321 fi # end tex (dvi + pdf)
322
323 #
324 if $generate_ascii; then
325 opt="-o $PACKAGE.txt --no-split --no-headers $commonarg"
326 cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
327 printfscip-shell system . . printf. "\nGenerating ascii... (%s)\n" "$cmd"
328 eval "$cmd"
329 ascii_size=`calcsizescip-shell shell libtasn1-6 4.21.0-2 calcsize(). $PACKAGE.txt`
330 gzipscip-shell system . . gzip. -f -9 -c $PACKAGE.txt >"$outdir/$PACKAGE.txt.gz"
331 ascii_gz_size=`calcsizescip-shell shell libtasn1-6 4.21.0-2 calcsize(). "$outdir/$PACKAGE.txt.gz"`
332 mvscip-shell system . . mv. $PACKAGE.txt "$outdir/"
333 lsscip-shell system . . ls. -l "$outdir/$PACKAGE.txt" "$outdir/$PACKAGE.txt.gz"
334 fi
335
336 #
337
338 if $generate_html; then
339 # Split HTML at level $1. Used for texi2html.
340 html_splitscip-shell shell libtasn1-6 4.21.0-2 html_split().()
341 {
342 opt="--split=$1 --node-files $commonarg $htmlarg"
343 cmd="$SETLANG $TEXI2HTML --output $PACKAGE.html $opt \"$srcfile\""
344 printfscip-shell system . . printf. "\nGenerating html by %s... (%s)\n" "$1" "$cmd"
345 eval "$cmd"
346 split_html_dir=$PACKAGE.html
347 (
348 cd ${split_html_dir} || exit 1
349 testscip-shell system . . test. -f index.html || testscip-shell system . . test. ! -f ${PACKAGE}.html ||
350 lnscip-shell system . . ln. -s ${PACKAGE}.html index.html
351 tarscip-shell system . . tar. -czf "$abs_outdir/${PACKAGE}.html_$1.tar.gz" -- *.html
352 )
353 eval html_$1_tgz_size=`calcsizescip-shell shell libtasn1-6 4.21.0-2 calcsize(). "$outdir/${PACKAGE}.html_$1.tar.gz"`
354 rmscip-shell system . . rm. -f "$outdir"/html_$1/*.html
355 mkdirscip-shell system . . mkdir. -p "$outdir/html_$1/"
356 mvscip-shell system . . mv. ${split_html_dir}/*.html "$outdir/html_$1/"
357 rmdirscip-shell system . . rmdir. ${split_html_dir}
358 }
359
360 if testscip-shell system . . test. -z "$use_texi2html"; then
361 opt="--no-split --html -o $PACKAGE.html $commonarg $htmlarg"
362 cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
363 printfscip-shell system . . printf. "\nGenerating monolithic html... (%s)\n" "$cmd"
364 rmscip-shell system . . rm. -rf $PACKAGE.html # in case a directory is left over
365 eval "$cmd"
366 html_mono_size=`calcsizescip-shell shell libtasn1-6 4.21.0-2 calcsize(). $PACKAGE.html`
367 gzipscip-shell system . . gzip. -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz"
368 html_mono_gz_size=`calcsizescip-shell shell libtasn1-6 4.21.0-2 calcsize(). "$outdir/$PACKAGE.html.gz"`
369 copy_imagesscip-shell shell libtasn1-6 4.21.0-2 copy_images(). "$outdir/" $PACKAGE.html
370 mvscip-shell system . . mv. $PACKAGE.html "$outdir/"
371 lsscip-shell system . . ls. -l "$outdir/$PACKAGE.html" "$outdir/$PACKAGE.html.gz"
372
373 # Before Texinfo 5.0, makeinfo did not accept a --split=HOW option,
374 # it just always split by node. So if we're splitting by node anyway,
375 # leave it out.
376 if testscip-shell system . . test. "x$split" = xnode; then
377 split_arg=
378 else
379 split_arg=--split=$split
380 fi
381 #
382 opt="--html -o $PACKAGE.html $split_arg $commonarg $htmlarg"
383 cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
384 printfscip-shell system . . printf. "\nGenerating html by %s... (%s)\n" "$split" "$cmd"
385 eval "$cmd"
386 split_html_dir=$PACKAGE.html
387 copy_imagesscip-shell shell libtasn1-6 4.21.0-2 copy_images(). $split_html_dir/ $split_html_dir/*.html
388 (
389 cd $split_html_dir || exit 1
390 tarscip-shell system . . tar. -czf "$abs_outdir/$PACKAGE.html_$split.tar.gz" -- *
391 )
392 eval \
393 html_${split}_tgz_size=`calcsize "$outdir/$PACKAGE.html_$split.tar.gz"`
394 rmscip-shell system . . rm. -rf "$outdir/html_$split/"
395 mvscip-shell system . . mv. $split_html_dir "$outdir/html_$split/"
396 duscip-shell system . . du. -s "$outdir/html_$split/"
397 lsscip-shell system . . ls. -l "$outdir/$PACKAGE.html_$split.tar.gz"
398
399 else # use texi2html:
400 opt="--output $PACKAGE.html $commonarg $htmlarg"
401 cmd="$SETLANG $TEXI2HTML $opt \"$srcfile\""
402 printfscip-shell system . . printf. "\nGenerating monolithic html with texi2html... (%s)\n" "$cmd"
403 rmscip-shell system . . rm. -rf $PACKAGE.html # in case a directory is left over
404 eval "$cmd"
405 html_mono_size=`calcsizescip-shell shell libtasn1-6 4.21.0-2 calcsize(). $PACKAGE.html`
406 gzipscip-shell system . . gzip. -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz"
407 html_mono_gz_size=`calcsizescip-shell shell libtasn1-6 4.21.0-2 calcsize(). "$outdir/$PACKAGE.html.gz"`
408 mvscip-shell system . . mv. $PACKAGE.html "$outdir/"
409
410 html_splitscip-shell shell libtasn1-6 4.21.0-2 html_split(). node
411 html_splitscip-shell shell libtasn1-6 4.21.0-2 html_split(). chapter
412 html_splitscip-shell shell libtasn1-6 4.21.0-2 html_split(). section
413 fi
414 fi # end html
415
416 #
417 printfscip-shell system . . printf. "\nMaking .tar.gz for sources...\n"
418 d=`dirnamescip-shell system . . dirname. $srcfile`
419 (
420 cd "$d" || exit
421
422 # Set PATS to a list of globbing patterns that expand to
423 # file names to be put into the .tar.gz for sources.
424 # Omit patterns that do not expand to file names.
425 pats=
426
427 if case `$MAKEINFO --version | sedscip-shell system . . sed. -e 's/^[^0-9]*//' -e 1q` in \
428 [1-6]* | 7.[01]*) falsescip-shell system . . false.;; \
429 *) truescip-shell system . . true.;; \
430 esac \
431 ; then
432
433 for pat in '*.eps'; do
434 for file in $pat; do
435 testscip-shell system . . test. "$file" = "$pat" && testscip-shell system . . test. ! -e "$file" || pats="$pats $pat"
436 break
437 done
438 done
439
440 # if $MAKEINFO is recent enough, use --trace-includes on the
441 # $srcfile to get the included files of the targeted manual only
442 base=`basenamescip-shell system . . basename. "$srcfile"`
443
444 cmd="$SETLANG $MAKEINFO $commonarg --trace-includes \"$base\""
445 eval "$cmd" \
446 | tarscip-shell system . . tar. -czhf "$abs_outdir/$PACKAGE.texi.tar.gz" \
447 --verbatim-files-from -T- -- "$base" $pats \
448 ${source_extra+"$source_extra"} \
449 && lsscip-shell system . . ls. -l "$abs_outdir/$PACKAGE.texi.tar.gz"
450 else
451 for pat in '*.texinfo' '*.texi' '*.txi' '*.eps'; do
452 for file in $pat; do
453 testscip-shell system . . test. "$file" = "$pat" && testscip-shell system . . test. ! -e "$file" || pats="$pats $pat"
454 break
455 done
456 done
457
458 tarscip-shell system . . tar. -czhf "$abs_outdir/$PACKAGE.texi.tar.gz" \
459 -- $pats ${source_extra+"$source_extra"} \
460 && lsscip-shell system . . ls. -l "$abs_outdir/$PACKAGE.texi.tar.gz"
461 fi
462 ) || exit
463 texi_tgz_size=`calcsizescip-shell shell libtasn1-6 4.21.0-2 calcsize(). "$outdir/$PACKAGE.texi.tar.gz"`
464
465 #
466 # Do everything again through docbook.
467 if testscip-shell system . . test. -n "$docbook"; then
468 opt="-o - --docbook $commonarg"
469 cmd="$SETLANG $MAKEINFO $opt \"$srcfile\" >${srcdir}/$PACKAGE-db.xml"
470 printfscip-shell system . . printf. "\nGenerating docbook XML... (%s)\n" "$cmd"
471 eval "$cmd"
472 docbook_xml_size=`calcsizescip-shell shell libtasn1-6 4.21.0-2 calcsize(). $PACKAGE-db.xml`
473 gzipscip-shell system . . gzip. -f -9 -c $PACKAGE-db.xml >"$outdir/$PACKAGE-db.xml.gz"
474 docbook_xml_gz_size=`calcsizescip-shell shell libtasn1-6 4.21.0-2 calcsize(). "$outdir/$PACKAGE-db.xml.gz"`
475 mvscip-shell system . . mv. $PACKAGE-db.xml "$outdir/"
476
477 split_html_db_dir=html_node_db
478 opt="$commonarg -o $split_html_db_dir"
479 cmd="$DOCBOOK2HTML $opt \"${outdir}/$PACKAGE-db.xml\""
480 printfscip-shell system . . printf. "\nGenerating docbook HTML... (%s)\n" "$cmd"
481 eval "$cmd"
482 (
483 cd ${split_html_db_dir} || exit 1
484 tarscip-shell system . . tar. -czf "$abs_outdir/${PACKAGE}.html_node_db.tar.gz" -- *.html
485 )
486 html_node_db_tgz_size=`calcsizescip-shell shell libtasn1-6 4.21.0-2 calcsize(). "$outdir/${PACKAGE}.html_node_db.tar.gz"`
487 rmscip-shell system . . rm. -f "$outdir"/html_node_db/*.html
488 mkdirscip-shell system . . mkdir. -p "$outdir/html_node_db"
489 mvscip-shell system . . mv. ${split_html_db_dir}/*.html "$outdir/html_node_db/"
490 rmdirscip-shell system . . rmdir. ${split_html_db_dir}
491
492 cmd="$DOCBOOK2TXT \"${outdir}/$PACKAGE-db.xml\""
493 printfscip-shell system . . printf. "\nGenerating docbook ASCII... (%s)\n" "$cmd"
494 eval "$cmd"
495 docbook_ascii_size=`calcsizescip-shell shell libtasn1-6 4.21.0-2 calcsize(). $PACKAGE-db.txt`
496 mvscip-shell system . . mv. $PACKAGE-db.txt "$outdir/"
497
498 cmd="$DOCBOOK2PDF \"${outdir}/$PACKAGE-db.xml\""
499 printfscip-shell system . . printf. "\nGenerating docbook PDF... (%s)\n" "$cmd"
500 eval "$cmd"
501 docbook_pdf_size=`calcsizescip-shell shell libtasn1-6 4.21.0-2 calcsize(). $PACKAGE-db.pdf`
502 mvscip-shell system . . mv. $PACKAGE-db.pdf "$outdir/"
503 fi
504
505 #
506 printfscip-shell system . . printf. "\nMaking index.html for %s...\n" "$PACKAGE"
507 if testscip-shell system . . test. -z "$use_texi2html"; then
508 if testscip-shell system . . test. x$split = xnode; then
509 CONDS="/%%IF *HTML_NODE%%/d;/%%ENDIF *HTML_NODE%%/d;\
510 /%%IF *HTML_CHAPTER%%/,/%%ENDIF *HTML_CHAPTER%%/d;\
511 /%%IF *HTML_SECTION%%/,/%%ENDIF *HTML_SECTION%%/d;"
512 elif testscip-shell system . . test. x$split = xchapter; then
513 CONDS="/%%IF *HTML_CHAPTER%%/d;/%%ENDIF *HTML_CHAPTER%%/d;\
514 /%%IF *HTML_SECTION%%/,/%%ENDIF *HTML_SECTION%%/d;\
515 /%%IF *HTML_NODE%%/,/%%ENDIF *HTML_NODE%%/d;"
516 elif testscip-shell system . . test. x$split = xsection; then
517 CONDS="/%%IF *HTML_SECTION%%/d;/%%ENDIF *HTML_SECTION%%/d;\
518 /%%IF *HTML_CHAPTER%%/,/%%ENDIF *HTML_CHAPTER%%/d;\
519 /%%IF *HTML_NODE%%/,/%%ENDIF *HTML_NODE%%/d;"
520 else
521 CONDS="/%%IF.*%%/d;/%%ENDIF.*%%/d;" # invalid split argument
522 fi
523 else
524 # for texi2html, we do not take account of --split and simply output
525 # all variants
526 CONDS="/%%IF.*%%/d;/%%ENDIF.*%%/d;"
527 fi
528
529 curdate=`$SETLANG date '+%B %d, %Y'`
530 sedscip-shell system . . sed. \
531 -e "s!%%TITLE%%!$MANUAL_TITLE!g" \
532 -e "s!%%EMAIL%%!$EMAIL!g" \
533 -e "s!%%PACKAGE%%!$PACKAGE!g" \
534 -e "s!%%DATE%%!$curdate!g" \
535 -e "s!%%HTML_MONO_SIZE%%!$html_mono_size!g" \
536 -e "s!%%HTML_MONO_GZ_SIZE%%!$html_mono_gz_size!g" \
537 -e "s!%%HTML_NODE_TGZ_SIZE%%!$html_node_tgz_size!g" \
538 -e "s!%%HTML_SECTION_TGZ_SIZE%%!$html_section_tgz_size!g" \
539 -e "s!%%HTML_CHAPTER_TGZ_SIZE%%!$html_chapter_tgz_size!g" \
540 -e "s!%%INFO_TGZ_SIZE%%!$info_tgz_size!g" \
541 -e "s!%%DVI_GZ_SIZE%%!$dvi_gz_size!g" \
542 -e "s!%%PDF_SIZE%%!$pdf_size!g" \
543 -e "s!%%ASCII_SIZE%%!$ascii_size!g" \
544 -e "s!%%ASCII_GZ_SIZE%%!$ascii_gz_size!g" \
545 -e "s!%%TEXI_TGZ_SIZE%%!$texi_tgz_size!g" \
546 -e "s!%%DOCBOOK_HTML_NODE_TGZ_SIZE%%!$html_node_db_tgz_size!g" \
547 -e "s!%%DOCBOOK_ASCII_SIZE%%!$docbook_ascii_size!g" \
548 -e "s!%%DOCBOOK_PDF_SIZE%%!$docbook_pdf_size!g" \
549 -e "s!%%DOCBOOK_XML_SIZE%%!$docbook_xml_size!g" \
550 -e "s!%%DOCBOOK_XML_GZ_SIZE%%!$docbook_xml_gz_size!g" \
551 -e "s,%%SCRIPTURL%%,$scripturl,g" \
552 -e "s!%%SCRIPTNAME%%!$prog!g" \
553 -e "$CONDS" \
554 $GENDOCS_TEMPLATE_DIR/gendocs_template >"$outdir/index.html"
555
556 echoscip-shell system . . echo. "Done, see $outdir/ subdirectory for new files."
557
558 # Local variables:
559 # eval: (add-hook 'before-save-hook 'time-stamp nil t)
560 # time-stamp-start: "scriptversion="
561 # time-stamp-format: "%Y-%02m-%02d.%02H"
562 # time-stamp-end: "$"
563 # End: