diff options
author | Karl Berry <karl@freefriends.org> | 2014-05-09 22:39:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-05-09 22:39:48 +0000 |
commit | 610c45beb863b008027a871701c889fe40bed7fb (patch) | |
tree | 5b879b56850db183fd749a497edd1d91172edf69 /Master/texmf-dist/source/latex/latex-tds/build.pl | |
parent | 18fa80c232cf479ae713b01b17d48bdc1d653aac (diff) |
latex2e 2014/05/01 (via latex-tds)
git-svn-id: svn://tug.org/texlive/trunk@33946 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/latex-tds/build.pl')
-rwxr-xr-x | Master/texmf-dist/source/latex/latex-tds/build.pl | 313 |
1 files changed, 192 insertions, 121 deletions
diff --git a/Master/texmf-dist/source/latex/latex-tds/build.pl b/Master/texmf-dist/source/latex/latex-tds/build.pl index a654ba7e469..d1dbf8fe08e 100755 --- a/Master/texmf-dist/source/latex/latex-tds/build.pl +++ b/Master/texmf-dist/source/latex/latex-tds/build.pl @@ -4,8 +4,8 @@ $^W=1; my $prj = 'latex-tds'; my $file = 'build.pl'; -my $version = '1.182'; -my $date = '2014-02-03'; +my $version = '1.185'; +my $date = '2014-05-08'; my $author = 'Heiko Oberdiek'; my $copyright = "Copyright 2006-2014 $author"; chomp(my $license = <<"END_LICENSE"); @@ -67,12 +67,16 @@ my $dir_incoming = 'incoming'; my $dir_incoming_ctan = "$dir_incoming/ctan"; my $dir_incoming_ams = "$dir_incoming/ams"; my $dir_incoming_ltxprj = "$dir_incoming/ltxprj"; +my $dir_ltxpub = "latex2e-public"; +my $dir_incoming_ltxpub = "$dir_incoming/$dir_ltxpub"; my $dir_build = 'build'; my $dir_lib = 'lib'; my $dir_license = 'license'; my $dir_tex = 'tex'; my $dir_patch = 'patch'; my $dir_distrib = 'distrib'; +my $dir_build_distrib = "$dir_build/distrib"; +my $dir_build_distrib_data = "$dir_build_distrib/$prj"; my $dir_texmf = 'texmf'; chomp(my $cwd = `pwd`); @@ -125,13 +129,14 @@ my $prg_lualatextds = "lualatex -fmt=$cwd/$dir_build/lualatex-tds"; my $prg_lualatextds2 = "lualatex -fmt=$cwd/$dir_build/lualatex-tds2"; my $prg_pdflatex = 'pdflatex'; my $prg_pdflatextds = "pdflatex -fmt=$cwd/$dir_build/pdflatex-tds"; -my $prg_pdftex = "pdftex"; -my $prg_recode = "recode"; -my $prg_rm = "rm"; -my $prg_rsync = "rsync"; +my $prg_pdftex = 'pdftex'; +my $prg_recode = 'recode'; +my $prg_rm = 'rm'; +my $prg_rsync = 'rsync'; my $prg_sed = "sed"; -my $prg_sort = "sort"; -my $prg_texhash = "texhash"; +my $prg_sort = 'sort'; +my $prg_svn = 'svn'; +my $prg_texhash = 'texhash'; my $prg_unzip = 'unzip'; my $prg_w3m = 'w3m'; my $prg_weave = 'weave'; @@ -172,6 +177,8 @@ my $usage = <<"END_OF_USAGE"; Usage: build.pl [options] General options: --(no)download (check for newer files, disabled by default) + --(no)vcs (use version control files) + --(no)vcs-update (update version control files) --(no)postprocess (pdf files are postprocessed, enabled by default) --(no)cache (use cached pdf files, enabled by default) Module options: @@ -180,6 +187,8 @@ END_OF_USAGE map { $usage .= " --(no)$_\n"; } @pkg_list; my $opt_download = 0; +my $opt_vcs = 0; +my $opt_vcs_update = 0; my $opt_postprocess = 0; my $opt_cache = 1; my $opt_all = 0; @@ -195,6 +204,8 @@ GetOptions( map { $modules{$_} = 1; } @pkg_list; }, 'download!' => \$opt_download, + 'vcs!' => \$opt_vcs, + 'vcs-update!' => \$opt_vcs_update, 'postprocess!' => \$opt_postprocess, 'cache!' => \$opt_cache, ) or die $usage; @@ -210,12 +221,32 @@ sub cd ($) { chdir $dir or die "$error Cannot change to directory `$dir'!\n"; } +### Line end sanitizing + +sub lf ($) { + my $file = shift; + open(IN, '<', $file) or die "!!! Error: Cannot open `$file'!\n"; + my @lines = <IN>; + close(IN); + my $found = 0; + $found += s/\s+$/\n/ for @lines; + if ($found) { + open(OUT, '>', $file) or die "!!! Error: Cannot write `$file'!\n"; + print OUT @lines; + close(OUT); + print "--> lf($file): $found line(s) fixed.\n"; + } + else { + print "--> lf($file): nothing to do.\n"; + } +} + ### Format generation if (@list_modules > 0) { section('Format generation'); ensure_directory($dir_build); - + sub make_ini ($$) { my $prg = shift; my $fmt = shift; @@ -229,12 +260,12 @@ if (@list_modules > 0) { run("$prg_cp $fmt.fmt $fmt.log $dir_cache"); } } - - chdir $dir_build; + + cd $dir_build; make_ini($prg_pdflatex, 'pdflatex-tds'); make_ini($prg_lualatex, 'lualatex-tds'); make_ini($prg_lualatex, 'lualatex-tds2'); - chdir $cwd; + cd $cwd; } ### Download @@ -320,6 +351,24 @@ if (@list_modules > 0) { download_ctan_file('armtex.zip', 'language/armenian'); } +### VCS +{ + section('VCS'); + + if ($opt_vcs_update) { + if (-d "$dir_incoming_ltxpub/.svn") { + cd $dir_incoming_ltxpub; + run("$prg_svn update"); + } + else { + cd $dir_incoming; + run("$prg_svn checkout http://latex-project.org/svnroot/latex2e-public/ $dir_ltxpub"); + } + cd $cwd; + } +} + + ### Remove previous build section('Remove previous build'); { @@ -384,32 +433,59 @@ section('Unpacking'); run("$prg_unzip -j $zipfile -d$dir"); } + sub eols (@) { + for my $pat (@_) { + for my $file (glob "$dir_build/$pat") { + next if $file =~ /\.(?:pdf|zip)$/i; + lf $file; + } + } + } + ensure_directory($dir_build); - unpack_ctan('base'); + if ($modules{'base'}) { - # replace .err files - foreach my $name (qw[ - lb2 - lgc2 - manual - tlc2 - ]) { - my $file = "$dir_incoming_ltxprj/$name.err"; - my $dest = "$dir_build/base/$name.err"; - run("$prg_cp $file $dest"); + ensure_directory("$dir_build/base"); + if ($opt_vcs) { + run("$prg_cp -r $dir_incoming_ltxpub/base/* $dir_build/base/"); + run("$prg_cp $dir_incoming_ltxpub/doc/*.tex $dir_build/base/"); + } + else { + unpack_ctan('base'); + # replace .err files + foreach my $name (qw[ + lb2 + lgc2 + manual + tlc2 + ]) { + my $file = "$dir_incoming_ltxprj/$name.err"; + my $dest = "$dir_build/base/$name.err"; + run("$prg_cp $file $dest"); + } + run("$prg_rm -rf $dir_build/base/doc"); + unpacking('base', + "$dir_incoming_ctan/doc.zip", + "$dir_build/base"); + run("$prg_cp -p $dir_build/base/doc/*.tex $dir_build/base/"); } - run("$prg_rm -rf $dir_build/base/doc"); - unpacking('base', - "$dir_incoming_ctan/doc.zip", - "$dir_build/base"); - run("$prg_cp -p $dir_build/base/doc/*.tex $dir_build/base/"); unpacking('base', "$dir_incoming_ctan/armtex.zip", "$dir_build/base"); + eols("base/*") if $modules{'base'}; } - map { - unpack_ctan($_); + + map { + ensure_directory("$dir_build/$_"); + if ($opt_vcs and /cyrillic|graphics|tools/) { + run("$prg_cp -r $dir_incoming_ltxpub/required/$_/* $dir_build/$_/"); + } + else { + unpack_ctan($_); + } + eols("$_/*") if $modules{$_}; } @required_list; + if ($modules{'amslatex'}) { unpack_ams('amscls', "$dir_incoming_ctan/amscls.tds.zip"); unpack_ams('amsrefs', "$dir_incoming_ctan/amsrefs.tds.zip"); @@ -427,6 +503,7 @@ section('Unpacking'); # run("$prg_cp $dir_build/amslatex/ctan/amsrefs/amsrefs.dtx " # . "$dir_build/amslatex/texmf/source/latex/amsrefs/amsrefs.dtx"); } + if ($modules{'amsfonts'}) { ensure_directory("$dir_build/amsfonts"); unpacking('amsfonts', @@ -457,13 +534,13 @@ section('Patches'); ; # if ($modules{'psnfss'}) { - chdir "$dir_build/psnfss"; + cd "$dir_build/psnfss"; run("$prg_checksum psfonts.dtx"); - chdir $cwd; + cd $cwd; } if ($modules{'knuth'}) { - chdir "$dir_build/knuth"; + cd "$dir_build/knuth"; my @files = qw[ trip.fot tripin.log @@ -479,7 +556,7 @@ section('Patches'); trap.typ ]; run("$prg_chmod -x @files"); - chdir $cwd; + cd $cwd; } if ($modules{'amslatex'}) { @@ -496,18 +573,18 @@ section('Install source'); my $pkg = shift; my @list = @_; $modules{$pkg} or return 1; - chdir "$dir_build/$pkg"; + cd "$dir_build/$pkg"; install "texmf/source/$fmt/$pkg", @list; - chdir $cwd; + cd $cwd; } sub install_generic_source ($$@) { my $pkg = shift; my $dir = shift; my @list = @_; $modules{$pkg} or return 1; - chdir "$dir_build/$pkg"; + cd "$dir_build/$pkg"; install "texmf/source/$dir", @list; - chdir $cwd; + cd $cwd; } sub install_source ($@) { my $pkg = shift; @@ -617,7 +694,7 @@ section('Install source'); section('Patches after source install'); { if ($modules{'base'}) { - chdir "$dir_build/base"; + cd "$dir_build/base"; # ltdirchk.dtx must be patched to fool it in # not having texsys.cfg @@ -635,31 +712,14 @@ section('Patches after source install'); close(IN); } - # base: TDS:makeindex/base -> TDS:makeindex/latex - { - my $file_ins = 'docstrip.ins'; - my $file_org = 'docstrip.ins.org'; - rename $file_ins, $file_org; - open(IN, '<', $file_org) or die "$error Cannot open `$file_org'!\n"; - open(OUT, '>', $file_ins) or die "$error Cannot write `$file_ins'!\n"; - while (<IN>) { - s|makeindex/base|makeindex/latex|; - print OUT; - } - close(OUT); - close(IN); - } - - # fix CR/LF line endings of tlc2.err (2012-05-12) - run("$prg_zip -ll tlc2.zip tlc2.err"); - run("$prg_unzip -o tlc2.zip"); - - chdir $cwd; + cd $cwd; + lf("$dir_build/base/encguide.tex"); patch('base/encguide.tex'); patch('base/source2e.tex'); patch('base/tlc2.err'); patch('base/utf8ienc.dtx'); + # # lb2.err contains <CR><LF> line endings, a patch file # created by diff in Linux would create mixed line endings # causing trouble for subversion (Karl Berry). @@ -703,9 +763,9 @@ section('Docstrip'); my $pkg = shift; my $ins = shift; $modules{$pkg} or return 1; - chdir "$dir_build/$pkg"; + cd "$dir_build/$pkg"; run("$prg_docstrip $ins.ins"); - chdir $cwd; + cd $cwd; 1; } docstrip('base', 'unpack'); @@ -717,9 +777,9 @@ section('Docstrip'); ## patch for amsthm.sty, part 1/2 #if ($modules{'amslatex'}) { - # chdir "$dir_build/amslatex/amscls"; + # cd "$dir_build/amslatex/amscls"; # run("$prg_docstrip ams-c1.ins"); - # chdir $cwd; + # cd $cwd; #} } @@ -767,7 +827,7 @@ section('TDS cleanup'); section('Install tex doc'); { if ($modules{'base'}) { - chdir "$dir_build/base"; + cd "$dir_build/base"; install 'texmf/doc/latex/base', qw[ 00readme.txt autoload.txt @@ -793,40 +853,40 @@ section('Install tex doc'); install 'texmf/tex/latex/base', qw[ texsys.cfg ]; - chdir $cwd; + cd $cwd; } if ($modules{'tools'}) { - chdir "$dir_build/tools"; + cd "$dir_build/tools"; install 'texmf/doc/latex/tools', qw[ changes.txt manifest.txt readme.txt ]; - chdir $cwd; + cd $cwd; } if ($modules{'graphics'}) { - chdir "$dir_build/graphics"; + cd "$dir_build/graphics"; install('texmf/doc/latex/graphics', '*.txt' ); install('texmf/tex/latex/graphics', '*.def' ); - chdir $cwd; + cd $cwd; } if ($modules{'cyrillic'}) { - chdir "$dir_build/cyrillic"; + cd "$dir_build/cyrillic"; install('texmf/doc/latex/cyrillic', '*.txt' ); - chdir $cwd; + cd $cwd; } if ($modules{'psnfss'}) { - chdir "$dir_build/psnfss"; + cd "$dir_build/psnfss"; install('texmf/doc/latex/psnfss', '*.txt' ); @@ -839,11 +899,11 @@ section('Install tex doc'); install('texmf/fonts/map/dvips/psnfss', '*.map' ); - chdir $cwd; + cd $cwd; } if ($modules{'tds'}) { - chdir "$dir_build/tds"; + cd "$dir_build/tds"; install('texmf/doc/tds', qw[ README ChangeLog @@ -852,11 +912,11 @@ section('Install tex doc'); install('texmf/doc/info', qw[ tds.info ]); - chdir $cwd; + cd $cwd; } if ($modules{'knuth'}) { - chdir "$dir_build/knuth"; + cd "$dir_build/knuth"; install('texmf/doc/knuth/tex', qw[ texbook.tex ]); @@ -868,11 +928,11 @@ section('Install tex doc'); mf84.bug tex82.bug ]); - chdir $cwd; + cd $cwd; } if ($modules{'etex'}) { - chdir "$dir_build/etex"; + cd "$dir_build/etex"; my $doc_dir = 'texmf/doc/etex/base'; my $src_dir = 'texmf/source/etex/base'; ensure_directory($doc_dir); @@ -880,31 +940,23 @@ section('Install tex doc'); install($src_dir, qw[ etex_man.tex etex_man.sty ]); - chdir $cwd; + cd $cwd; } ## patch for amsthm.sty, part 2/2 #if ($modules{'amslatex'}) { - # chdir "$dir_build/amslatex/amscls"; + # cd "$dir_build/amslatex/amscls"; # my $dest_dir = '../texmf/tex/latex/amscls'; # ensure_directory($dest_dir); # install($dest_dir, 'amsthm.sty'); - # chdir $cwd; + # cd $cwd; #} } ### Preparation for documentation if ($modules{'base'}) { my $dir_src = "$dir_build/base/armtex"; - my $tds_mf = "$dir_texmf/fonts/source/public/armtex"; - my $tds_tfm = "$dir_texmf/fonts/tfm/public/armtex"; - my $tds_latex = "$dir_texmf/tex/latex/armtex"; - my @tds_mf = map {chomp;$_} glob "$dir_src/mf/*.mf"; - my @tds_tfm = map {chomp;$_} glob "$dir_src/tfm/*.tfm"; - my @tds_latex = map {chomp;$_} glob "$dir_src/latex/*.*"; - install($tds_mf, @tds_mf); - install($tds_tfm, @tds_tfm); - install($tds_latex, @tds_latex); + run("$prg_cp -r $dir_build/base/armtex/* $dir_texmf/"); run("$prg_texhash $dir_texmf"); } @@ -951,6 +1003,7 @@ if ($modules{'base'}) { cache 'base', $guide, sub { my $latextds = $prg_lualatextds; $latextds = $prg_lualatextds2 if $guide eq 'usrguide'; + $latextds = $prg_pdflatextds if $guide eq 'encguide'; run("$latextds -draftmode $guide"); run("$latextds -draftmode $guide"); final_begin; @@ -1011,7 +1064,7 @@ if ($modules{'base'}) { install_pdf('base', "$base"); 1; } - chdir "$dir_build/base"; + cd "$dir_build/base"; ## source2e cache 'base', 'source2e', sub { @@ -1165,19 +1218,20 @@ END_CODE } } - chdir $cwd; + cd $cwd; } ### Generate documentation for tools if ($modules{'tools'}) { section('Documentation: tools'); - chdir "$dir_build/tools"; + cd "$dir_build/tools"; my @list = glob("*.dtx"); map { s/\.dtx$//; } @list; foreach my $entry (@list) { my $latextds = $prg_lualatextds; - $latextds = $prg_pdflatextds if $entry eq 'bm'; + $latextds = $prg_pdflatextds if $entry eq 'bm' + or $entry eq 'multicol'; $latextds = $prg_lualatextds2 if $entry eq 'calc' or $entry eq 'rawfonts' or $entry eq 'showkeys'; @@ -1279,14 +1333,14 @@ END_FILE final_end; }; install_pdf('tools', 'tools'); - chdir $cwd; + cd $cwd; } ### Generate documentation for cyrillic if ($modules{'cyrillic'}) { section('Documentation: cyrillic'); - chdir "$dir_build/cyrillic"; + cd "$dir_build/cyrillic"; my @list = (glob("*.dtx"), glob("*.fdd")); foreach my $entry (@list) { my $base = $entry; @@ -1300,14 +1354,14 @@ if ($modules{'cyrillic'}) { }; install_pdf('cyrillic', $base); } - chdir $cwd; + cd $cwd; } ### Generate documentation for graphics if ($modules{'graphics'}) { section('Documentation: graphics'); - chdir "$dir_build/graphics"; + cd "$dir_build/graphics"; my @list = glob("*.dtx"); map { s/\.dtx$//; } @list; foreach my $entry (@list) { @@ -1336,7 +1390,7 @@ END_CODE final_end; }; install_pdf('graphics', 'grfguide'); - chdir $cwd; + cd $cwd; } sub makeindex ($) { @@ -1394,23 +1448,23 @@ if ($modules{'amslatex'}) { install_pdf($amspkg, $doc); } - chdir "$dir_build/amslatex/amsmath"; + cd "$dir_build/amslatex/amsmath"; symlink '../texmf', 'texmf'; map { generate_doc 'amsmath', $_; } qw[ amsldoc subeqn technote testmath amsbsy amscd amsgen amsmath amsopn amstext amsxtra ]; - chdir $cwd; + cd $cwd; - chdir "$dir_build/amslatex/amscls"; + cd "$dir_build/amslatex/amscls"; symlink '../texmf', 'texmf'; map { generate_doc 'amscls', $_; } qw[ amsthdoc instr-l thmtest amsclass amsdtx amsmidx upref ]; - chdir $cwd; + cd $cwd; - chdir "$dir_build/amslatex/amsrefs"; + cd "$dir_build/amslatex/amsrefs"; symlink '../texmf', 'texmf'; map { generate_doc 'amsrefs', $_; } qw[ amsrdoc changes @@ -1418,7 +1472,7 @@ if ($modules{'amslatex'}) { ]; # 2013-02-13: Excluded as test files: # cite-xa cite-xb cite-xh cite-xs - chdir $cwd; + cd $cwd; } if ($modules{'amsfonts'}) { @@ -1449,7 +1503,7 @@ if ($modules{'amsfonts'}) { install_gen_pdf('fonts', $amspkg, $doc); } - chdir "$dir_build/amsfonts"; + cd "$dir_build/amsfonts"; map {generate_doc2 'amsfonts', $_; } qw[ amsfonts amssymb cmmib57 eufrak euscript ]; @@ -1464,14 +1518,14 @@ if ($modules{'amsfonts'}) { }; } install_gen_pdf('fonts', 'amsfonts', 'amsfndoc'); - chdir $cwd; + cd $cwd; } ### Generate documentation for psnfss if ($modules{'psnfss'}) { section('Documentation: psnfss'); - chdir "$dir_build/psnfss"; + cd "$dir_build/psnfss"; cache 'psnfss', 'psfonts', sub { run("$prg_pdflatextds -draftmode psfonts.dtx"); @@ -1490,14 +1544,14 @@ if ($modules{'psnfss'}) { }; install_pdf('psnfss', 'psnfss2e'); - chdir $cwd; + cd $cwd; } ### Generate documentation for tds if ($modules{'tds'}) { section('Documentation: tds'); - chdir "$dir_build/tds"; + cd "$dir_build/tds"; my $file_tds = 'tds.tex'; my $file_tds_new = 'tds.new'; @@ -1530,14 +1584,14 @@ END_TEXT }; install_gen_pdf('', 'tds', 'tds'); - chdir $cwd; + cd $cwd; } ### Generate documentation for knuth if ($modules{'knuth'}) { section('Documentation: knuth'); - chdir "$dir_build/knuth"; + cd "$dir_build/knuth"; my $knuth_drv = "$cwd/$dir_tex/knuth.drv"; @@ -1676,14 +1730,14 @@ if ($modules{'knuth'}) { }; install_gen_pdf('knuth', 'errata', 'errata'); - chdir $cwd; + cd $cwd; } ### Generate documentation for etex if ($modules{'etex'}) { section('Documentation: etex'); - chdir "$dir_build/etex"; + cd "$dir_build/etex"; my $entry = 'etex_man'; my $etex_man_drv = "$cwd/$dir_tex/$entry.drv"; @@ -1697,7 +1751,7 @@ if ($modules{'etex'}) { }; install_gen_pdf('etex', 'base', $entry); - chdir $cwd; + cd $cwd; } ### Module source @@ -1718,6 +1772,7 @@ if ($modules{'source'}) { # generate README.html run("$prg_asciidoc --backend=xhtml11 README.asciidoc"); + lf("README.html"); # generate README.pdf # run("$prg_asciidoc --out-file=$file_readme_notoc_html" @@ -1760,7 +1815,7 @@ if ($modules{'source'}) { push @lines_post, $_; push @lines_post, ($2 ? '-' : '=') x length($_) . "\n"; my $prefix = ' ' x (3 * ($2 ? 2 : 1)); - s/^(\d+)\.(\d+\.)? /($1<10 ? ' ' : '') . "$1.$2 "/e; + s/^(\d+)\.((?:\d+\.)?) /($1<10 ? ' ' : '') . "$1.$2 "/e; push @lines_toc, "$prefix$_"; next; } @@ -1846,13 +1901,29 @@ section('Distrib'); } if ($opt_all) { - chdir $dir_distrib; - my $cmd = "$prg_zip -0 $file_ctan_distrib README README.html README.pdf"; - for my $pkg (sort @pkg_list) { - $cmd .= " $pkg.tds.zip"; + ensure_directory($dir_build_distrib); + my @files = map {"$cwd/$_"} qw[ + README + README.html + README.pdf + ], + map {"$dir_distrib/$_.tds.zip"} sort @pkg_list; + run("$prg_rm -rf $dir_build_distrib_data") if -d $dir_build_distrib_data; + ensure_directory($dir_build_distrib_data); + cd $dir_build_distrib_data; + my @list; + foreach my $file (@files) { + $file =~ m|/([^/]+)$| or die "!!! Error: Cannot extract file name (`$file')!\n"; + my $file_new = $1; + -f $file or die "!!! Error: File `$file' not found!\n"; + link $file, $file_new or die "!!! Error: Cannot link `$file' => `$file_new': $!\n"; + push @list, "$prj/$file_new"; } + cd $cwd; + cd $dir_build_distrib; + my $cmd = "$prg_zip -0 $file_ctan_distrib $prj @list"; run($cmd); - chdir $cwd; + cd $cwd; } } |