1 # Construct file for LaTeX2e
3 # Where to put the distribution files
7 $SCRIPTDIR = 'scripts';
9 $FORMAT = "#$BUILD/latex.fmt";
10 $FORMATPDF = "#$BUILD/pdflatex.fmt";
12 @basefiles = grep !/testfiles/,<base/*>;
13 @linkedfiles = map { my $x=$_; $x =~ s/^base/unpacked/; $x; } grep !/^Cons/,@basefiles;
47 @toolspdffiles = map { my $x=$_; $x =~ s/\.dtx$/.pdf/; $x; } <required/tools/*.dtx>;
49 @cyrillicpdffiles = ();
50 @graphicspdffiles = qw(required/graphics/grfguide.pdf);
57 map { "doc/$_.pdf" } @$LDOCS,
61 Export qw ( CONS DISTRIB BUILD FORMAT FORMATPDF LDOCS);
63 # A standard construction environment.
65 RUNTEX => "cd build ; ../$SCRIPTDIR/run-tex",
66 ENV => { PATH => $ENV{PATH} , HOME => $ENV{HOME} }
69 sub cons::CompileTeX {
70 my($cons, $dir, $nms, $ext, $dependencies) = @_;
71 $ext = "tex" unless defined $ext;
72 foreach my $tgt (@$nms) {
73 $cons->Command(["$dir/$tgt.pdf"], ($FORMATPDF,"#$BUILD/$tgt.$ext",@$dependencies),qq(
74 export TEXINPUTS=../%2:d:$ENV{TEXINPUTS} ; %RUNTEX %1:a %2:a && mv %>:f %>:a || echo NOT GOOD
83 $HELPMESSAGE = <<__EOH__;
91 unpacked Unpack the base files into the unpacked subdir
92 doc Build the documentation PDF files in doc subdir
93 testfiles Run the test suite.
96 Generate zip file for distribution.
100 testfiles/XXXX.tmp.tlg
101 Run test file XXXX. Both XXXX.lvt and XXXX.tlg must be present.
104 Generate XXXX.tlg anew. Works only if you do not have
105 testfiles/XXXX.tlg, so you better remove the latter first.
109 Command $CONS 'help', qq(
110 @[perl] print \$HELPMESSAGE;
113 # the following creates hard links, which do not work well with the
114 # distribution as zip and for CTAN.
115 #Install $CONS 'unpacked', @basefiles;
116 # Hence, do the symbolic link by hand
117 foreach (@basefiles) {
119 $t =~ s/base/unpacked/;
120 $CONS->Command($t,$_,qq(ln -s ../%< %>));
123 Install $CONS 'build', <support/*>;
125 @basedtxfiles = <base/*.dtx>;
126 @builddtxfiles = map { my $x=$_; $x =~ s/^base/build/; $x; } @basedtxfiles;
128 Install $CONS 'build', @basedtxfiles;
129 Install $CONS 'build', "base/source2e.tex";
131 CompileTeX $CONS "doc",["source2e"],"tex",\@builddtxfiles;
133 @supportfiles = <support/*>;
134 foreach (@supportfiles) { s/^support/build/; }
136 # unpack the distribution
137 # Make sure that no external input files are read by setting TEXINPUTS
138 Command $CONS ['unpacked/unpack.log','unpacked/latex.ltx'], @linkedfiles, qq(
139 echo Generating LaTeX2e kernel bootstrap files...
140 (export TEXINPUTS=. ; cd unpacked ; yes | etex -ini unpack.ins 2>/dev/null && touch unpack.log )
144 Command $CONS "$FORMAT", (@supportfiles,"unpacked/unpack.log",'unpacked/latex.ltx'), qq(
145 ( cd build ; yes | TEXINPUTS=.:../unpacked etex -ini -etex latex.ltx ; test -f %>:f )
147 Command $CONS ["$FORMATPDF"], (@supportfiles,"unpacked/unpack.log",'unpacked/latex.ltx'), qq(
148 ln -f -s latex.ltx build/pdflatex.ltx
149 (cd build ; yes | TEXINPUTS=.:../unpacked pdfetex -ini -jobname=pdflatex "*pdflatex.ini" latex.ltx ; test -f %>:f )
157 # zip to distribution files
158 Command $CONS ["latex2e-distrib.zip"], ("$FORMAT","#$BUILD/tools.log","#$BUILD/cyrlatex.log","unpacked/unpack.log",@docfiles,@requireddocs), qq(
159 zip -y -r latex2e-distrib.zip base unpacked doc required -x base/changes.old.txt -x unpacked/changes.old.txt -x unpacked/unpack.log -x Construct -x \\*/.consign -x \\*/Conscript -x \\*/.svn/ -x \\*/.svn/\\* -x \\*.aux -x \\*.dvi -x \\*.glo -x \\*.idx -x \\*.log -x \\*~
163 Build ( "testfiles/Conscript" );
165 required/tools/Conscript
166 required/cyrillic/Conscript
167 required/graphics/Conscript