summaryrefslogtreecommitdiff
path: root/office
diff options
context:
space:
mode:
Diffstat (limited to 'office')
-rw-r--r--office/texlive/epstopdf/README26
-rw-r--r--office/texlive/epstopdf/epstopdf.182
-rw-r--r--office/texlive/epstopdf/epstopdf.pdfbin0 -> 6385 bytes
-rw-r--r--office/texlive/epstopdf/epstopdf.pl586
-rwxr-xr-x[-rw-r--r--]office/texlive/texlive.SlackBuild13
-rw-r--r--office/texlive/texlive.png14.diff60
6 files changed, 766 insertions, 1 deletions
diff --git a/office/texlive/epstopdf/README b/office/texlive/epstopdf/README
new file mode 100644
index 0000000000..0338f4fada
--- /dev/null
+++ b/office/texlive/epstopdf/README
@@ -0,0 +1,26 @@
+$Id: README 15641 2009-10-04 16:42:16Z karl $
+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/
+ (list of mirrors at: http://ctan.org/mirrors)
+
+Home page: http://tug.org/epstopdf/
+
+Mailing list for bugs and discussion: http://lists.tug.org/tex-k
+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
+Reinhard Kotucha. They contain binary data. They are public domain.
+
+The test-binhdr* files were supplied by Martin von Gagern, constructed
+as follows. They contain binary junk before the EPS starts. We also
+use these to test different line endings. These files are public domain.
+
+{ echo -e '%Some\000binary\001comment'; dot -Tps <<< 'digraph{a->b}'; }
+ > test-binhdr-lf.eps
+tr $'\n' $'\r' <test-binhdr-lf.eps >test-binhdr-cr.ps
+unix2dos <test-binhdr-lf.eps >test-binhdr-cr.ps
diff --git a/office/texlive/epstopdf/epstopdf.1 b/office/texlive/epstopdf/epstopdf.1
new file mode 100644
index 0000000000..7243280baf
--- /dev/null
+++ b/office/texlive/epstopdf/epstopdf.1
@@ -0,0 +1,82 @@
+.TH EPSTOPDF 1 "30 November 2009"
+.\" $Id: epstopdf.1 16245 2009-11-30 01:37:26Z karl $
+.\" man page originally by Jim Van Zandt
+.SH NAME
+epstopdf, repstopdf \- convert an EPS file to PDF
+.SH SYNOPSIS
+\fBepstopdf\fP [\fIoptions\fP] [\fIepsfile\fP]
+.SH DESCRIPTION
+\fBepstopdf\fP transforms the Encapsulated PostScript file \fIepsfile\fP
+(or standard input) so that it is guaranteed to start at the 0,0
+coordinate, and it sets a page size exactly corresponding to the
+BoundingBox. This means that when Ghostscript renders it, the result
+needs no cropping, and the PDF MediaBox is correct. By default, the
+result is piped to Ghostscript and a PDF version written.
+.P
+If the bounding box is not right, of course, there are problems.
+.SH OPTIONS
+.IP "\fB--outfile\fP=\fIfile\fP"
+write result to \fIfile\fP; the default is to construct the output file
+name by replacing any extension in the input file with \fI.pdf\fP. If
+\fB--nogs\fP or \fB--filter\fP is specified, write to standard output.
+.IP "\fB--\fP[\fBno\fP]\fBcompress\fP"
+use compression (default: on).
+.IP "\fB--\fP[\fBno\fP]\fBdebug\fP"
+write debugging info (default: off).
+.IP "\fB--\fP[\fBno\fP]\fBembed\fP"
+embed fonts (default: on).
+.IP "\fB--\fP[\fBno\fP]\fBexact\fP"
+scan ExactBoundingBox (default: off).
+.IP "\fB--\fP[\fBno\fP]\fBfilter\fP"
+read standard input (default: off).
+.IP "\fB--\fP[\fBno\fP]\fBgs\fP"
+run ghostscript (default: on).
+.IP "\fB--\fP[\fBno\fP]\fBhires\fP"
+scan HiresBoundingBox (default: off).
+.IP "\fB--gscmd\fP=\fIval\fP"
+pipe output to \fIval\fP (default: [\fBgswin32c\fP on Windows, else \fBgs\fP])
+.IP "\fB--res\fP=\fIdpi\fP"
+set image resolution (default: [use gs default])
+.IP "\fB--autorotate\fP=\fIval\fP"
+set AutoRotatePages (default: None); recognized \fIval\fP choices:
+None, All, PageByPage. For EPS files, PageByPage is equivalent to All.
+.IP "\fB--restricted\fP=\fIval\fP"
+turn on restricted mode (default: [on for resptopdf, else off]);
+this restricts the values accepted by \fB--gscmd\fP and impose restrictions
+on the output file name similar to web2c's openout_any=p.
+.IP "\fB--help\fP
+display help message and exit
+.IP "\fB--version\fP
+display version information and exit
+.SH EXAMPLES
+Examples for producing "test.pdf":
+.nf
+epstopdf test.eps
+produce postscript | epstopdf --filter >test.pdf
+produce postscript | epstopdf -f -d -o=test.pdf
+
+.fi
+Example: look for HiresBoundingBox and produce corrected PostScript:
+.nf
+epstopdf -d --nogs --hires test.ps >testcorr.ps
+.fi
+.SH BUGS
+The case of "%%BoundingBox: (atend)"
+when input is not seekable (e.g., from a pipe) is not supported.
+.PP
+When reporting bugs, please include an input file and command line
+options so the problem can be reproduced. Report bugs in
+the program or this man page to tex-k@tug.org.
+.SH SEE ALSO
+\fBgs\fP(1),
+\fBpdfcrop\fP(1).
+.SH AUTHOR
+The script was originally written by Sebastian Rahtz, for Elsevier
+Science, with subsequent contributions from Gerben Wierda and many
+others. Currently maintained by Karl Berry.
+.PP
+Man page originally written by Jim Van Zandt.
+.PP
+epstopdf home page: http://tug.org/epstopdf/
+.PP
+You may freely use, modify and/or distribute this file.
diff --git a/office/texlive/epstopdf/epstopdf.pdf b/office/texlive/epstopdf/epstopdf.pdf
new file mode 100644
index 0000000000..9afe8d2071
--- /dev/null
+++ b/office/texlive/epstopdf/epstopdf.pdf
Binary files differ
diff --git a/office/texlive/epstopdf/epstopdf.pl b/office/texlive/epstopdf/epstopdf.pl
new file mode 100644
index 0000000000..a312a9b7f9
--- /dev/null
+++ b/office/texlive/epstopdf/epstopdf.pl
@@ -0,0 +1,586 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
+ if 0;
+use strict;
+
+# $Id: epstopdf.pl 16244 2009-11-30 01:36:08Z karl $
+# (Copyright lines below.)
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote
+# products derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# ----------------------------------------------------------------
+#
+# This is a script to transform an EPS file such that:
+# a) it is guaranteed to start at the 0,0 coordinate.
+# b) it sets a page size exactly corresponding to the BoundingBox
+# This means that when Ghostscript renders it, the result needs no
+# cropping, and the PDF MediaBox is correct.
+# c) the result is piped to Ghostscript and a PDF version written.
+#
+# It needs a Level 2 PS interpreter.
+# If the bounding box is not right, of course, there will be problems.
+#
+# One thing not allowed for is the case of
+# "%%BoundingBox: (atend)" when input is not seekable (e.g., from a pipe),
+# which is more complicated.
+#
+# emacs-page
+# History
+# 2009/11/27 v2.12 (Karl Berry)
+# * Make --filter work again
+# 2009/11/25 (Manuel P\'egouri\'e-Gonnard)
+# * Better extension detection, suggested by A. Cherepanov.
+# 2009/10/18 (Manuel P\'egouri\'e-Gonnard)
+# * Better argument validation (Alexander Cherepanov).
+# * Use list form of pipe open() (resp. system()) to prevent injection.
+# Since Perl's fork() emulation doesn't work on Windows with Perl 5.8.8 from
+# TeX Live 2009, use a temporary file instead of a pipe on Windows.
+# 2009/10/14 (Manuel P\'egouri\'e-Gonnard)
+# * Added restricted mode.
+# 2009/09/27 v2.11 (Karl Berry)
+# * Fixed two bugs in the (atend) handling code (Martin von Gagern)
+# * Improved handling of CR line ending (Martin von Gagern)
+# * More error checking
+# * --version option
+# * Create source repository in TeX Live
+# 2009/07/17 v2.9.11gw
+# * Added -dSAFER to default gs options
+# TL2009 wants to use a restricted variant of -shell-escape,
+# allowing epstopdf to run. However without -dSAFER Ghostscript
+# allows writing to files (other than given in -sOutputFile)
+# and running commands (through Ghostscript pipe's language feature).
+# 2009/05/09 v2.9.10gw
+# * Changed cygwin name for ghostscript to gs
+# 2008/08/26 v2.9.9gw
+# * Switch to embed fonts (default=yes) (J.P. Chretien)
+# * turned no AutoRotatePages into an option (D. Kreil) (default = None)
+# * Added resolution switch (D. Kreil)
+# * Added BSD-style license
+# 2007/07/18 v2.9.8gw
+# 2007/05/18 v.2.9.7gw (Gerben Wierda)
+# * Merged both supplied 2.9.6 versions
+# 2007/05/15 v2.9.6tp (Theo Papadopoulo)
+# * Simplified the (atend) support
+# 2007/01/24 v2.9.6sw (Staszek Wawrykiewicz)
+# * patched to work also on Windows
+# 2005/10/06 v2.9.5gw (Gerben Wierda)
+# * Fixed a horrendous bug in the (atend) handling code
+# 2005/10/06 v2.9.4gw (Gerben Wierda)
+# * This has become the official version for now
+# 2005/10/01 v2.9.3draft (Gerben Wierda)
+# * Quote OutFilename
+# 2005/09/29 v2.9.2draft (Gerben Wierda)
+# * Quote OutFilename
+# 2004/03/17 v2.9.1draft (Gerben Wierda)
+# * No autorotate page
+# 2003/04/22 v2.9draft (Gerben Wierda)
+# * Fixed bug where with cr-eol files everything up to the first %!
+# * in the first 2048 bytes was gobbled (double ugh!)
+# 2002/02/21 v2.8draft (Gerben Wierda)
+# * Fixed bug where last line of buffer was not copied out (ugh!)
+# 2002/02/18 v2.8draft (Gerben Wierda)
+# * Handle different eol styles transparantly
+# * Applied fix from Peder Axensten for Freehand bug
+# 2001/03/05 v2.7 (Heiko Oberdiek)
+# * Newline before grestore for the case that there is no
+# whitespace at the end of the eps file.
+# 2000/11/05 v2.6 (Heiko Oberdiek)
+# * %%HiresBoundingBox corrected to %%HiResBoundingBox
+# 1999/05/06 v2.5 (Heiko Oberdiek)
+# * New options: --hires, --exact, --filter, --help.
+# * Many cosmetics: title, usage, ...
+# * New code for debug, warning, error
+# * Detecting of cygwin perl
+# * Scanning for %%{Hires,Exact,}BoundingBox.
+# * Scanning only the header in order not to get a wrong
+# BoundingBox of an included file.
+# * (atend) supported.
+# * uses strict; (earlier error detecting).
+# * changed first comment from '%!PS' to '%!';
+# * corrected (atend) pattern: '\s*\(atend\)'
+# * using of $bbxpat in all BoundingBox cases,
+# correct the first white space to '...Box:\s*$bb...'
+# * corrected first line (one line instead of two before 'if 0;';
+#
+# Thomas Esser, Sept. 1998: change initial lines to find
+# perl along $PATH rather than guessing a fixed location. The above
+# construction should work with most shells.
+#
+# Originally by Sebastian Rahtz, for Elsevier Science
+# with extra tricks from Hans Hagen's texutil and many more.
+# emacs-page
+
+### program identification
+my $program = "epstopdf";
+my $ident = '($Id: epstopdf.pl 16244 2009-11-30 01:36:08Z karl $) 2.12';
+my $copyright = <<END_COPYRIGHT ;
+Copyright 2009 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>
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+END_COPYRIGHT
+my $title = "$program $ident\n";
+
+### ghostscript command name
+my $GS = "gs";
+$GS = "gswin32c" if $^O eq 'MSWin32';
+
+### restricted mode
+my $restricted = 0;
+$restricted = 1 if $0 =~ /repstopdf/;
+
+### options
+$::opt_outfile="";
+$::opt_compress=1;
+$::opt_debug=0;
+$::opt_embed=1;
+$::opt_exact=0;
+$::opt_filter=0;
+$::opt_gs=1;
+$::opt_hires=0;
+$::opt_gscmd="";
+$::opt_res=0;
+$::opt_autorotate="None";
+
+### usage
+my @bool = ("false", "true");
+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]
+
+Convert EPS to PDF, by default using Ghostscript.
+
+Options:
+ --help display this help and exit
+ --version display version information and exit
+
+ --outfile=FILE write result to FILE
+ --(no)compress use compression (default: $bool[$::opt_compress])
+ --(no)debug write debugging info (default: $bool[$::opt_debug])
+ --(no)embed embed fonts (default: $bool[$::opt_embed])
+ --(no)exact scan ExactBoundingBox (default: $bool[$::opt_exact])
+ --(no)filter read standard input (default: $bool[$::opt_filter])
+ --(no)gs run ghostscript (default: $bool[$::opt_gs])
+ --(no)hires scan HiResBoundingBox (default: $bool[$::opt_hires])
+ --gscmd=VAL pipe output to VAL (default: $GS)
+ --res=DPI set image resolution (default: $resmsg)
+ --autorotate=VAL set AutoRotatePages (default: $rotmsg)
+ Recognized VAL choices: None, All, PageByPage
+ For EPS files, PageByPage is equivalent to All
+ --restricted use restricted mode (default: $bool[$restricted])
+
+Examples for producing 'test.pdf':
+ * $program test.eps
+ * produce postscript | $program --filter >test.pdf
+ * produce postscript | $program -f -d -o=test.pdf
+
+Example: look for HiResBoundingBox and produce corrected PostScript:
+ * $program -d --nogs --hires test.ps >testcorr.ps
+
+When reporting bugs, please include an input file and command line
+options so the problem can be reproduced.
+
+Report bugs to: tex-k\@tug.org
+epstopdf home page: <http://tug.org/epstopdf/>
+END_OF_USAGE
+
+### process options
+use Getopt::Long;
+GetOptions (
+ "help",
+ "version",
+ "outfile=s", # \ref{openout_any}
+ "compress!",
+ "debug!",
+ "embed!",
+ "exact!",
+ "filter!",
+ "gs!",
+ "hires!",
+ "gscmd=s", # \ref{val_gscmd}
+ "res=i", # validated by Getopt ('i' specifier)
+ "autorotate=s", # \ref{val_autorotate}
+ "restricted",
+) or die $usage;
+
+### 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 "$usage\n!!! Error: @_\n";
+}
+
+### restricted option
+$restricted = 1 if $::opt_restricted;
+debug "Restricted mode activated" if $restricted;
+
+### help, version options.
+if ($::opt_help) {
+ print $usage;
+ exit (0);
+}
+
+if ($::opt_version) {
+ print $title;
+ print $copyright;
+ exit (0);
+}
+
+### get input filename
+my $InputFilename = "";
+if ($::opt_filter) {
+ @ARGV == 0 or
+ die errorUsage "Input file cannot be used with filter option";
+ debug "Filtering: will read standard input";
+} else {
+ @ARGV > 0 or die errorUsage "Input filename missing";
+ @ARGV < 2 or die errorUsage "Unknown option or too many input files";
+ $InputFilename = $ARGV[0];
+ #-r $InputFilename or error "\"$InputFilename\" not readable";
+ debug "Input filename:", $InputFilename;
+}
+
+### option gscmd
+if ($::opt_gscmd) {
+ debug "Switching from $GS to $::opt_gscmd";
+ $GS = $::opt_gscmd;
+ # validate GS \label{val_gscmd}
+ if ($restricted) {
+ $GS =~ /^(gs|mgs|gswin32c|gs386|gsos2)\z/
+ or $GS =~ /^gs[\-_]?(\d|\d[\.-_]?\d\d)c?\z/
+ or die error "Value of gscmd '$GS' not allowed in restricted mode.";
+ }
+}
+
+### start building GS command line for the pipe
+my @GS = ($GS);
+push @GS, qw(-q -dNOPAUSE -dSAFER -sDEVICE=pdfwrite);
+
+### option outfile
+my $OutputFilename = $::opt_outfile;
+if ($OutputFilename eq "") {
+ if ($::opt_gs) {
+ $OutputFilename = $InputFilename;
+ if (!$::opt_filter) {
+ my $ds = ($^O eq "MSWin32" || $^O eq "cygwin") ? '\\/' : '/';
+ $OutputFilename =~ s/\.[^\.$ds]*$//;
+ $OutputFilename .= ".pdf";
+ }
+ } else {
+ $OutputFilename = "-"; # no ghostscript, write to standard output
+ }
+}
+if ($::opt_filter) {
+ debug "Filtering: will write standard output";
+ $OutputFilename = "-";
+} else {
+ debug "Output filename:", $OutputFilename;
+}
+push @GS, "-sOutputFile=$OutputFilename";
+
+### options compress, embed, res, autorotate
+push @GS, ('-dPDFSETTINGS=/prepress', '-dMaxSubsetPct=100',
+ '-dSubsetFonts=true', '-dEmbedAllFonts=true') if $::opt_embed;
+push @GS, '-dUseFlateCompression=false' unless $::opt_compress;
+push @GS, "-r$::opt_res" if $::opt_res;
+$resmsg= $::opt_res ? $::opt_res : "[use gs default]";
+push @GS, "-dAutoRotatePages=/$::opt_autorotate" if $::opt_autorotate;
+$rotmsg = $::opt_autorotate ? $::opt_autorotate : "[use gs default]";
+# \label{val_autorotate}
+error "Invalid value for autorotate: '$::opt_autorotate' "
+ . "(use 'All', 'None' or 'PageByPage')."
+ if ($::opt_autorotate and
+ not $::opt_autorotate =~ /^(None|All|PageByPage)\z/);
+
+### option BoundingBox types
+my $BBName = "%%BoundingBox:";
+!($::opt_hires and $::opt_exact) or
+ error "Options --hires and --exact cannot be used together";
+$BBName = "%%HiResBoundingBox:" if $::opt_hires;
+$BBName = "%%ExactBoundingBox:" if $::opt_exact;
+debug "BoundingBox comment:", $BBName;
+
+### validate output file name in restricted mode \label{openout_any}
+use File::Spec::Functions qw(splitpath file_name_is_absolute);
+if ($restricted) {
+ # use the equivalent of openout_any = p
+ # (see opennameok() web2c/lib/texmfmp.c)
+ # Well, for now, be even more paranoid: don't allow absolute path at all
+ my $ok = 1;
+ # disallow opening dot-files on Unix
+ unless ($^O eq "MSWin32") {
+ my ($drive, $path, $basename) = splitpath($OutputFilename);
+ $ok = 0 if $basename =~ /^\./;
+ }
+ # disallow absolute path
+ $ok = 0 if file_name_is_absolute($OutputFilename);
+ # disallow colon on Windows. It could be used either after a drive
+ # (like "a:dir\file") or for an alternate data stream (like
+ # "file:ads").
+ if ($^O eq "MSWin32" || $^O eq "cygwin") {
+ $ok = 0 if $OutputFilename =~ /:/;
+ }
+ # disallow going to parent directory
+ my $ds = ($^O eq "MSWin32" || $^O eq "cygwin") ? qr([\\/]) : qr(/);
+ $ok = 0 if $OutputFilename =~ /^\.\.$ds|$ds\.\.$ds/;
+ # we passed all tests
+ die error "Output filename '$OutputFilename' not allowed in restricted mode." unless $ok;
+}
+
+### option gs
+if ($::opt_gs) {
+ debug "Ghostscript command:", $GS;
+ debug "Compression:", ($::opt_compress) ? "on" : "off";
+ debug "Embedding:", ($::opt_embed) ? "on" : "off";
+ debug "Rotation:", $rotmsg;
+ debug "Resolution:", $resmsg;
+}
+
+### emacs-page
+### open input file
+if ($::opt_filter) {
+ open(IN, '<-') || error("Cannot open stdin: $!");
+} else {
+ open(IN, '<', $InputFilename) || error("Cannot open $InputFilename: $!");
+}
+binmode IN;
+
+### open output file
+my $outname; # used in error message at end
+my $tmp_filename; # temporary file for windows
+my $OUT; # filehandle for output (GS pipe or temporary file)
+use File::Temp 'tempfile';
+if ($::opt_gs) {
+ unless ($^O eq 'MSWin32' || $^O eq 'cygwin') { # list piped open works
+ push @GS, qw(- -c quit);
+ debug "Ghostscript pipe:", join(' ', @GS);
+ open($OUT, '|-', @GS) or error "Cannot open Ghostscript for piped input";
+ } else { # use a temporary file on Windows/Cygwin.
+ ($OUT, $tmp_filename) = tempfile(UNLINK => 1);
+ debug "Using temporary file '$tmp_filename'";
+ }
+ $outname = $GS;
+}
+else {
+ open($OUT, '>', $OutputFilename) or error "Cannot write \"$OutputFilename\"";
+ $outname = $OutputFilename;
+}
+binmode $OUT;
+
+# reading a cr-eol file on a lf-eol system makes it impossible to parse
+# the header and besides it will read the intire file into yor line by line
+# scalar. this is also true the other way around.
+
+### emacs-page
+### scan a block, try to determine eol style
+
+my $buf;
+my $buflen;
+my @bufarray;
+my $inputpos;
+
+# We assume 2048 is big enough.
+my $EOLSCANBUFSIZE = 2048;
+
+$buflen = read(IN, $buf, $EOLSCANBUFSIZE);
+if ($buflen > 0) {
+ my $crlfpos;
+ my $lfpos;
+ my $crpos;
+
+ $inputpos = 0;
+
+ # remove binary junk before header
+ # if there is no header, we assume the file starts with ascii style and
+ # we look for a eol style anyway, to prevent possible loading of the
+ # entire file
+ if ($buf =~ /%!/) {
+ # throw away binary junk before %!
+ $buf =~ s/(.*?)%!/%!/o;
+ $inputpos = length($1);
+ }
+ $lfpos = index($buf, "\n");
+ $crpos = index($buf, "\r");
+ $crlfpos = index($buf, "\r\n");
+
+ if ($crpos > 0 and ($lfpos == -1 or $lfpos > $crpos+1)) {
+ # The first eol was a cr and it was not immediately followed by a lf
+ $/ = "\r";
+ debug "The first eol character was a CR ($crpos) and not immediately followed by a LF ($lfpos)";
+ }
+
+ # Now we have set the correct eol-character. Get one more line and add
+ # it to our buffer. This will make the buffer contain an entire line
+ # at the end. Then split the buffer in an array. We will draw lines from
+ # that array until it is empty, then move again back to <IN>
+ $buf .= <IN> unless eof(IN);
+ $buflen = length($buf);
+
+ # Some extra magic is needed here: if we set $/ to \r, Perl's re engine
+ # still thinks eol is \n in regular expressions (not very nice) so we
+ # cannot split on ^, but have to split on a look-behind for \r.
+ if ($/ eq "\r") {
+ @bufarray = split(/(?<=\r)/ms, $buf); # split after \r
+ }
+ else {
+ @bufarray = split(/^/ms, $buf);
+ }
+}
+
+### getline
+sub getline
+{
+ if ($#bufarray >= 0) {
+ $_ = shift(@bufarray);
+ }
+ else {
+ $_ = <IN>;
+ }
+ $inputpos += length($_) if defined $_;
+ return defined($_);
+}
+
+### scan first line
+my $header = 0;
+getline();
+if (/%!/) {
+ # throw away binary junk before %!
+ s/(.*)%!/%!/o;
+}
+$header = 1 if /^%/;
+debug "Scanning header for BoundingBox";
+print $OUT $_;
+
+### variables and pattern for BoundingBox search
+my $bbxpatt = '[0-9eE\.\-]';
+ # protect backslashes: "\\" gets '\'
+my $BBValues = "\\s*($bbxpatt+)\\s+($bbxpatt+)\\s+($bbxpatt+)\\s+($bbxpatt+)";
+my $BBCorrected = 0;
+
+sub CorrectBoundingBox
+{
+ my ($llx, $lly, $urx, $ury) = @_;
+ debug "Old BoundingBox:", $llx, $lly, $urx, $ury;
+ my ($width, $height) = ($urx - $llx, $ury - $lly);
+ my ($xoffset, $yoffset) = (-$llx, -$lly);
+ debug "New BoundingBox: 0 0", $width, $height;
+ debug "Offset:", $xoffset, $yoffset;
+
+ print $OUT "%%BoundingBox: 0 0 $width $height$/";
+ print $OUT "<< /PageSize [$width $height] >> setpagedevice$/";
+ print $OUT "gsave $xoffset $yoffset translate$/";
+}
+
+### emacs-page
+### scan header
+if ($header) {
+ HEADER: while (getline()) {
+ ### Fix for freehand bug ### by Peder Axensten
+ next HEADER if(!/\S/);
+
+ ### end of header
+ if (!/^%/ or /^%%EndComments/) {
+ print $OUT $_;
+ last;
+ }
+
+ ### BoundingBox with values
+ if (/^$BBName$BBValues/o) {
+ CorrectBoundingBox $1, $2, $3, $4;
+ $BBCorrected = 1;
+ last;
+ }
+
+ ### BoundingBox with (atend)
+ if (/^$BBName\s*\(atend\)/) {
+ debug $BBName, "(atend)";
+ if ($::opt_filter) {
+ warning "Cannot look for BoundingBox in the trailer",
+ "with option --filter";
+ last;
+ }
+ my $pos = $inputpos;
+ debug "Current file position:", $pos;
+
+ # looking for %%BoundingBox
+ while (getline()) {
+ # skip over included documents
+ my $nestDepth = 0;
+ $nestDepth++ if /^%%BeginDocument/;
+ $nestDepth-- if /^%%EndDocument/;
+ if ($nestDepth == 0 && /^$BBName$BBValues/o) {
+ CorrectBoundingBox $1, $2, $3, $4;
+ $BBCorrected = 1;
+ last;
+ }
+ }
+
+ # go back
+ seek(IN, $pos, 0) or error "Cannot go back to line \"$BBName (atend)\"";
+ last;
+ }
+
+ # print header line
+ print $OUT $_;
+ }
+}
+
+### print rest of file
+while (getline()) {
+ print $OUT $_;
+}
+
+### emacs-page
+### close files
+close(IN);
+print $OUT "$/grestore$/" if $BBCorrected;
+close($OUT);
+
+### actually run GS if we were writing to a temporary file
+if (defined $tmp_filename) {
+ push @GS, $tmp_filename;
+ push @GS, qw(-c quit);
+ debug "Ghostscript command:", join(' ', @GS);
+ system @GS;
+}
+
+# if ghostscript exited badly, we should too.
+if ($? & 127) {
+ error(sprintf "Writing to $outname failed, signal %d\n", $? & 127);
+} elsif ($? != 0) {
+ error(sprintf "Writing to $outname failed, error code %d\n", $? >> 8);
+}
+
+warning "BoundingBox not found" unless $BBCorrected;
+debug "Done.";
diff --git a/office/texlive/texlive.SlackBuild b/office/texlive/texlive.SlackBuild
index bf9ccc0f71..39417bc760 100644..100755
--- a/office/texlive/texlive.SlackBuild
+++ b/office/texlive/texlive.SlackBuild
@@ -28,7 +28,7 @@
PRGNAM=texlive
VERSION=20091107
ARCH=${ARCH:-i486}
-BUILD=${BUILD:-2}
+BUILD=${BUILD:-3}
TAG=${TAG:-_SBo}
SOURCE_VERS=$VERSION
@@ -69,6 +69,9 @@ find . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
+# If on -current, uncomment this line:
+#patch -p1 < $CWD/texlive.png14.diff
+
# etex is something for eclipse
# Building with --disable-xindy as it requires libffcall
# "kpsewhich -var-value=SELFAUTOPARENT" strips two trailing directories
@@ -171,6 +174,14 @@ cp -a \
AUTHORS COPYING NEWS README TODO \
$PKG/usr/doc/texlive-$VERSION/texi2html-$TEXI2HTML
+# Now add epstopdf
+mkdir -p $PKG/usr/doc/texlive-$VERSION/eps2pdf
+cat $CWD/epstopdf/epstopdf.pl > $PKG/usr/share/texmf/bin/epstopdf
+cat $CWD/epstopdf/epstopdf.1 > $PKG/usr/share/texmf/doc/man/man1/epstopdf.1
+cat $CWD/epstopdf/epstopdf.pdf > $PKG/usr/doc/texlive-$VERSION/eps2pdf/epstopdf.pdf
+cat $CWD/epstopdf/README > $PKG/usr/doc/texlive-$VERSION/eps2pdf/README
+chmod 0755 $PKG/usr/share/texmf/bin/epstopdf
+
# Compress man pages
( cd $PKG/usr/share/texmf/doc/man || exit 1
find . -type f -name "Makefile" -exec rm -f {} \;
diff --git a/office/texlive/texlive.png14.diff b/office/texlive/texlive.png14.diff
new file mode 100644
index 0000000000..ab3c8cc092
--- /dev/null
+++ b/office/texlive/texlive.png14.diff
@@ -0,0 +1,60 @@
+diff -u -Nur texlive-20091107-source/libs/gd/gd-2.0.35/gd_png.c texlive-20091107-source.fixed/libs/gd/gd-2.0.35/gd_png.c
+--- texlive-20091107-source/libs/gd/gd-2.0.35/gd_png.c 2009-03-20 10:58:16.000000000 +0300
++++ texlive-20091107-source.fixed/libs/gd/gd-2.0.35/gd_png.c 2010-03-05 10:17:14.350872597 +0300
+@@ -149,7 +149,7 @@
+ return NULL;
+ }
+
+- if (!png_check_sig (sig, 8)) { /* bad signature */
++ if (!(png_sig_cmp(sig, 0, 8) == 0)) { /* bad signature */
+ return NULL; /* bad signature */
+ }
+
+diff -u -Nur texlive-20091107-source/texk/dvipdfmx/src/pngimage.c texlive-20091107-source.fixed/texk/dvipdfmx/src/pngimage.c
+--- texlive-20091107-source/texk/dvipdfmx/src/pngimage.c 2009-05-26 03:12:24.000000000 +0400
++++ texlive-20091107-source.fixed/texk/dvipdfmx/src/pngimage.c 2010-03-05 10:12:39.976897269 +0300
+@@ -148,7 +148,7 @@
+ rewind (png_file);
+ if (fread (sigbytes, 1, sizeof(sigbytes), png_file) !=
+ sizeof(sigbytes) ||
+- (!png_check_sig (sigbytes, sizeof(sigbytes))))
++ (!(png_sig_cmp(sigbytes, 0, sizeof(sigbytes)) == 0)))
+ return 0;
+ else
+ return 1;
+diff -u -Nur texlive-20091107-source/texk/web2c/xetexdir/pngimage.c texlive-20091107-source.fixed/texk/web2c/xetexdir/pngimage.c
+--- texlive-20091107-source/texk/web2c/xetexdir/pngimage.c 2006-07-26 20:19:45.000000000 +0400
++++ texlive-20091107-source.fixed/texk/web2c/xetexdir/pngimage.c 2010-03-05 10:15:45.010872612 +0300
+@@ -101,7 +101,7 @@
+ rewind (png_file);
+ if (fread (sigbytes, 1, sizeof(sigbytes), png_file) !=
+ sizeof(sigbytes) ||
+- (!png_check_sig (sigbytes, sizeof(sigbytes))))
++ (!(png_sig_cmp(sigbytes, 0, sizeof(sigbytes)) == 0)))
+ return 0;
+ else
+ return 1;
+diff -u -Nur texlive-20091107-source/texk/xdvipdfmx/src/pngimage.c texlive-20091107-source.fixed/texk/xdvipdfmx/src/pngimage.c
+--- texlive-20091107-source/texk/xdvipdfmx/src/pngimage.c 2007-11-22 19:48:06.000000000 +0300
++++ texlive-20091107-source.fixed/texk/xdvipdfmx/src/pngimage.c 2010-03-05 10:37:12.920343277 +0300
+@@ -146,7 +146,7 @@
+ rewind (png_file);
+ if (fread (sigbytes, 1, sizeof(sigbytes), png_file) !=
+ sizeof(sigbytes) ||
+- (!png_check_sig (sigbytes, sizeof(sigbytes))))
++ (!(png_sig_cmp(sigbytes, 0, sizeof(sigbytes)) == 0)))
+ return 0;
+ else
+ return 1;
+diff -u -Nur texlive-20091107-source/texk/xdvipdfmx/src/xbb.c texlive-20091107-source.fixed/texk/xdvipdfmx/src/xbb.c
+--- texlive-20091107-source/texk/xdvipdfmx/src/xbb.c 2008-05-25 19:00:35.000000000 +0400
++++ texlive-20091107-source.fixed/texk/xdvipdfmx/src/xbb.c 2010-03-05 10:15:23.713902927 +0300
+@@ -246,7 +246,7 @@
+ unsigned char sigbytes[4];
+ rewind (png_file);
+ if (fread(sigbytes, 1, sizeof(sigbytes), png_file) != sizeof(sigbytes) ||
+- (!png_check_sig (sigbytes, sizeof(sigbytes)))) return 0;
++ (!(png_sig_cmp(sigbytes, 0, sizeof(sigbytes)) == 0))) return 0;
+ else return 1;
+ }
+