2 # Conscript file for building SCons documentation.
10 $doc_tar_gz = "#build/dist/scons-doc-${\$env->{VERSION}}.tar.gz";
13 # We'll only try to build text files (for some documents)
14 # if lynx is available to do the dump.
16 $lynx = cons::whereis('lynx');
19 # Always create a version.sgml file containing the version information
20 # for this run. Ignore it for dependency purposes so we don't
21 # rebuild all the docs every time just because the date changes.
23 $verfile = SourcePath("version.sgml");
25 chmod(0664, $verfile);
26 open(FILE, ">$verfile") || die "Cannot open '$verfile': $!";
29 THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT.
31 <!ENTITY builddate "${\$env->{DATE}}">
32 <!ENTITY buildversion "${\$env->{VERSION}}">
33 <!ENTITY buildrevision "${\$env->{REVISION}}">
37 Ignore("version.sgml");
40 # Each document will live in its own subdirectory. List them here
41 # as hash keys, with a hash of the info to control its build.
45 'html' => 'book1.html',
48 'html' => 'scons.html',
52 'html' => 'book1.html',
56 # Find internal dependencies in .sgml files:
58 # <!entity bground SYSTEM "bground.sgml">
59 # <graphic fileref="file.jpg">
61 # This only finds one per line, and assumes that anything
62 # defined as a SYSTEM entity is, in fact, a file included
63 # somewhere in the document.
67 if (/<!entity\s+(?:%\s+)?(?:\S+)\s+SYSTEM\s+"([^"]*)">/i) {
69 } elsif (/<graphic[^>]*\sfileref="([^"]*)"/) {
70 push(@includes, "design/$1");
72 } while (<scan::quickscan::SCAN>);
77 # We have to tell Cons to QuickScan the top-level SGML files which
78 # get included by the document SGML files in the subdirectories.
85 foreach $sgml (@included_sgml) {
86 $env->QuickScan(\&scansgml, $sgml);
90 # For each document, build the document itself in HTML, Postscript,
93 foreach $doc (keys %doc_dirs) {
94 my $main = "$doc/main.sgml";
97 my $htmldir = "HTML/scons-$doc";
98 my $html = "$htmldir/" . $doc_dirs{$doc}->{'html'};
99 my $ps = "PS/scons-$doc.ps";
100 my $pdf = "PDF/scons-$doc.pdf";
101 my $text = "TEXT/scons-$doc.txt";
103 $env->QuickScan(\&scansgml, $main);
105 $env->Command($html, $main,
107 jw -b html -o %>:d %<
108 mv -v %>:d/index.html %> || true
111 $env->Command($ps, $main,
118 $env->Command($pdf, $main,
125 if ($doc_dirs{$doc}->{'text'} && $lynx) {
126 $env->Command($text, $html, qq(lynx -dump %<:a > %>));
129 push(@tar_deps, $html, $ps, $pdf);
130 push(@tar_list, $htmldir, $ps, $pdf);
134 # Now actually create the tar file of the documentation,
135 # for easy distribution to the web site.
137 $env->Command($doc_tar_gz,
139 qq(tar zchv -f %> -C build/doc @tar_list));