summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-01-05 19:27:18 +0000
committerKarl Berry <karl@freefriends.org>2014-01-05 19:27:18 +0000
commit59faa311e97dff9839ad116dc99ad620037462ff (patch)
treee0b303ace9ed0b384e9c608071e78de577f0da9a
parentf237cb1d9d8f85e5dc202b83a2a2c90d3b47952d (diff)
mptopdf (for year in man page)
git-svn-id: svn://tug.org/texlive/trunk@32580 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/texlive/linked_scripts/mptopdf/perl/mptopdf.pl160
-rw-r--r--Master/texmf-dist/doc/context/scripts/mkii/mptopdf.man2
-rw-r--r--Master/texmf-dist/doc/man/man1/mptopdf.12
-rw-r--r--Master/texmf-dist/doc/man/man1/mptopdf.man1.pdfbin6294 -> 3696 bytes
-rwxr-xr-xMaster/texmf-dist/scripts/context/stubs/mswin/mptopdf.exebin6144 -> 4608 bytes
-rwxr-xr-xMaster/tlpkg/bin/ctan2tl9
-rwxr-xr-xMaster/tlpkg/libexec/ctan2tds2
7 files changed, 171 insertions, 4 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/mptopdf/perl/mptopdf.pl b/Build/source/texk/texlive/linked_scripts/mptopdf/perl/mptopdf.pl
new file mode 100644
index 00000000000..42db9001ec4
--- /dev/null
+++ b/Build/source/texk/texlive/linked_scripts/mptopdf/perl/mptopdf.pl
@@ -0,0 +1,160 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# MikTeX users can set environment variable TEXSYSTEM to "miktex".
+
+#D \module
+#D [ file=mptopdf.pl,
+#D version=2010.05.28, % 2000.05.29
+#D title=converting MP to PDF,
+#D subtitle=\MPTOPDF,
+#D author=Hans Hagen,
+#D date=\currentdate,
+#D url=www.pragma-ade.nl,
+#D copyright={PRAGMA ADE / Hans Hagen \& Ton Otten}]
+#C
+#C This module is part of the \CONTEXT\ macro||package and is
+#C therefore copyrighted by \PRAGMA. See licen-en.pdf for
+#C details.
+
+# use File::Copy ; # not in every perl
+
+use Config ;
+use Getopt::Long ;
+use strict ;
+use File::Basename ;
+
+$Getopt::Long::passthrough = 1 ; # no error message
+$Getopt::Long::autoabbrev = 1 ; # partial switch accepted
+
+my $Help = 0 ;
+my $Latex = 0 ;
+my $TeXexec = 0 ;
+my $RawMP = 1 ;
+my $MetaFun = 0 ;
+my $PassOn = '' ;
+
+&GetOptions
+ ( "help" => \$Help ,
+ "rawmp" => \$RawMP, # option is now default, but keep for compat
+ "metafun" => \$MetaFun,
+ "passon" => \$PassOn, # option is ignored, but keep for compat
+ "latex" => \$Latex,
+ "texexec" => \$TeXexec) ;
+
+my $program = "MPtoPDF 1.4.1" ;
+my $pattern = "@ARGV" ; # was $ARGV[0]
+my $miktex = 0 ;
+my $done = 0 ;
+my $report = '' ;
+my $mplatexswitch = " --tex=latex " ;
+my $texexecswitch = " --tex=\"texexec --batch --once --nomp --mptex\" " ; # untested
+
+my $dosish = ($Config{'osname'} =~ /^(ms)?dos|^os\/2|^mswin/i) ;
+my $escapeshell = (($ENV{'SHELL'}) && ($ENV{'SHELL'} =~ m/sh/i ));
+
+if ($ENV{"TEXSYSTEM"}) {
+ $miktex = ($ENV{"TEXSYSTEM"} =~ /miktex/io) ;
+}
+
+my @files ;
+my $command = my $mpbin = '' ;
+
+# agressive copy, works for open files like in gs
+
+sub CopyFile {
+ my ($From,$To) = @_ ;
+ return unless open(INP,"<$From") ;
+ return unless open(OUT,">$To") ;
+ binmode INP ;
+ binmode OUT ;
+ while (<INP>) {
+ print OUT $_ ;
+ }
+ close (INP) ;
+ close (OUT) ;
+}
+
+if (($pattern eq '')||($Help)) {
+ print "\n$program : provide MP output file (or pattern)\n" ;
+ exit ;
+} elsif ($pattern =~ /\.mp$/io) {
+ shift @ARGV ; my $rest = join(" ", @ARGV) ;
+ if (open(INP,$pattern)) {
+ while (<INP>) {
+ if (/(documentstyle|documentclass|begin\{document\})/io) {
+ $Latex = 1 ; last ;
+ }
+ }
+ close (INP) ;
+ }
+ if ($Latex) {
+ $rest .= " $mplatexswitch" ;
+ }
+ if ($TeXexec) {
+ $rest .= " $texexecswitch" ;
+ }
+ if ($MetaFun) {
+ $mpbin = "mpost --progname=mpost --mem=metafun" ;
+ } else {
+ $mpbin = "mpost --mem=mpost" ;
+ }
+ my $runner = "$mpbin $rest $pattern" ;
+ print "\n$program : running '$runner'\n" ;
+ my $error = system ($runner) ;
+ if ($error) {
+ print "\n$program : error while processing mp file\n" ;
+ exit 1 ;
+ } else {
+ $pattern =~ s/\.mp$//io ;
+ @files = glob "$pattern.*" ;
+ }
+} elsif (-e $pattern) {
+ @files = ($pattern) ;
+} elsif ($pattern =~ /.\../o) {
+ @files = glob "$pattern" ;
+} else {
+ $pattern .= '.*' ;
+ @files = glob "$pattern" ;
+}
+
+foreach my $file (@files) {
+ $_ = $file ;
+ if (s/\.(\d+|mps)$// && -e $file) {
+ if ($miktex) {
+ $command = "pdftex -undump=mptopdf" ;
+ } else {
+ $command = "pdftex -fmt=mptopdf -progname=context" ;
+ }
+ if ($dosish) {
+ $command = "$command \\relax $file" ;
+ } else {
+ $command = "$command \\\\relax $file" ;
+ }
+ my $error = system($command) ;
+ if ($error) {
+ print "\n$program : error while processing tex file\n" ;
+ exit 1 ;
+ }
+ my $pdfsrc = basename($_).".pdf";
+ rename ($pdfsrc, "$_-$1.pdf") ;
+ if (-e $pdfsrc) {
+ CopyFile ($pdfsrc, "$_-$1.pdf") ;
+ }
+ if ($done) {
+ $report .= " +" ;
+ }
+ $report .= " $_-$1.pdf" ;
+ ++$done ;
+ }
+}
+
+if ($report eq '') {
+ $report = '*' ;
+}
+
+if ($done) {
+ print "\n$program : $pattern is converted to$report\n" ;
+} else {
+ print "\n$program : no filename matches $pattern\n" ;
+}
diff --git a/Master/texmf-dist/doc/context/scripts/mkii/mptopdf.man b/Master/texmf-dist/doc/context/scripts/mkii/mptopdf.man
index 06feece6693..87cb566ebe9 100644
--- a/Master/texmf-dist/doc/context/scripts/mkii/mptopdf.man
+++ b/Master/texmf-dist/doc/context/scripts/mkii/mptopdf.man
@@ -1,4 +1,4 @@
-.TH "mptopdf" "1" "01-01-2013" "version 1.4.1" "convert MetaPost to PDF"
+.TH "mptopdf" "1" "01-01-2014" "version 1.4.1" "convert MetaPost to PDF"
.SH NAME
.B mptopdf
.SH SYNOPSIS
diff --git a/Master/texmf-dist/doc/man/man1/mptopdf.1 b/Master/texmf-dist/doc/man/man1/mptopdf.1
index 06feece6693..87cb566ebe9 100644
--- a/Master/texmf-dist/doc/man/man1/mptopdf.1
+++ b/Master/texmf-dist/doc/man/man1/mptopdf.1
@@ -1,4 +1,4 @@
-.TH "mptopdf" "1" "01-01-2013" "version 1.4.1" "convert MetaPost to PDF"
+.TH "mptopdf" "1" "01-01-2014" "version 1.4.1" "convert MetaPost to PDF"
.SH NAME
.B mptopdf
.SH SYNOPSIS
diff --git a/Master/texmf-dist/doc/man/man1/mptopdf.man1.pdf b/Master/texmf-dist/doc/man/man1/mptopdf.man1.pdf
index 81e95d69381..b7c7fd90fa1 100644
--- a/Master/texmf-dist/doc/man/man1/mptopdf.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/mptopdf.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/scripts/context/stubs/mswin/mptopdf.exe b/Master/texmf-dist/scripts/context/stubs/mswin/mptopdf.exe
index 2d45f27494d..faae5caa7c4 100755
--- a/Master/texmf-dist/scripts/context/stubs/mswin/mptopdf.exe
+++ b/Master/texmf-dist/scripts/context/stubs/mswin/mptopdf.exe
Binary files differ
diff --git a/Master/tlpkg/bin/ctan2tl b/Master/tlpkg/bin/ctan2tl
index 7eceea51f1d..7f857c1fe02 100755
--- a/Master/tlpkg/bin/ctan2tl
+++ b/Master/tlpkg/bin/ctan2tl
@@ -127,8 +127,15 @@ ctan2tds --ctan-dir=$ctan_dir $pkg || exit 1
cd $cooked || exit 1
printf "\n\f cooked\n"
-find $pkg -name TDS_READY -exec rm '{}' \; # remove sentinel file
+find $pkg -name TDS_READY -exec rm '{}' \; # remove sentinel file
find -depth -type d | xargs rmdir 2>/dev/null # remove empty directories
+
+if test -n "`find -name \*\ \*`"; then
+ echo "$0: cooked hierarchy contains files with spaces, goodbye." >&2
+ exit 1
+fi
+
+# show list of files (and tee to tmp).
find $pkg \! -type d -printf "%TY%Tm%Td.%TH%TM %p\n" | sort -k2 \
| tee ${TMPDIR-/tmp}/ctan2tl.files
diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds
index 91a5d02f322..987fe79ed63 100755
--- a/Master/tlpkg/libexec/ctan2tds
+++ b/Master/tlpkg/libexec/ctan2tds
@@ -681,7 +681,7 @@ chomp ($Build = `cd $Master/../Build/source && pwd`);
'mp3d', "&MAKEflatten",
'mpcolornames',"&MAKEcopy",
'mpdinbrief', "die 'skipping, nosell license'",
- 'mptopdf', "die 'skipping, not quite perfect yet'", #"&MAKEcopy",
+ 'mptopdf', "&MAKEcopy", #&"die 'skipping, not quite perfect yet'", #
'msuthesis', "die 'skipping, use msu-thesis'",
'mtp2lite', "die 'skipping, nonfree'",
'mtx', "die 'skipping, pascal musixtex binaries'",