summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2024-04-29 17:27:25 +0000
committerKarl Berry <karl@freefriends.org>2024-04-29 17:27:25 +0000
commit6350524eb542b8de8a969985355fe2df94943b3b (patch)
treea31b40c2e5675e9c1c4ccc47972495390c735cb0
parent467f3c0b94ec8190767721a7485a07bfa7221ca5 (diff)
2.34 release: recognize --debug specially as first arg; wording/doc tweaks
git-svn-id: svn://tug.org/texlive/trunk@71121 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/extra/epstopdf/Makefile20
-rw-r--r--Build/extra/epstopdf/README6
-rw-r--r--Build/extra/epstopdf/epstopdf.118
-rwxr-xr-xBuild/extra/epstopdf/epstopdf.pl159
4 files changed, 111 insertions, 92 deletions
diff --git a/Build/extra/epstopdf/Makefile b/Build/extra/epstopdf/Makefile
index fe7d3a545d6..0bc43d9ea25 100644
--- a/Build/extra/epstopdf/Makefile
+++ b/Build/extra/epstopdf/Makefile
@@ -6,7 +6,7 @@ e2p = ./$(prg).pl #--debug
re2p = ./r$(prg) --restricted
re2p_script = ./r$(prg)
-default: check
+default:
$(re2p_script):
ln -s $(prg).pl $@
@@ -120,9 +120,6 @@ check-output: $(re2p_script)
! $(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
-
check-atend:
$(MAKE) file=test-atend check1
@@ -141,6 +138,9 @@ check-binhdr-cr:
check-binhdr-crlf:
$(MAKE) file=test-binhdr-crlf check1
+check-debug:
+ $(MAKE) file=test-simple e2p_opt=--debug check1
+
# Another DOS EPS binary file.
# Reported to tex-k from Pat Ridley, 26 Sep 2020 12:38:42.
check-dosepsbin:
@@ -156,6 +156,12 @@ check-percent:
$(MAKE) file=test-per%cent check1
test -s test-per%cent.pdf
+check-res:
+ $(MAKE) file=test-simple e2p_opt=--res=100x100 check1
+
+check-simple:
+ $(MAKE) file=test-simple check1
+
check-tn5002:
$(MAKE) file=test-tn5002-cr check1
$(MAKE) file=test-tn5002-crlf check1
@@ -169,8 +175,10 @@ check-which:
! $(e2p) --gscmd=nonepath test-simple.eps
! $(re2p) --gscmd=nonepath test-simple.eps
+# in 10.03.0, exit status has become zero, so skip for now.
+# https://bugs.ghostscript.com/show_bug.cgi?id=707766
check-write-error:
- ! $(e2p) test-simple.eps --outfile=/dev/full
+ # ! $(e2p) --debug test-simple.eps --outfile=/dev/full
# complicated, from http://www.vectorfloral.com/floral-swirly-flowers-with-butterflies-vector-graphic-174.html
# another, even bigger, is at http://www.backgroundvector.com/abstract-colorful-background-vector-image-94.html
@@ -180,7 +188,7 @@ check-floral:
# subtarget for simple test that conversion of $(file) works.
check1:
- $(e2p) $(file).eps
+ $(e2p) $(e2p_opt) $(file).eps
pdfinfo $(file).pdf | grep "Page size"
#
diff --git a/Build/extra/epstopdf/README b/Build/extra/epstopdf/README
index bba7d18639b..ff378b81618 100644
--- a/Build/extra/epstopdf/README
+++ b/Build/extra/epstopdf/README
@@ -3,10 +3,10 @@ This file is public domain. (Originally written by Karl Berry, 2009.)
This is the README for the epstopdf script distribution.
-Primary distribution point: http://ctan.org/pkg/epstopdf
- (list of mirrors at: http://ctan.org/mirrors)
+Primary distribution point: https://ctan.org/pkg/epstopdf
+ (list of mirrors at: https://ctan.org/mirrors)
-Home page: http://tug.org/epstopdf/
+Home page: https://tug.org/epstopdf/
Run epstopdf --help for the usual list of options, examples, etc.
diff --git a/Build/extra/epstopdf/epstopdf.1 b/Build/extra/epstopdf/epstopdf.1
index e5f6d450865..eaefef20bda 100644
--- a/Build/extra/epstopdf/epstopdf.1
+++ b/Build/extra/epstopdf/epstopdf.1
@@ -1,4 +1,4 @@
-.TH EPSTOPDF 1 "15 September 2023"
+.TH EPSTOPDF 1 "29 April 2024"
.\" $Id$
.SH NAME
epstopdf, repstopdf \- convert an EPS file to PDF
@@ -30,7 +30,7 @@ produced by default.)
PJL commands at the start of a file are removed. DOS EPS binary files
(TN 5002) are supported. Seeking from a pipe is not supported.
.PP
-If the bounding box in the input is incorrect, of course there will
+If the bounding box in the input is incorrect, inevitably there will
be resulting problems.
.SH OPTIONS
Options may start with either "\fB-\fP" or "\fB--\fP", and may be
@@ -48,7 +48,8 @@ write result to \fIfile\fP. If this option is not given, and
otherwise, the default is to construct the output file name by replacing
any extension in the input file with `.pdf'.
.IP "\fB--\fP[\fBno\fP]\fBdebug\fP"
-write debugging info (default: false).
+write debugging info (default: false). For maximum output, use \fB--debug\fP
+as the first option.
.IP "\fB--\fP[\fBno\fP]\fBexact\fP"
scan ExactBoundingBox (default: false).
.IP "\fB--\fP[\fBno\fP]\fBfilter\fP"
@@ -70,8 +71,8 @@ gs, installed under \fB.../tlpkg/tlgs/bin/\fP.
.PP
Options for Ghostscript (more info below):
.IP "\fB--gscmd\fP=\fIval\fP"
-pipe output to \fIval\fP (default: [\fBgswin64c\fP on 64-bit Windows,
-\fBgswin32c\fP on 32-bit Windows, else \fBgs\fP])
+pipe output to \fIval\fP (default: [\fBgswin64c.exe\fP on 64-bit Windows,
+\fBgswin32c.exe\fP on 32-bit Windows, else \fBgs\fP])
.IP "\fB--gsopt\fP=\fIval\fP"
include \fIval\fP as one argument in the gs command (can be repeated).
.IP "\fB--gsopts\fP=\fIval\fP"
@@ -112,7 +113,7 @@ individually.
.PP
\fB--gsopt\fP adds its argument as a single option to the gs command
line. It can be used multiple times to specify options separately.
-This must be used if a gs option or its value contains whitespace.
+This form must be used if a gs option or its value contains whitespace.
.PP
In restricted mode, options are limited to those with names and values
known to be safe. Some options taking booleans, integers or fixed
@@ -141,8 +142,9 @@ Example for \fBepstopdf\fP's attempt at correcting PostScript:
epstopdf --nogs test.ps >testcorr.ps
.fi
.PP
-In all cases, you can add \fB--debug\fP (\fB-d\fP) to see more about
-what \fBepstopdf\fP is doing.
+In all cases, you can add \fB--debug\fP to see more about
+what \fBepstopdf\fP is doing. Use \fB--debug\fP as the first option for
+maximum output.
.SH BUGS
The case of "%%BoundingBox: (atend)" when input is not seekable (e.g.,
from a pipe) is not supported.
diff --git a/Build/extra/epstopdf/epstopdf.pl b/Build/extra/epstopdf/epstopdf.pl
index 59df3b60582..83136607dd1 100755
--- a/Build/extra/epstopdf/epstopdf.pl
+++ b/Build/extra/epstopdf/epstopdf.pl
@@ -1,14 +1,5 @@
#!/usr/bin/env perl
use warnings;
-
-# Note by JCC 14 Apr 2024: Maybe put code
-# for detecting TL Windows etc
-# for Windows setting of $GS
-# after parsing of options etc, but before testing for existence of programs.
-# But will need to revise help text about gs name.
-# Hive off the detecting of TL Windows to subroutine.
-
-
# $Id$
# (Copyright lines below.)
#
@@ -45,21 +36,29 @@ use warnings;
#
# emacs-page
#
-my $ver = "2.34.JCC.2";
-# 2024/04/14 2.34.JCC.2 (John Collins)
+my $ver = "2.34";
+# 2024/04/29 2.34 (Karl Berry)
+# * if --debug is first argument, give more output.
+# * do not check for kpsewhich in PATH unless restricted.
+# * minor wording and doc changes.
+# 2024/04/14 (John Collins)
+# * use warnings.
# * Msys PATH separator is :.
-# * Do immediate decomposition of path to array on start up, and use array
+# * Do immediate decomposition of path to array on startup, and use array
# instead of separate uses of split.
-# * On Windows, msys and Cygwin, normalize directory separator to /.
+# * On Windows, Msys and Cygwin, normalize directory separator to /.
# * Detect invocation via Windows TL (and epstopdf.exe wrapper script) by
-# presence of TL's private gs in PATH. (Directory ending in /tlgs/bin.)
-# In this case change behavior under Cygwin to be of the Windows instead of
-# Unix.
-# * On cygwin and msys, put temporary file in current directory instead of
+# presence of TL's private gs in PATH: a directory ending in /tlgs/bin.
+# In this case, change behavior under Cygwin to be like that of Windows
+# instead of Unix.
+# * On Cygwin and Msys, put temporary file in current directory instead of
# default, which is normally /tmp. That's so that the pathname to the
-# temporary file remains valid no matter which kind of gs its passed to:
-# native Windows, msys or Cygwin.
-# * Pretty print PATH, one directory per line, in error about program not in PATH.
+# temporary file remains valid no matter which kind of gs it's passed to:
+# native Windows, Msys or Cygwin.
+# * Prettyprint PATH, one directory per line, in error about program
+# not in PATH.
+# Original report from Pablo Gonzalez L,
+# https://tug.org/pipermail/tex-k/2024-April/004036.html
# 2023/09/15 2.33 (Karl Berry)
# * Cygwin PATH separator is :. Report from Alois Steindl,
# https://tug.org/pipermail/tex-live/2023-September/049474.html
@@ -229,7 +228,7 @@ my $ver = "2.34.JCC.2";
my $program = "epstopdf";
my $ident = '($Id$)' . " $ver";
my $copyright = <<END_COPYRIGHT ;
-Copyright 2009-2023 Karl Berry et al.
+Copyright 2009-2024 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>
@@ -238,38 +237,51 @@ There is NO WARRANTY, to the extent permitted by law.
END_COPYRIGHT
my $title = "$program $ident\n";
+### message functions.
+sub debug { print STDERR "* @_\n" if $::opt_debug; }
+sub warning { print STDERR "==> Warning: @_\n"; }
+sub error { die "$title!!! Error: @_\n"; }
+sub errorUsage { die "$program: Error: @_ (try --help for more information)\n"; }
+sub warnerr { $restricted ? error(@_) : warning(@_); }
+
+# Check specially for --debug or -d (exactly) as first argument, so we can
+# generate debugging output during initialization.
+$::opt_debug = 1 if @ARGV && ($ARGV[0] eq "--debug" || $ARGV[0] eq "-d");
+
+# Different Windows cases.
my $on_cygwin = ($^O eq 'cygwin');
my $on_msys = ($^O eq 'msys');
my $on_windows = ($^O =~ /^MSWin/) || $on_msys;
my $on_windows_or_cygwin = $on_windows || $on_cygwin;
+debug "on_windows=$on_windows, on_windows_or_cygwin=$on_windows_or_cygwin";
+debug " on_cygwin=$on_cygwin, on_msys=$on_msys";
-# Which TL?
-
-my $path_sep = ( ($^O =~ /^MSWin/) ? ';' : ':' );
-my @pdirs = split($path_sep, $ENV{PATH});
+# Split PATH and use / as directory separator.
+#
+my $path_sep = ( ($^O =~ /^MSWin/) ? ';' : ':' ); # not msys
+my @pdirs = split($path_sep, $ENV{"PATH"});
# Normalize directory separators to /. Always valid on Windows.
if ($on_windows_or_cygwin) {
- foreach (@pdirs) { s !\\!/!g; }
+ foreach (@pdirs) { s !\\!/!g; }
}
+debug "Normalized PATH to: @pdirs";
-# Default values for commands
-# Ghostscript, which is always needed. Override for Windows
+# Default values for commands.
+# Ghostscript, which is always needed.
my $GS = 'gs';
# Kpsewhich, only used in restricted mode.
my $kpsewhich = 'kpsewhich';
-# Determine if I was invoked from a standard Windows TL installation via the
+# Determine if we were invoked from a standard Windows TL installation via the
# wrapper script epstopdf.exe:
my $TL_Windows_bin = undef;
my $TL_tlgs = undef;
if ($on_windows_or_cygwin) {
- # Doesn't work for current placement of this block of code
- # Command line options not yet parsed, so debug does nothing.
- debug( "Looking for symptoms of wrapper .exe and Windows TL:" );
+ debug "Looking for symptoms of Windows TL gs and wrapper .exe:";
for (@pdirs) {
- if ( m!^(.+)/tlpkg/tlgs/bin$! ) {
- debug( "Found Windows tlgs item '$_' in PATH" );
- # I was probably invoked via runscript by .exe file in native TL
+ if (m!^(.+)/tlpkg/tlgs/bin$!) {
+ debug "Found Windows tlgs item '$_' in PATH";
+ # We were probably invoked via runscript by .exe file in native TL
# Windows, since then a tlgs/bin item is inserted in PATH,
# so that Windows TL's private installation of gs, with its executables
# gswin64c.exe and/or gswin32c.exe gets used.
@@ -285,27 +297,31 @@ if ($on_windows_or_cygwin) {
# Confirm by existence of expected directories and files.
# If those do not exist, we don't have a standard native
# Windows TL installation.
- if ( (-x "$TL_Windows_bin/kpsewhich.exe")
- && ( (-x "$TL_tlgs/gswin64c.exe") || (-x "$TL_tlgs/gswin32c.exe") )
- ) {
- # The files I need exist.
- # Note that runscript ensures that the tlgs and the binary directory
- # of its own installation are in PATH ahead of any directories that
- #may contains other versions.
+ if (-x "$TL_Windows_bin/kpsewhich.exe"
+ && (-x "$TL_tlgs/gswin64c.exe" || -x "$TL_tlgs/gswin32c.exe")
+ ) {
+ # The needed files exist.
+ # The runscript wrapper ensures that the tlgs and the binary directory
+ # of its own installation are in PATH ahead of any directories that
+ # may contain other versions.
}
else {
- warning(
- "I appear to be run from native TeX Live Windows with bin and tlgs dirs\n".
- " '$TL_Windows_bin'\n".
- " '$TL_tlgs'.\n".
- "But the expected files that I need don't exist (kpsewhich, and gswin64c or\n".
- "gswin32c). So we don't have a correct standard TeX Live Windows installation.\n" );
+ warning(<<END_STRANGE_WINDOWS);
+It seems epstopdf has been called from native TeX Live Windows,
+with these Windows bin and tlgs dirs:
+ $TL_Windows_bin
+ $TL_tlgs
+But the needed files don't exist, namely kpsewhich and gswin64c or gswin32c
+So we don't have a correct standard TeX Live Windows installation.
+Unsetting the Windows bin and tlgs directories and hoping for the best.
+END_STRANGE_WINDOWS
$TL_Windows_bin = undef;
$TL_tlgs = undef;
}
- }
- else { debug( "Nothing relevant found" ); }
-}
+ } else {
+ debug "No tlpkg/tlgs/bin item found in PATH: @pdirs";
+ } # not TL_tlgs
+} # on_windows_or_cygwin
if ($on_windows || defined $TL_tlgs) {
$GS = "gswin32c";
@@ -320,10 +336,12 @@ if ($on_windows || defined $TL_tlgs) {
}
}
}
+ debug "on_windows and have tlgs, GS set to: $GS";
}
-### restricted mode
-my $restricted = 0;
+
+### restricted mode, implicit if called as repstopdf.
+$restricted = 0;
$restricted = 1 if $0 =~ /repstopdf/;
### default values
@@ -473,7 +491,7 @@ The resulting output is guaranteed to start at the 0,0 coordinate, and
sets a page size exactly corresponding to the BoundingBox. Thus, the
result does not need any cropping, and the PDF MediaBox is correct.
-If the bounding box in the input is incorrect, of course there will
+If the bounding box in the input is incorrect, inevitably there will
be resulting problems.
Options:
@@ -490,7 +508,8 @@ Options:
--(no)hires scan HiResBoundingBox (default: $bool[$::opt_hires])
Options for Ghostscript:
- --gscmd=VAL pipe output to VAL (default: $GS)
+ --gscmd=VAL pipe output to VAL (default: $GS
+ [gs on Unix, gswin64c.exe or gswin32c.exe on Windows])
--gsopt=VAL single option for gs (see below)
--gsopts=VAL options for gs (see below)
--autorotate=VAL set AutoRotatePages (default: $rotmsg)
@@ -505,10 +524,9 @@ Options for Ghostscript:
screen, ebook, printer, prepress, default.
--(no)quiet use -q (-dQUIET) (default: $bool[$::opt_quiet])
--res=DPI|DPIxDPI set image resolution (default: $resmsg)
- ignored if option --debug is set.
--(no)safer use -d(NO)SAFER (default: $bool[$::opt_safer])
-Examples all equivalently converting test.eps to test.pdf:
+These examples all equivalently convert test.eps to test.pdf:
\$ $program test.eps
\$ $program test.eps test.pdf
\$ cat test.eps | $program --filter >test.pdf
@@ -520,8 +538,8 @@ Example for using HiResBoundingBox instead of BoundingBox:
Example for producing epstopdf's attempt at corrected PostScript:
\$ $program --nogs test.ps >testcorr.ps
-In all cases, you can add --debug (-d) to see more about what epstopdf
-is doing.
+In all cases, you can use --debug to see more about what epstopdf
+is doing. For maximum output, use --debug as the first option.
More about the options for Ghostscript:
Additional options to be used with gs can be specified
@@ -543,7 +561,7 @@ When reporting bugs, please include an input file and all command line
options so the problem can be reproduced.
Report bugs to: tex-k\@tug.org
-epstopdf home page: <http://tug.org/epstopdf/>
+epstopdf home page: <https://tug.org/epstopdf/>
END_OF_USAGE
### process options
@@ -578,16 +596,7 @@ $::opt_quiet = 0 if $::opt_debug;
### restricted option
$restricted = 1 if $::opt_restricted;
-### help functions
-sub debug { print STDERR "* @_\n" if $::opt_debug; }
-sub warning { print STDERR "==> Warning: @_\n"; }
-sub error { die "$title!!! Error: @_\n"; }
-sub errorUsage { die "$program: Error: @_ (try --help for more information)\n"; }
-sub warnerr { $restricted ? error(@_) : warning(@_); }
-
### debug messages
-debug "on_windows=$on_windows, on_windows_or_cygwin=$on_windows_or_cygwin";
-debug "on_msys=$on_msys, on_cygwin = $on_cygwin";
debug "Restricted mode activated" if $restricted;
### check that PROG is in PATH and executable, abort if not. It'd be
@@ -606,7 +615,7 @@ sub check_prog_exists {
# absolute unix
if (! $on_windows_or_cygwin && $prog =~ m,^((\.(\.)?)?/),) {
return 1 if -x $prog; # absolute or explicitly relative
- error "Required program $prog not found, given explicit directory";
+ error "Required program $prog not found, given with explicit directory";
# absolute windows: optional drive letter, then . or .., then \ or /.
} elsif ($on_windows_or_cygwin
@@ -621,7 +630,7 @@ sub check_prog_exists {
# not absolute, check path
for my $dir (@pdirs) {
$dir = "." if $dir eq ""; # empty path element
- debug " Checking dir $dir";
+ debug " Checking dir $dir";
if (-x "$dir/$prog") {
return 1;
} elsif ($on_windows_or_cygwin) {
@@ -634,13 +643,13 @@ sub check_prog_exists {
# if made it through the whole loop, not found, so quit.
my @path_pretty = ();
for (@pdirs) { push @path_pretty, " '$_'\n"; }
-# error "Required program $prog not found in PATH ($ENV{PATH})";
- error "Required program $prog not found in PATH, which contains:\n", @path_pretty;
+ error "Required program $prog not found in PATH, which contains:\n",
+ @path_pretty;
}
-check_prog_exists ($kpsewhich);
+check_prog_exists ($kpsewhich) if $restricted; # only needed if restricted
### check if a name is "safe" according to kpse's open(in|out)_any
-# return true if name is ok, false otherwise
+# return true if name is ok, false if not.
sub safe_name {
my ($mode, $name) = @_;
my $option = "";