2 # stupid script to generate WWW site. -*-Perl-*-
9 my $mw_id = "<!make_website!>";
10 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", "wtk1-fugue2",
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";
135 print HTMLLIST "<html><body><TITLE>Rendered Examples</TITLE>\n
136 These example files are taken from the LilyPond distribution.
137 LilyPond currently only outputs TeX and MIDI. The pictures and
138 PostScript files were generated using TeX, Ghostscript and some
139 graphics tools. The papersize used for these examples is A4. The GIF
140 files have been scaled to eliminate aliasing.";
144 foreach $a (@examples)
146 $name=$a; print HTMLLIST "<h1>example file: $name</h1>\n<XMP>\n";
148 open IF, "$depth/input/$a.ly";
149 input_record_separator IF "\n}";
154 print HTMLLIST "$desc\n</XMP>";
163 print HTMLLIST "<ul>";
165 print HTMLLIST "<li><a href=$inputf> The input file</a>"
168 print HTMLLIST "<li><a href=$giff>The output (picture)</a>"
171 print HTMLLIST "<li><a href=$psf>The output (PS)</a>\n"
174 print HTMLLIST "<li><a href=$midif>The output (MIDI)</a>\n"
176 print HTMLLIST "</ul>";
178 print HTMLLIST "</BODY></HTML>";
184 print STDERR "adding footer\n";
187 foreach $a (<*.html>) {
190 input_record_separator H $sep;
203 my $subst = $footstr;
204 $subst .= $back if (! $a =~ /index.html/ );
205 $file =~ s/$sep/$subst$sep/g ;
206 $file =~ s/\.gif/\.$image/g;
207 $file =~ s!<TITLE>(.*)</TITLE>!<TITLE>LilyPond WWW: $1</TITLE>!g;
221 if (! $f =~ /.txt$/) {
229 open NEWS, "NEWS.txt";
230 input_record_separator NEWS "****";
240 $ton = top_of_NEWS();
241 $ton = "\n<XMP>\n$ton\n</XMP>\n";
242 open INDEX, "index.html";
243 input_record_separator NEWS undef;
246 $index =~ s/top_of_NEWS/$ton/;
247 open INDEX, ">index.html";
255 print "copying files\n";
256 my_system "ln -s $depth/out ./docxx" if ( ! -x "docxx" ) ;
257 my_system "cp $depth/TODO ./TODO.txt",
258 "cp $depth/ANNOUNCE ./ANNOUNCE.txt",
259 "cp $depth/NEWS ./NEWS.txt",
260 "cp $depth/DEDICATION ./DEDICATION.txt";
261 my_system "make -C .. gifs";
269 my_system "gif2png -d $a";
274 my_system "cjpeg -o $b $a";
281 open BANNER, ">/tmp/lilybanner.html";
283 $ban =~ s!index.html!../index.html!g;
286 my_system "$MAKE -C $depth docxx-opts=\"-p -S -k -B /tmp/lilybanner.html\" doc++";
287 # should add a cute header.
293 $files = join (' ', < *.html *.$image *.ps.gz *.txt *.midi docxx/*>);
295 "-$TAR zvhcf website.tar.gz $files;",
296 # "gzip -f9 website.tar;";
301 print STDERR "This is " . $id_str . "\n";
307 GetOptions("jpeg", "gif", "png", "noexamples");
310 $image = "png" if ($opt_png);
311 $image = "jpeg" if ($opt_jpeg);
316 die "need to be in directory Documentation\n" if ( ! ($cwd =~ /Documentation$/));
318 print "lily v. " . $lily_version . "\n";
325 $ENV{"TEXINPUTS"} .= ":$depth/input/:";
326 $ENV{"LILYINCLUDE"} = "$depth/input/";
332 if (! $opt_noexamples) {