zip the unpacked directory below distrib
[latex2e.git] / Construct
blobdeba611025d42f33c9f21ff85c3b53dba215ea90
1 # Construct file for LaTeX2e
3 # Where to put the distribution files
4 $DISTRIB = 'distrib';
5 $BUILD = 'build';
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;
15 $LDOCS = [ qw(
16        cfgguide
17        clsguide
18        cyrguide
19        encguide
20        fntguide
21        ltnews01
22        ltnews02
23        ltnews03
24        ltnews04
25        ltnews05
26        ltnews06
27        ltnews07
28        ltnews08
29        ltnews09
30        ltnews10
31        ltnews11
32        ltnews12
33        ltnews13
34        ltnews14
35        ltnews15
36        ltnews16
37        ltnews17
38        ltnews18
39        ltnews19
40        ltnews20
41        ltx3info
42        modguide
43        usrguide
44 )];
47 @toolspdffiles = map { my $x=$_; $x =~ s/\.dtx$/.pdf/; $x; } <required/tools/*.dtx>;
48 @babelpdffiles = ();
49 @cyrillicpdffiles = ();
50 @graphicspdffiles = qw(required/graphics/grfguide.pdf);
52 @docfiles = (
53         @toolspdffiles,
54         @babelpdffiles,
55         @cyrillicpdffiles,
56         @graphicspdffiles,
57         map { "doc/$_.pdf" } @$LDOCS,
61 Export qw ( CONS DISTRIB BUILD FORMAT FORMATPDF LDOCS);
63 # A standard construction environment.
64 $CONS = new cons(
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
75         ));
76     }
79 Conscript_chdir 1;
81 Default 'help';
83 $HELPMESSAGE = <<__EOH__;
85 Available targets:
87   help         This message
89  General targets:
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.
94   
95   latex2e-distrib.zip
96                Generate zip file for distribution.
98  Specific targets:
100    testfiles/XXXX.tmp.tlg
101                Run test file XXXX. Both XXXX.lvt and XXXX.tlg must be present.
103    build/XXXX.tlg
104                Generate XXXX.tlg anew. Works only if you do not have
105                    testfiles/XXXX.tlg, so you better remove the latter first.
107 __EOH__
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) {
118     my $t = $_;
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 )
143 # Format creation
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 )
152 #build documentation
153 Build (
154       "doc/Conscript",
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 \\*~
162 # Test suite
163 Build ( "testfiles/Conscript" );
164 Build qw(
165       required/tools/Conscript
166       required/cyrillic/Conscript
167       required/graphics/Conscript