summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/latex-tds/build.pl
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/latex-tds/build.pl')
-rwxr-xr-xMaster/texmf-dist/source/latex/latex-tds/build.pl115
1 files changed, 101 insertions, 14 deletions
diff --git a/Master/texmf-dist/source/latex/latex-tds/build.pl b/Master/texmf-dist/source/latex/latex-tds/build.pl
index d1ff6b4bae7..3f18b34a211 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.175';
-my $date = '2014-02-15';
+my $version = '1.178';
+my $date = '2013-02-26';
my $author = 'Heiko Oberdiek';
my $copyright = "Copyright 2006-2013 $author";
chomp(my $license = <<"END_LICENSE");
@@ -56,10 +56,10 @@ my @pkg_list = (
);
my $zip_comment = <<'END_ZIP_COMMENT';
-*************************************************
-* This file is part of project 'latex-tds', see *
-* CTAN:macros/latex/contrib/latex-tds/README *
-*************************************************
+***************************************************
+* This file is part of project 'latex-tds', see *
+* CTAN:macros/latex/contrib/latex-tds/README.html *
+***************************************************
END_ZIP_COMMENT
my $error = "!!! Error:";
@@ -89,9 +89,10 @@ my $file_ctan_distrib = "$cwd/$prj.zip";
my $file_ziptimetree = get_perl_script('ziptimetree');
my $file_adjust_checksum = get_perl_script('adjust_checksum');
+my $prg_asciidoc = 'asciidoc';
+my $prg_bibtex = 'bibtex';
my $prg_checksum = $file_adjust_checksum;
-my $prg_bibtex = "bibtex";
-my $prg_chmod = "chmod";
+my $prg_chmod = 'chmod';
my $prg_cp = 'cp -p';
my $prg_curl = 'curl';
my $prg_docstrip = 'tex -shell-escape';
@@ -105,7 +106,8 @@ my $prg_ls = "ls";
my $prg_makeindex = 'makeindex';
my $prg_mkdir = 'mkdir';
my $prg_mv = 'mv';
-my $prg_patch = "patch";
+my $prg_patch = 'patch';
+my $prg_lowriter = 'lowriter';
my $prg_lualatex = 'lualatex';
my $prg_lualatextds = "lualatex -fmt=$cwd/$dir_build/lualatex-tds";
my $prg_lualatextds2 = "lualatex -fmt=$cwd/$dir_build/lualatex-tds2";
@@ -119,6 +121,7 @@ my $prg_sed = "sed";
my $prg_sort = "sort";
my $prg_texhash = "texhash";
my $prg_unzip = 'unzip';
+my $prg_w3m = 'w3m';
my $prg_weave = 'weave';
my $prg_wget = 'wget';
my $prg_zip = 'zip';
@@ -632,10 +635,16 @@ section('Patches after source install');
chdir $cwd;
patch('base/encguide.tex');
- patch('base/lb2.err');
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).
+ # Therefore the percent character is inserted by sed.
+ run("$prg_sed -i -e '"
+ . 's/\\\\usepackage\[latin1]{inputenc}/%\\\\usepackage[latin1]{inputenc}/'
+ . "' $dir_build/base/lb2.err");
run("$prg_recode latin1..utf8 $dir_build/base/lb2.err");
}
@@ -1793,13 +1802,86 @@ if ($modules{'etex'}) {
if ($modules{'source'}) {
section('Module source');
- my $dir_dest = "$dir_build/source/texmf/source/latex/latex-tds";
+ my $dir_build_source = "$dir_build/source";
+ my $dir_dest = "$dir_build_source/texmf/source/latex/latex-tds";
+ my $dir_doc = "$dir_build_source/texmf/doc/latex/latex-tds";
my $dir_scripts = "$dir_build/source/texmf/scripts";
+ my $file_readme = 'README';
+ my $file_readme_html = 'README.html';
+ my $file_readme_pdf = 'README.pdf';
+ my $file_readme_notoc_html = "$dir_build_source/README-notoc.html";
+ my $file_readme_w3m_txt = "$dir_build_source/README-w3m.txt";
+
+ ensure_directory($dir_build_source);
+
+ # generate README.html
+ run("$prg_asciidoc --backend=xhtml11 README.asciidoc");
+
+ # generate README.pdf
+ run("$prg_asciidoc --out-file=$file_readme_notoc_html"
+ . " --backend=xhtml11"
+ . " -a disable-javascript"
+ . " -a toc!"
+ . " README.asciidoc"
+ );
+ run("$prg_lowriter --invisible --convert-to odt "
+ . "--outdir $dir_build_source $file_readme_notoc_html");
+ run("$prg_lowriter --invisible --convert-to pdf "
+ . "--outdir $dir_build_source $dir_build_source/README-notoc.odt");
+ run("$prg_cp -p $dir_build_source/README-notoc.pdf $file_readme_pdf");
+
+ # run("$prg_cp -p README.asciidoc $dir_build_source/README");
+ run("$prg_w3m -dump README.html>$file_readme_w3m_txt");
+ my @lines_pre;
+ my @lines_toc;
+ my @lines_post;
+ my $state = 'pre';
+ open(IN, '<', $file_readme_w3m_txt)
+ or die "$error Cannot open `$file_readme_w3m_txt'!\n";
+ while (<IN>) {
+ if (/^README for project/) {
+ push @lines_pre, '=' x (length($_) - 1) . "\n";
+ push @lines_pre, $_;
+ push @lines_pre, '=' x (length($_) - 1) . "\n";
+ next;
+ }
+ if (/^Table of Contents/i) {
+ push @lines_pre, "\n";
+ push @lines_pre, "\n";
+ push @lines_pre, $_;
+ push @lines_pre, '=' x (length($_)-1) . "\n";
+ next;
+ }
+ if (/^(\d+)\.(\d+\.)? /) {
+ push @lines_post, "\n" unless $2;
+ 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;
+ push @lines_toc, "$prefix$_";
+ next;
+ }
+ if (/^JavaScript must be enabled/) {
+ $state = 'post';
+ next;
+ }
+ if ($state eq 'pre') {
+ push @lines_pre, $_;
+ }
+ else {
+ push @lines_post, $_;
+ }
+ }
+ close(IN);
+ open(OUT, '>', $file_readme) or die "$error Cannot write `$file_readme'!\n";
+ print OUT @lines_pre, @lines_toc, @lines_post;
+ close(OUT);
install $dir_dest, qw[
build.pl
- README
+ README.asciidoc
];
+
install "$dir_dest/tex", glob("$dir_tex/*.*");
install "$dir_dest/patch", glob("$dir_patch/*.*");
install "$dir_dest/lib", $file_ziptimetree;
@@ -1807,7 +1889,12 @@ if ($modules{'source'}) {
install "$dir_dest/license/latex-tds", "$dir_license/latex-tds/lppl.txt";
install "$dir_dest/license/adjust_checksum", "$dir_license/adjust_checksum/lppl.txt";
install "$dir_dest/license/ziptimetree", "$dir_license/ziptimetree/lgpl.txt";
- install $dir_distrib, 'README';
+ install $dir_distrib, $file_readme;
+ install $dir_distrib, $file_readme_html;
+ install $dir_distrib, $file_readme_pdf;
+ install $dir_doc, $file_readme;
+ install $dir_doc, $file_readme_html;
+ install $dir_doc, $file_readme_pdf;
}
### Module latex-tds
@@ -1856,7 +1943,7 @@ section('Distrib');
if ($opt_all) {
chdir $dir_distrib;
- my $cmd = "$prg_zip -0 $file_ctan_distrib README";
+ my $cmd = "$prg_zip -0 $file_ctan_distrib README README.html README.pdf";
for my $pkg (sort @pkg_list) {
$cmd .= " $pkg.tds.zip";
}