2 # stupid script to generate WWW site. -*-Perl-*-
8 my $mw_id = "<!make_website!>";
9 my $id_str = "make-website 0.4";
17 open V, "$depth/VERSION";
27 $lily_version= "$TOPLEVEL_MAJOR_VERSION.$TOPLEVEL_MINOR_VERSION.$TOPLEVEL_PATCH_LEVEL$TOPLEVEL_MY_PATCH_LEVEL";
30 $lily_version= "$TOPLEVEL_MAJOR_VERSION.$TOPLEVEL_MINOR_VERSION.$TOPLEVEL_PATCH_LEVEL$TOPLEVEL_MY_PATCH_LEVEL";
38 my $MAILADDRESS=$ENV{MAILADDRESS};
39 my @pw=(getpwuid($<));
43 "\n<hr>Please take me <a href=index.html>back to the LilyPond index</a>\n<hr>
45 This page was built using <code>" . $id_str . "</code> from lilypond-"
48 <address><br>$username <a href=mailto:"
49 . $MAILADDRESS . "><<!bla>" . $MAILADDRESS ."</a>></address>
54 # do something, check return status
58 foreach $cmd (@cmds) {
62 $cmd = substr ($cmd, 1);
65 my $ret = ( system ($cmd));
68 print STDERR "ignoring failed command \`$cmd\' (status $ret)\n";
70 print STDERR "\nmake_website: failed on command \`$cmd\' (status $ret)\n";
78 local $base="lilypond/";
80 local @examples=("twinkle-pop", "twinkle", "multi", "wohltemperirt",
83 "toccata-fuga-E", "scsii-menuetto",
93 print "generating HTML\n";
94 my_system "$MAKE -kC .. html";
99 print "generating examples: \n";
101 foreach $a (@examples) {
102 push @todo, "out/$a.ps.gz", "out/$a.gif", "out/$a.ly.txt";
105 my_system ("$MAKE -C .. " . join(' ', @todo));
108 my @texstuff = ("mudela-man", "mudela-course");
112 print "generating TeX doco list\n";
113 open HTMLLIST, ">tex_manuals.html";
114 print HTMLLIST "<HTML><TITLE>PostScript Manuals</TITLE>\n" ;
115 print HTMLLIST "<BODY><h1>LilyPond manuals (in PostScript)</h1>";
116 print HTMLLIST "<ul>\n";
118 foreach $a (@texstuff) {
119 push @todo , "out/$a.ps.gz";
120 print HTMLLIST "<li><a href=$a.ps.gz>$a.ps.gz</a>";
122 print HTMLLIST "</ul>";
124 print HTMLLIST "</BODY></HTML>";
127 my_system( "$MAKE -C .. " . join(' ', @todo));
132 print "generating HTML list\n";
133 open HTMLLIST, ">example_output.html";
134 print HTMLLIST "<html><body><TITLE>Rendered Examples</TITLE>\n
135 These example files are taken from the LilyPond distribution.\n
136 LilyPond currently only outputs TeX and MIDI. The pictures and\n
137 PostScript files were generated using TeX, Ghostscript and some graphics tools. \n
138 The GIF files have been scaled to eliminate aliasing.";
139 foreach $a (@examples) {
141 print HTMLLIST "<h1>example file: $name</h1>\n<XMP>\n";
143 open IF, "$depth/input/$a.ly";
144 input_record_separator IF "%}";
149 print HTMLLIST "$desc\n</XMP>";
158 print HTMLLIST "<ul>";
160 print HTMLLIST "<li><a href=$inputf> The input file</a>"
163 print HTMLLIST "<li><a href=$giff>The output (picture)</a>"
166 print HTMLLIST "<li><a href=$psf>The output (PS)</a>\n"
169 print HTMLLIST "<li><a href=$midif>The output (MIDI)</a>\n"
171 print HTMLLIST "</ul>";
173 print HTMLLIST "</BODY></HTML>";
179 print STDERR "adding footer\n";
182 foreach $a (<*.html>) {
185 input_record_separator H $sep;
198 my $subst = $footstr;
199 $subst .= $back if (! $a =~ /index.html/ );
200 $file =~ s/$sep/$subst$sep/g ;
201 $file =~ s/\.gif/\.$image/g;
202 $file =~ s!<TITLE>(.*)</TITLE>!<TITLE>LilyPond WWW: $1</TITLE>!g;
216 if (! $f =~ /.txt$/) {
224 print "copying files\n";
225 my_system "ln -s $depth/out ./docxx" if ( ! -x "docxx" ) ;
226 my_system "cp $depth/TODO ./TODO.txt",
227 "cp $depth/ANNOUNCE ./ANNOUNCE.txt",
228 "cp $depth/NEWS ./NEWS.txt",
229 "cp $depth/DEDICATION ./DEDICATION.txt";
230 my_system "make -C .. gifs";
238 my_system "gif2png -d $a";
243 my_system "cjpeg -o $b $a";
250 open BANNER, ">/tmp/lilybanner.html";
252 $ban =~ s!index.html!../index.html!g;
255 my_system "$MAKE -C $depth docxx-opts=\"-p -S -k -B /tmp/lilybanner.html\" doc++";
256 # should add a cute header.
262 $files = join (' ', < *.html *.$image *.ps.gz *.txt *.midi docxx/*>);
264 "-$TAR zvhcf website.tar.gz $files;",
265 # "gzip -f9 website.tar;";
270 print STDERR "This is " . $id_str . "\n";
276 GetOptions("jpeg", "gif", "png", "noexamples");
279 $image = "png" if ($opt_png);
280 $image = "jpeg" if ($opt_jpeg);
285 die "need to be in directory Documentation\n" if ( ! ($cwd =~ /Documentation$/));
287 print "lily v. " . $lily_version . "\n";
294 $ENV{"TEXINPUTS"} .= ":$depth/input/:";
295 $ENV{"LILYINCLUDE"} = "$depth/input/";
300 if (! $opt_noexamples) {