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"
81 ,"standchen-16", "standchen-20", "toccata-fuga-E", "scsii-menuetto",
82 "cadenza", "scales", "rhythm", "gallina");
89 print "generating HTML\n";
90 my_system "$MAKE -kC .. html";
95 print "generating examples: \n";
97 foreach $a (@examples) {
98 push @todo, "out/$a.ps.gz", "out/$a.gif", "out/$a.ly.txt";
101 my_system ("$MAKE -C .. " . join(' ', @todo));
104 my @texstuff = ("mudela-man", "mudela-course");
108 print "generating TeX doco list\n";
109 open HTMLLIST, ">tex_manuals.html";
110 print HTMLLIST "<HTML><TITLE>PostScript Manuals</TITLE>\n" ;
111 print HTMLLIST "<BODY><h1>LilyPond manuals (in PostScript)</h1>";
112 print HTMLLIST "<ul>\n";
114 foreach $a (@texstuff) {
115 push @todo , "out/$a.ps.gz";
116 print HTMLLIST "<li><a href=$a.ps.gz>$a.ps.gz</a>";
118 print HTMLLIST "</ul>";
120 print HTMLLIST "</BODY></HTML>";
123 my_system( "$MAKE -C .. " . join(' ', @todo));
128 print "generating HTML list\n";
129 open HTMLLIST, ">example_output.html";
130 print HTMLLIST "<html><body><TITLE>Rendered Examples</TITLE>\n
131 These example files are taken from the LilyPond distribution.\n
132 LilyPond currently only outputs TeX and MIDI. The pictures and\n
133 PostScript files were generated using TeX, Ghostscript and some graphics tools. \n
134 The GIF files have been scaled to eliminate aliasing.";
135 foreach $a (@examples) {
137 print HTMLLIST "<h1>example file: $name</h1>\n<XMP>\n";
139 open IF, "$depth/input/$a.ly";
140 input_record_separator IF "%}";
145 print HTMLLIST "$desc\n</XMP>";
154 print HTMLLIST "<ul>";
156 print HTMLLIST "<li><a href=$inputf> The input file</a>"
159 print HTMLLIST "<li><a href=$giff>The output (picture)</a>"
162 print HTMLLIST "<li><a href=$psf>The output (PS)</a>\n"
165 print HTMLLIST "<li><a href=$midif>The output (MIDI)</a>\n"
167 print HTMLLIST "</ul>";
169 print HTMLLIST "</BODY></HTML>";
175 print STDERR "adding footer\n";
178 foreach $a (<*.html>) {
181 input_record_separator H $sep;
194 my $subst = $footstr;
195 $subst .= $back if (! $a =~ /index.html/ );
196 $file =~ s/$sep/$subst$sep/g ;
197 $file =~ s/\.gif/\.$image/g;
198 $file =~ s!<TITLE>(.*)</TITLE>!<TITLE>LilyPond WWW: $1</TITLE>!g;
212 if (! $f =~ /.txt$/) {
220 print "copying files\n";
221 my_system "ln -s $depth/out ./docxx" if ( ! -x "docxx" ) ;
222 my_system "cp $depth/TODO ./TODO.txt",
223 "cp $depth/ANNOUNCE ./ANNOUNCE.txt",
224 "cp $depth/NEWS ./NEWS.txt",
225 "cp $depth/DEDICATION ./DEDICATION.txt";
226 my_system "make -C .. gifs";
234 my_system "gif2png -d $a";
239 my_system "cjpeg -o $b $a";
246 open BANNER, ">/tmp/lilybanner.html";
248 $ban =~ s!index.html!../index.html!g;
251 my_system "$MAKE -C $depth docxx-opts=\"-p -S -k -B /tmp/lilybanner.html\" doc++";
252 # should add a cute header.
258 $files = join (' ', < *.html *.$image *.ps.gz *.txt *.midi docxx/*>);
260 "-$TAR zvhcf website.tar.gz $files;",
261 # "gzip -f9 website.tar;";
266 print STDERR "This is " . $id_str . "\n";
272 GetOptions("jpeg", "gif", "png", "noexamples");
275 $image = "png" if ($opt_png);
276 $image = "jpeg" if ($opt_jpeg);
281 die "need to be in directory Documentation\n" if ( ! ($cwd =~ /Documentation$/));
283 print "lily v. " . $lily_version . "\n";
290 $ENV{"TEXINPUTS"} .= ":$depth/input/:";
291 $ENV{"LILYINCLUDE"} = "$depth/input/";
296 if (! $opt_noexamples) {