Anonymous avatar Anonymous committed 2598c20

For the web site, build a .tar.gz of the documentation.

Comments (0)

Files changed (1)

 #
-#
+# Conscript file for building SCons documentation.
 #
 
 Import qw(
 );
 
 #
+#
+#
+$doc_tar_gz = "#build/dist/scons-doc-$version.tar.gz";
+
+#
+# Always create a version.sgml file containing the version information
+# for this run.  Ignore it for dependency purposes so we don't
+# rebuild all the docs every time just because the date changes.
+#
 $verfile = SourcePath("version.sgml");
+unlink($verfile);
 open(FILE, ">$verfile") || die "Cannot open '$verfile': $!";
 print FILE <<_EOF_;
 <!--
 _EOF_
 close(FILE);
 
-Ignore("#$verfile");
+Ignore("version.sgml");
 
 #
+# Each document will live in its own subdirectory.  List them here.
 #
-#
-
 @doc_dirs = qw(
     design
 );
     @includes;
 }
 
-$env->QuickScan(\&scansgml, "scons.mod");
-$env->QuickScan(\&scansgml, "copyright.sgml");
+#
+# We have to tell Cons to QuickScan the top-level SGML files which
+# get included by the document SGML files in the subdirectories.
+#
+@included_sgml = qw(
+    scons.mod
+    copyright.sgml
+);
 
+foreach $sgml (@included_sgml) {
+    $env->QuickScan(\&scansgml, $sgml);
+}
+
+#
+# For each document, build the document itself in HTML, Postscript,
+# and PDF formats.
+#
 foreach $doc (@doc_dirs) {
     my $main = "$doc/main.sgml";
     my $out = "main.out";
 
+    my $htmldir = "HTML/scons-$doc";
+    my $ps = "PS/scons-$doc.ps";
+    my $pdf = "PDF/scons-$doc.pdf";
+
     $env->QuickScan(\&scansgml, $main);
 
-    $env->Command("HTML/$doc/book1.html", $main,
+    $env->Command("$htmldir/book1.html", $main,
 	qq(jw -b html -o %>:d %<));
 
-    $env->Command("PS/$doc.ps", $main,
-	[qq(jw -b ps -o %>:d %<),
+    $env->Command($ps, $main,
+	[qq(rm -f %>:d/$out),
+	 qq(jw -b ps -o %>:d %<),
 	 qq(mv %>:d/main.ps %>),
+	 qq(rm -f %>:d/$out),
 	]);
 
-    $env->Command("PDF/$doc.pdf", $main,
-	[qq(jw -b pdf -o %>:d %<),
+    $env->Command($pdf, $main,
+	[qq(rm -f %>:d/$out),
+	 qq(jw -b pdf -o %>:d %<),
 	 qq(mv %>:d/main.pdf %>),
-#	 qq(rm -f %>:d/$out),
+	 qq(rm -f %>:d/$out),
 	]);
+
+    push(@tar_deps, "$htmldir/book1.html", $ps, $pdf);
+    push(@tar_list, "$htmldir/[A-Za-z]*", $ps, $pdf);
 }
+
+#
+# Now actually create the tar file of the documentation,
+# for easy distribution to the web site.
+#
+$env->Command($doc_tar_gz,
+	      @tar_deps,
+	      qq(cd build/doc && tar zcvf ../dist/%>:f @tar_list));
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.