diff options
author | Karl Berry <karl@freefriends.org> | 2017-01-08 00:10:22 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-01-08 00:10:22 +0000 |
commit | 777ba017d4f0fafa14a9d50df108bffc42f082cb (patch) | |
tree | 5658763a7c8464234ec83d9f5d0ce46fea461a48 /Build/source | |
parent | 734a944ad1d694094e6cac8d4ce2c1f2c8adfb71 (diff) |
epstopdf 2.26: (errorUsage): prepend program name.
allow infile outfile.pdf command line.
allow -o and --output as synonyms for --outfile.
Suggestion from Ryo Furue, original patch from Norbert Preining:
http://tug.org/pipermail/tex-k/2017-January/002735.html
git-svn-id: svn://tug.org/texlive/trunk@42895 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r-- | Build/source/extra/epstopdf/Makefile | 51 | ||||
-rw-r--r-- | Build/source/extra/epstopdf/README | 9 | ||||
-rw-r--r-- | Build/source/extra/epstopdf/epstopdf.1 | 10 | ||||
-rwxr-xr-x | Build/source/extra/epstopdf/epstopdf.pl | 49 |
4 files changed, 86 insertions, 33 deletions
diff --git a/Build/source/extra/epstopdf/Makefile b/Build/source/extra/epstopdf/Makefile index 04f106f913c..c909dccc98b 100644 --- a/Build/source/extra/epstopdf/Makefile +++ b/Build/source/extra/epstopdf/Makefile @@ -6,20 +6,22 @@ e2p = ./$(prg).pl #--debug re2p = ./r$(prg) --restricted re2p_script = ./r$(prg) -default: +default: check + +$(re2p_script): + ln -s $(prg).pl $@ # These are not comprehensive tests by any means. Mostly we're just # making sure we don't crash. -check: check-help check-version \ - check-help-r \ +check: check-help check-version check-help-r check-usage \ check-atend \ check-binary check-bin2 \ check-binhdr-lf check-binhdr-cr check-binhdr-crlf \ + check-filter check-filter-outfile \ check-gray \ check-gscmd check-gsopt check-gsopts \ - check-filter check-filter-outfile \ - check-gscmd \ check-nogs \ + check-output \ check-percent \ check-restricted-device \ check-restricted-gscmd \ @@ -37,25 +39,22 @@ check-version: check-help-r: $(re2p_script) $(re2p_script) --help | grep restricted # should have default=true -check-nogs: - $(e2p) --no-gs test-simple.eps >test-simple.out -# the two files should be different: - cmp -s test-simple.eps test-simple.out || exit 0 - -$(re2p_script): - ln -s $(prg).pl $@ +check-usage: + ! $(e2p) # no args + ! $(e2p) arg1 arg2 arg3 # too many args + ! $(e2p) --nonesuch # no option -check-restricted-device: +check-restricted-device: $(re2p_script) ! $(re2p) --device=unsafe test-simple.eps -check-restricted-gscmd: +check-restricted-gscmd: $(re2p_script) ! $(re2p) --gscmd=/bin/unsafe test-simple.eps ! $(re2p) --gscmd=unsafe test-simple.eps -check-restricted-safe-in: +check-restricted-safe-in: $(re2p_script) ! $(re2p) /unsafe/in.eps -check-restricted-safe-out: +check-restricted-safe-out: $(re2p_script) ! $(re2p) test-simple.eps -o /unsafe/out.eps check-filter: @@ -90,6 +89,24 @@ check-gsopts: $(e2p) --gscmd=echo --gsopts='foo bar' test-simple.eps ! $(e2p) --restricted --gsopts=bar test-simple.eps # fails +check-nogs: + $(e2p) --no-gs test-simple.eps >test-simple.out +# the two files should be different: + cmp -s test-simple.eps test-simple.out || exit 0 + +check-output: $(re2p_script) + $(re2p) test-simple.eps -o test-p.pdf # not if restricted + # should do this everywhere -- remove first, validate after. + #rm -f test-o.pdf; $(e2p) -o test-o.pdf test-simple.eps; pdfinfo test-o.pdf + $(e2p) -o test-o.pdf test-simple.eps + $(e2p) --outfile test-o.pdf test-simple.eps + $(e2p) --outfile=test-o.pdf test-simple.eps + $(e2p) --output test-o.pdf test-simple.eps + $(e2p) test-simple.eps test-p.pdf + $(re2p) test-simple.eps test-p.pdf + ! $(e2p) test-simple.eps test-p.pdg # not .pdf + ! $(e2p) -o test-o.pdf test-simple.eps test-p.pdf # two methods + check-simple: $(MAKE) file=test-simple check1 @@ -126,10 +143,12 @@ check-tn5002: check-floral: $(MAKE) file=test-floral check1 +# subtarget for simple test that conversion of $(file) works. check1: $(e2p) $(file).eps pdfinfo $(file).pdf | grep "Page size" +# # put tar contents in a directory for CTAN. dist: $(prg).tar.gz $(prg).html .PHONY: dist diff --git a/Build/source/extra/epstopdf/README b/Build/source/extra/epstopdf/README index 18ca6aff779..f28e746db19 100644 --- a/Build/source/extra/epstopdf/README +++ b/Build/source/extra/epstopdf/README @@ -3,7 +3,7 @@ This file is public domain. (Originally written by Karl Berry, 2009.) This is the README for the epstopdf script distribution. -Primary distribution point: http://mirror.ctan.org/support/epstopdf/ +Primary distribution point: http://ctan.org/pkg/epstopdf (list of mirrors at: http://ctan.org/mirrors) Home page: http://tug.org/epstopdf/ @@ -15,7 +15,12 @@ When reporting bugs, please include an input file and command line options, so the problem can be reproduced. ------------------------------------------------------------------------- -The test-binary and test-bin2 files were supplied by Akira Kakuto and +Various test files and a Makefile to drive them are in the source +repository, which is currently a subdirectory of the texlive Subversion +repo, purely for the developers' convenience: + http://tug.org/svn/texlive/trunk/Build/source/extra/epstopdf/ + +The test-binary and test-bin2 files there were supplied by Akira Kakuto and Reinhard Kotucha. They contain binary data. They are public domain. The test-binhdr* files were supplied by Martin von Gagern, constructed diff --git a/Build/source/extra/epstopdf/epstopdf.1 b/Build/source/extra/epstopdf/epstopdf.1 index 7d02b186a09..0405e4499f3 100644 --- a/Build/source/extra/epstopdf/epstopdf.1 +++ b/Build/source/extra/epstopdf/epstopdf.1 @@ -1,9 +1,9 @@ -.TH EPSTOPDF 1 "28 May 2016" +.TH EPSTOPDF 1 "7 January 2017" .\" $Id$ .SH NAME epstopdf, repstopdf \- convert an EPS file to PDF .SH SYNOPSIS -\fBepstopdf\fP [\fIoptions\fP] [\fIepsfile\fP] +\fBepstopdf\fP [\fIoptions\fP] [\fIepsfile\fP [\fIpdffile\fP.pdf]] .SH DESCRIPTION By default, \fBepstopdf\fP converts the input PostScript file to PDF, using Ghostscript. @@ -14,6 +14,11 @@ coordinate, and it sets a page size exactly corresponding to the BoundingBox. Thus, the result needs no cropping, and the PDF MediaBox is correct. .PP +By default, the output name is the input name with any extension +replaced by \fB.pdf\fP. An output name ending with .pdf can also be given +as a second argument on the command line, or the \fB--outfile\fP +(\fB-o\fP) option can be used with any name. +.PP PJL commands at the start of a file are removed. DOS EPS binary files (TN 5002) are supported. .PP @@ -107,6 +112,7 @@ names are allowed, those taking general strings are not. These examples all equivalently convert `test.eps' to `test.pdf': .nf epstopdf test.eps +epstopdf test.eps test.pdf cat test.eps | epstopdf --filter >test.pdf cat test.eps | epstopdf -f -o=test.pdf .fi diff --git a/Build/source/extra/epstopdf/epstopdf.pl b/Build/source/extra/epstopdf/epstopdf.pl index 61ffc72181f..88bff419b66 100755 --- a/Build/source/extra/epstopdf/epstopdf.pl +++ b/Build/source/extra/epstopdf/epstopdf.pl @@ -34,9 +34,12 @@ # "%%BoundingBox: (atend)" when input is not seekable (e.g., from a pipe), # # emacs-page -my $ver = "2.25"; - -# History +# +my $ver = "2.26"; +# 2017/01/07 v2.26 (Norbert Preining, Karl Berry) +# * allow cmdline of infile outfile.pdf. +# * explicitly allow -o as abbreviation for --outfile, +# to guard against future --options. (Also --output.) # 2016/06/30 v2.25 (Norbert Preining, Karl Berry) # * don't set (default) device until after restricted check. # * a few more debugging lines. @@ -182,7 +185,7 @@ my $ver = "2.25"; my $program = "epstopdf"; my $ident = '($Id$)' . " $ver"; my $copyright = <<END_COPYRIGHT ; -Copyright 2009-2016 Karl Berry et al. +Copyright 2009-2017 Karl Berry et al. Copyright 2002-2009 Gerben Wierda et al. Copyright 1998-2001 Sebastian Rahtz et al. License RBSD: Revised BSD <http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5> @@ -331,9 +334,14 @@ my $resmsg = $::opt_res ? $::opt_res : "[use gs default]"; my $rotmsg = $::opt_autorotate ? $::opt_autorotate : "[use gs default]"; my $usage = <<"END_OF_USAGE"; -${title}Usage: $program [OPTION]... [EPSFILE] +${title}Usage: $program [OPTION]... [EPSFILE [PDFFILE.pdf]] + +Convert an EPS file to PDF (or other formats), by default using Ghostscript. -Convert EPS to PDF (or other formats), by default using Ghostscript. +By default, the output name is the input name with any extension +replaced by ".pdf". An output name ending with .pdf can also be given +as a second argument on the command line, or the --outfile (-o) option +can be used with any name. The resulting output is guaranteed to start at the 0,0 coordinate, and sets a page size exactly corresponding to the BoundingBox. Thus, the @@ -346,7 +354,7 @@ Options: --help display this help and exit --version display version information and exit - --outfile=FILE write result to FILE (default based on input name) + -o, --outfile=FILE write result to FILE (default based on input name) --restricted use restricted mode (default: $bool[$restricted]) --(no)debug output debugging info (default: $bool[$::opt_debug]) @@ -376,6 +384,7 @@ Options for Ghostscript: Examples all equivalently converting test.eps to test.pdf: \$ $program test.eps + \$ $program test.eps test.pdf \$ cat test.eps | $program --filter >test.pdf \$ cat test.eps | $program -f -o=test.pdf @@ -428,7 +437,7 @@ GetOptions ( "gsopts=s" => \&gsopts, # \ref{val_gsopts} "help|h", "hires!", - "outfile=s", # \ref{openout_any} + "outfile|output|o=s", # \ref{openout_any} "pdfsettings=s", "quiet", "res=s", @@ -447,7 +456,7 @@ $restricted = 1 if $::opt_restricted; sub debug { print STDERR "* @_\n" if $::opt_debug; } sub warning { print STDERR "==> Warning: @_\n"; } sub error { die "$title!!! Error: @_\n"; } -sub errorUsage { die "Error: @_ (try --help for more information)\n"; } +sub errorUsage { die "$program: Error: @_ (try --help for more information)\n"; } sub warnerr { $restricted ? error(@_) : warning(@_); } ### debug messages @@ -480,13 +489,13 @@ sub safe_name { ### help, version options. if ($::opt_help) { print $usage; - exit (0); + exit 0; } if ($::opt_version) { print $title; print $copyright; - exit (0); + exit 0; } ### get input filename (\ref{openin_any} for validation) @@ -496,10 +505,24 @@ if ($::opt_filter) { errorUsage "Input file cannot be used with filter option"; debug "Filtering: will read standard input"; } else { + # not filtering. @ARGV > 0 or errorUsage "Input filename missing"; - @ARGV < 2 or errorUsage "Unknown option or too many input files"; + # allow infile outfile.pdf. + if (@ARGV == 2) { + if ($::opt_outfile) { + errorUsage ("Multiple output specifications: second arg=$ARGV[1]," + . " --outfile=$::opt_outfile"); + } + if ($ARGV[1] !~ m/\.pdf$/i) { + errorUsage "Output file argument requires .pdf extension: $ARGV[1]"; + } + # seems we can use it. + $::opt_outfile = $ARGV[1]; + debug "Output filename from argv:", $::opt_outfile; + } + @ARGV > 2 and errorUsage "Too many arguments: @ARGV"; + $InputFilename = $ARGV[0]; - #-r $InputFilename or error "\"$InputFilename\" not readable"; debug "Input filename:", $InputFilename; } |