[Reproducible-commits] [texlive-bin] 05/400: include and update patches for texlive 2012 from 2009

Maria Valentina Marin Rodrigues akira-guest at moszumanska.debian.org
Thu Jul 9 21:39:29 UTC 2015


This is an automated email from the git hooks/post-receive script.

akira-guest pushed a commit to branch master
in repository texlive-bin.

commit 7e22228d98b86a0319729cef00aba55acca97c1e
Author: Norbert Preining <preining at debian.org>
Date:   Fri Feb 17 02:17:03 2012 +0000

    include and update patches for texlive 2012 from 2009
---
 debian/changelog                                   |  19 +-
 debian/man-pages/bibtex8.1                         |  92 ++++
 debian/man-pages/devnag.1                          |  35 ++
 debian/man-pages/etex.1                            | 434 +++++++++++++++++
 debian/man-pages/omfonts.1                         |  14 +
 debian/man-pages/otangle.1                         | 147 ++++++
 debian/man-pages/pdfopen.1                         |  49 ++
 debian/man-pages/synctex.5                         | 310 ++++++++++++
 debian/man-pages/texconfig-dialog.1                |   9 +
 debian/patches/12_fix_epstopdf_invocation          |  21 +
 debian/patches/12a_fix_thumbpdf_invocation         |  19 +
 debian/patches/12b_fix_a2ping_invocation           |  29 ++
 debian/patches/12c_fix_pdfcrop_invocation          |  19 +
 debian/patches/12e_fix_vpe_invocation              |  15 +
 debian/patches/17_texdoc                           |  33 ++
 debian/patches/23_use_xdvi.bin                     |  22 +
 debian/patches/30_libpoppler_0.10                  | 513 ++++++++++++++++++++
 debian/patches/30_libpoppler_0.4.5                 | 440 +++++++++++++++++
 debian/patches/30_libpoppler_0.5.9                 | 454 ++++++++++++++++++
 debian/patches/41_maketexmf                        |  43 ++
 debian/patches/50_fmtutil_deb                      | 103 ++++
 debian/patches/51_fmtutil_keep_failedlog           |  26 +
 debian/patches/52_feynmf-perl-sec-fix              |  31 ++
 debian/patches/53_builtin-searchpath-fix           |  56 +++
 debian/patches/55_texconfig_stuff                  | 179 +++++++
 debian/patches/56_updmap_deb                       | 143 ++++++
 .../patches/57_texconfig_papersizes_for_upstream   | 524 +++++++++++++++++++++
 debian/patches/58_texconfig_papersizes_use_ucf     | 203 ++++++++
 debian/patches/60_unneeded_linking                 |  17 +
 debian/patches/73_tex_segfault                     |  22 +
 debian/patches/cve-2010-0739.patch                 |  17 +
 debian/patches/cve-2010-0827.patch                 |  28 ++
 debian/patches/cve-2010-1440                       |  43 ++
 debian/patches/detex-hurd.diff                     |  22 +
 debian/patches/fix-mpost-segfault                  |  17 +
 debian/patches/fmtutil-fix-infinite-loop_upstream  |  30 ++
 debian/patches/icu-xetex_hurd.diff                 | 104 ++++
 debian/patches/libpoppler-0.12                     |  41 ++
 debian/patches/partial_lfs_support.diff            |  12 +
 debian/patches/series                              |  42 ++
 debian/patches/set-e-in-various-scripts            | 148 ++++++
 .../patches/unstymie-xetex-with-zlib-1.2.6.patch   |  19 +
 debian/patches/upstream-tex-file_arg-passing-fix   |  70 +++
 debian/patches/upstream-web2c-tmpfilewithpid       |  33 ++
 debian/patches/xdvik-22.84.16-open-mode.patch      |  12 +
 45 files changed, 4656 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index d427223..397799d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,15 +1,28 @@
-texlive-bin (2011.20120202-0.1) unreleased; urgency=low
+texlive-bin (2011.20120216-0.1) unreleased; urgency=low
 
   * first trial
 
  -- Norbert Preining <preining at debian.org>  Thu, 02 Feb 2012 21:51:14 +0900
 
-texlive-bin (2009-12~1) unreleased; urgency=low
+texlive-bin (2009-12) unstable; urgency=low
 
+  [ Frank Küster ]
   * Make the error message more user-friendly when texconfig encounters
     strange paper size definitions in config.ps (closes: #636328)
 
- -- Frank Küster <frank at debian.org>  Sat, 05 Nov 2011 22:03:03 +0100
+  [ Hilmar Preuße ]
+  * Do not declare an versioned B-D for g++ on armel (Closes: #654746)
+  * Install manual page for vlna in /usr/share/man/cs/man1
+    (Closes: #597218)
+
+  [ Norbert Preining ]
+  * include fix for xetex breakage to backward incompatible zlib change
+    change build dependency to depend on zlib1g-dev with version, and
+    remove the alternative zlib-dev build dep
+    (Closes: #659680)
+  * bump standards version to 3.9.2, no changes necessary
+
+ -- Norbert Preining <preining at debian.org>  Tue, 14 Feb 2012 08:24:30 +0900
 
 texlive-bin (2009-11) unstable; urgency=low
 
diff --git a/debian/man-pages/bibtex8.1 b/debian/man-pages/bibtex8.1
new file mode 100644
index 0000000..f7d0faf
--- /dev/null
+++ b/debian/man-pages/bibtex8.1
@@ -0,0 +1,92 @@
+.TH BIBTEX8 "1" "April 2006" "bibtex8 3.71" "User Commands"
+.SH NAME
+bibtex8 \- 8-bit Big BibTeX version 0.99c
+.SH SYNOPSIS
+.B bibtex8
+[\fIoptions\fR] \fIaux-file\fR
+.SH DESCRIPTION
+.PP
+8-bit BibTeX is an enhanced, portable C version of BibTeX 0.99.  It has been
+enhanced in these areas:
+.PP
+- conversion to "big" (32-bit) capacity
+.PP
+- capacity selectable at run time
+.PP
+- flexible support for non-English languages using 8-bit character sets
+.PP
+- well matched to LateX2e and its "inputenc" package
+.PP
+Oren Patashnik, the creator of BibTeX, is working on a new BibTeX 1.0 that
+will be a modern implementation supporting large capacities and non-English
+languages (see TUGboat, pages 269--274, volume 15, number 3, September 1994).
+He is content for this version to be released, but hopes that people will
+eventually migrate to BibTeX 1.0 when it is released.  Its release date is
+uncertain at the moment.
+.SH OPTIONS
+.TP
+\-?  \fB\-\-help\fR
+display this help text
+.TP
+\fB\-7\fR  \fB\-\-traditional\fR
+operate in the original 7\-bit mode
+.TP
+\fB\-8\fR  \fB\-\-8bit\fR
+force 8\-bit mode, no CS file used
+.TP
+\fB\-c\fR  \fB\-\-csfile\fR FILE
+read FILE as the BibTeX character set
+and sort definition file
+.TP
+\fB\-d\fR  \fB\-\-debug\fR TYPE
+report debugging information.  TYPE is one
+or more of all, csf, io, mem, misc, search.
+.TP
+\fB\-s\fR  \fB\-\-statistics\fR
+report internal statistics
+.TP
+\fB\-t\fR  \fB\-\-trace\fR
+report execution tracing
+.TP
+\fB\-v\fR  \fB\-\-version\fR
+report BibTeX version
+.TP
+\fB\-B\fR  \fB\-\-big\fR
+set large BibTeX capacity
+.TP
+\fB\-H\fR  \fB\-\-huge\fR
+set huge BibTeX capacity
+.TP
+\fB\-W\fR  \fB\-\-wolfgang\fR
+set really huge BibTeX capacity for Wolfgang
+.TP
+\fB\-M\fR  \fB\-\-min_crossrefs\fR ##
+set min_crossrefs to ##
+.TP
+\fB\-\-mcites\fR ##
+allow ## \ecites in the .aux files
+.TP
+\fB\-\-mentints\fR ##
+allow ## integer entries in the .bib databases
+.TP
+\fB\-\-mentstrs\fR ##
+allow ## string entries in the .bib databases
+.TP
+\fB\-\-mfields\fR ##
+allow ## fields in the .bib databases
+.TP
+\fB\-\-mpool\fR ##
+set the string pool to ## bytes
+.TP
+\fB\-\-mstrings\fR ##
+allow ## unique strings
+.TP
+\fB\-\-mwizfuns\fR ##
+allow ## wizard functions
+.SH AUTHORS
+.B bibtex8 
+was written by Niel Kempson <kempson at snowyowl.co.uk> and
+Alejandro Aguilar-Sierra <asierra at servidor.unam.mx>. This manpage
+was written by Norbert Preining for Debian/GNU Linux and may be used,
+modified and/or distributed freely by anyone.
+
diff --git a/debian/man-pages/devnag.1 b/debian/man-pages/devnag.1
new file mode 100644
index 0000000..e730cf2
--- /dev/null
+++ b/debian/man-pages/devnag.1
@@ -0,0 +1,35 @@
+.TH DEVNAG "1" "April 2006" "devnag 2.13" "User Commands"
+.SH NAME
+devnag \- Devanagari for TeX preprocessor
+.SH SYNOPSIS
+.B devnag in[.dn] [out[.tex]]
+.SH DESCRIPTION
+.PP
+.B devnag
+is a preprocessor that reads transliterated Devanagari input delimited by
+\dn and converts it into a form with which TeX is familiar.
+.PP
+The preprocessor
+handles the details of character placement such as the alignment of
+vowel diacritics and consonant ligatures. The rest of the layout,
+however, must be managed by the user. 
+.PP
+For specification of the format please see the documentation accompanying
+the package.
+.SH OPTIONS
+.TP
+in[.dn] out[.tex]
+The default file extension for an input file is .dn and for an output
+file .tex. The output filename is optional. If an output filename is
+not specified, the preprocessor will name it after the input file.
+.TP
+\fB\-v\fR 
+report devnag version
+.SH AUTHORS
+.B devnag
+was written by Frans J. Velthuis <velthuis at rc.rug.nl> and is currently
+maintained by Zdenek Wagner <wagner at cesnet.cz>.
+This manpage
+was written by Norbert Preining for Debian/GNU Linux and may be used,
+modified and/or distributed freely by anyone.
+
diff --git a/debian/man-pages/etex.1 b/debian/man-pages/etex.1
new file mode 100644
index 0000000..dbecf32
--- /dev/null
+++ b/debian/man-pages/etex.1
@@ -0,0 +1,434 @@
+.TH ETEX 1 "7 January 2007" "pdftex 1.40" "Web2C 7.5.7"
+.\"=====================================================================
+.if n .ds MF Metafont
+.if t .ds MF M\s-2ETAFONT\s0
+.if t .ds TX \fRT\\h'-0.1667m'\\v'0.20v'E\\v'-0.20v'\\h'-0.125m'X\fP
+.if n .ds TX TeX
+.if n .ds MF Metafont
+.if t .ds MF M\s-2ETAFONT\s0
+.ie t .ds OX \fIT\v'+0.25m'E\v'-0.25m'X\fP for troff
+.el .ds OX TeX for nroff
+.\" the same but obliqued
+.\" BX definition must follow TX so BX can use TX
+.if t .ds BX \fRB\s-2IB\s0\fP\*(TX
+.if n .ds BX BibTeX
+.\" LX definition must follow TX so LX can use TX
+.if t .ds LX \fRL\\h'-0.36m'\\v'-0.15v'\s-2A\s0\\h'-0.15m'\\v'0.15v'\fP\*(TX
+.if n .ds LX LaTeX
+.if t .ds AX \fRA\\h'-0.1667m'\\v'0.20v'M\\v'-0.20v'\\h'-0.125m'S\fP\*(TX
+.if n .ds AX AmSTeX
+.if t .ds AY \fRA\\h'-0.1667m'\\v'0.20v'M\\v'-0.20v'\\h'-0.125m'S\fP\*(LX
+.if n .ds AY AmSLaTeX
+.\"=====================================================================
+.SH NAME
+etex, einitex, evirtex \- extended TeX
+.SH SYNOPSIS
+.B etex
+.RI [ options ]
+[\fB&\fR \fIformat\fR ]
+[ \fIfile\fR | \fB\e\fR \fIcommands\fR ]
+.\"=====================================================================
+.SH DESCRIPTION
+Run the e-\*(TX typesetter on
+.IR file ,
+usually creating
+.IR file.dvi .
+If the file argument has no extension, ".tex" will be appended to it. 
+Instead of a filename, a set of e-\*(TX commands can be given, the first
+of which must start with a backslash.
+With a 
+.BI & format
+argument e-\*(TX uses a different set of precompiled commands,
+contained in
+.IR format.fmt ;
+it is usually better to use the
+.B -fmt
+.I format
+option instead.
+.PP
+e-\*(TX is the first concrete result of an international research &
+development project, the NTS Project, which was established under the
+aegis of DANTE e.V. during 1992. The aims of the project are to
+perpetuate and develop the spirit and philosophy of \*(TX, whilst
+respecting Knuth's wish that \*(TX should remain frozen.
+.PP
+e-\*(TX can be used in two different modes: in
+.I compatibility mode
+it is supposed to be completely interchangable with standard \*(TX.
+In
+.I extended mode
+several new primitives are added that facilitate (among other things)
+bidirectional typesetting.
+.PP
+An extended mode format is generated by prefixing the name of the
+source file for the format with an asterisk (*).  Such formats are
+often prefixed with an `e', hence
+.B etex
+as the extended version of
+.B tex
+and
+.B elatex
+as the extended version of
+.BR latex .
+However,
+.B eplain
+is an exception to this rule.
+.PP
+The
+.B einitex
+and
+.B evirtex
+commands are e-\*(TX's analogues to the
+.B initex
+and
+.B virtex
+commands.  In this installation, they are symbolic links to the
+.B etex
+executable.  These symbolic links may not exist at all.
+.PP
+e-\*(TX's handling of its command-line arguments is similar to that of
+the other \*(TX programs in the
+.I web2c
+implementation.
+.\"=====================================================================
+.SH OPTIONS
+This version of e-\*(TX understands the following command line options.
+.TP
+.BI -fmt \ format
+.rb
+Use
+.I format
+as the name of the format to be used, instead of the name by which
+e-\*(TX was called or a
+.I %&
+line.
+.TP
+.B -enc
+.rb
+Enable the enc\*(TX extensions.  This option is only effective in
+combination with
+.BR -ini .
+For documentation of the enc\*(TX extensions see
+.BR http://www.olsak.net/enctex.html .
+.TP
+.B -etex
+.rb
+Enable the e-\*(TX extensions.  This option is only effective in
+combination with
+.BR -ini .
+.TP
+.B -file-line-error
+.rb
+Print error messages in the form
+.I file:line:error
+which is similar to the way many compilers format them.
+.TP
+.B -no-file-line-error
+.rb
+Disable printing error messages in the
+.I file:line:error
+style.
+.TP
+.B -file-line-error-style
+.rb
+This is the old name of the
+.B -file-line-error
+option.
+.TP
+.B -halt-on-error
+.rb
+Exit with an error code when an error is encountered during processing.
+.TP
+.B -help
+.rb
+Print help message and exit.
+.TP
+.B -ini
+.rb
+Start in
+.I INI
+mode, which is used to dump formats.  The
+.I INI
+mode can be used for typesetting, but no format is preloaded, and
+basic initializations like setting catcodes may be required.
+.TP
+.BI -interaction \ mode
+.rb
+Sets the interaction mode.  The mode can be either
+.IR batchmode ,
+.IR nonstopmode ,
+.IR scrollmode ,
+and
+.IR errorstopmode .
+The meaning of these modes is the same as that of the corresponding
+\ecommands.
+.TP
+.B -ipc
+.rb
+Send DVI output to a socket as well as the usual output file.  Whether
+this option is available is the choice of the installer.
+.TP
+.B -ipc-start
+.rb
+As
+.BR -ipc ,
+and starts the server at the other end as well.  Whether this option
+is available is the choice of the installer.
+.TP
+.BI -jobname \ name
+.rb
+Use
+.I name
+for the job name, instead of deriving it from the name of the input file.
+.TP
+.BI -kpathsea-debug \ bitmask
+.rb
+Sets path searching debugging flags according to the bitmask.  See the
+.I Kpathsea
+manual for details.
+.TP
+.BI -mktex \ fmt
+.rb
+Enable
+.RI mktex fmt ,
+where
+.I fmt
+must be either
+.I tex
+or
+.IR tfm .
+.TP
+.B -mltex
+.rb
+Enable ML\*(TX extensions.  Only effective in combination with
+.BR -ini .
+.TP
+.BI -no-mktex \ fmt
+.rb
+Disable
+.RI mktex fmt ,
+where
+.I fmt
+must be either
+.I tex
+or
+.IR tfm .
+.TP
+.BI -output-comment \ string
+.rb
+Use
+.I string
+for the
+.I DVI
+file comment instead of the date.
+.TP
+.BI -output-directory \ directory
+.rb Write output files in
+.I directory
+instead of the current directory.  Look up input files in
+.I directory
+first, the along the normal search path.
+.TP
+.B -parse-first-line
+.rb
+If the first line of the main input file begins with
+.I %&
+parse it to look for a dump name or a
+.B -translate-file
+option.
+.TP
+.B -no-parse-first-line
+.rb
+Disable parsing of the first line of the main input file.
+.TP
+.BI -progname \ name
+.rb
+Pretend to be program
+.IR name .
+This affects both the format used and the search paths.
+.TP
+.B -recorder
+.rb
+Enable the filename recorder.  This leaves a trace of the files opened
+for input and output in a file with extension
+.IR .fls .
+.TP
+.B -shell-escape
+.rb
+Enable the
+.BI \ewrite18{ command }
+construct.  The
+.I command
+can be any shell command.  This construct is normally
+disallowed for security reasons.
+.TP
+.B -no-shell-escape
+.rb
+Disable the
+.BI \ewrite18{ command }
+construct, even if it is enabled in the
+.I texmf.cnf
+file.
+.TP
+.B -src-specials
+.rb
+Insert source specials into the
+.I DVI
+file.
+.TP
+.BI -src-specials \ where
+.rb
+Insert source specials in certain placed of the
+.I DVI
+file.
+.I where
+is a comma-separated value list:
+.IR cr ,
+.IR display ,
+.IR hbox ,
+.IR math ,
+.IR par ,
+.IR parent ,
+or
+.IR vbox .
+.TP
+.BI -translate-file \ tcxname
+.rb
+Use the
+.I tcxname
+translation table to set the mapping of input characters and
+re-mapping of output characters.
+.TP
+.BI -default-translate-file \ tcxname
+.rb
+Like
+.B -translate-file
+except that a
+.I %&
+line can overrule this setting.
+.TP
+.B -version
+.rb
+Print version information and exit.
+.\"=====================================================================
+.SH ENVIRONMENT
+See the Kpathsearch library documentation (the `Path specifications'
+node) for precise details of how the environment variables are used.
+The
+.B kpsewhich
+utility can be used to query the values of the variables.
+.PP
+One caveat: In most e-\*(TX formats, you cannot use ~ in a filename you
+give directly to e-\*(TX, because ~ is an active character, and hence is
+expanded, not taken as part of the filename.  Other programs, such as
+\*(MF, do not have this problem.
+.PP
+.TP
+TEXMFOUTPUT
+Normally, e-\*(TX puts its output files in the current directory.  If
+any output file cannot be opened there, it tries to open it in the
+directory specified in the environment variable TEXMFOUTPUT.
+There is no default value for that variable.  For example, if you say
+.I etex paper
+and the current directory is not writable, if TEXMFOUTPUT has
+the value
+.IR /tmp ,
+e-\*(TX attempts to create
+.I /tmp/paper.log
+(and
+.IR /tmp/paper.dvi ,
+if any output is produced.)
+.TP
+TEXINPUTS
+Search path for
+.I \einput
+and
+.I \eopenin
+files.
+This should probably start with ``.'', so
+that user files are found before system files.  An empty path
+component will be replaced with the paths defined in the
+.I texmf.cnf
+file.  For example, set TEXINPUTS to ".:/home/usr/tex:" to prepend the
+current direcory and ``/home/user/tex'' to the standard search path.
+.TP
+TEXFORMATS
+Search path for format files.
+.TP
+TEXPOOL
+search path for
+.B etex
+internal strings.
+.TP
+TEXEDIT
+Command template for switching to editor.  The default, usually
+.BR vi ,
+is set when e-\*(TX is compiled.
+.TP
+TFMFONTS
+Search path for font metric
+.RI ( .tfm )
+files.
+.\"=====================================================================
+.SH FILES
+The location of the files mentioned below varies from system to
+system.  Use the
+.B kpsewhich
+utility to find their locations.
+.TP
+.I etex.pool
+Text file containing e-\*(TX's internal strings.
+.TP
+.I texfonts.map
+Filename mapping definitions.
+.TP
+.I *.tfm
+Metric files for e-\*(TX's fonts.
+.TP
+.I *.fmt
+Predigested e-\*(TX format (.\|fmt) files.
+.br
+.\"=====================================================================
+.SH NOTES
+Starting with version 1.40, pdf\*(TX incorporates the e-\*(TX
+extensions, so in this installation e\*(TX is just a symbolic link to
+pdf\*(TX.  See 
+.BR pdftex (1).
+This manual page is not meant to be exhaustive.  The complete
+documentation for this version of e-\*(TX can be found in the info
+manual
+.IR "Web2C: A TeX implementation" .
+.\"=====================================================================
+.SH BUGS
+This version of e-\*(TX implements a number of optional extensions.
+In fact, many of these extensions conflict to a greater or lesser
+extent with the definition of e-\*(TX.  When such extensions are
+enabled, the banner printed when e-\*(TX starts is changed to print
+.B e-TeXk
+instead of
+.BR e-TeX .
+.PP
+This version of e-\*(TX fails to trap arithmetic overflow when
+dimensions are added or subtracted.  Cases where this occurs are rare,
+but when it does the generated
+.I DVI
+file will be invalid.
+.\"=====================================================================
+.SH "SEE ALSO"
+.BR pdftex (1),
+.BR tex (1),
+.BR mf (1).
+.\"=====================================================================
+.SH AUTHORS
+e-\*(TX was developed by Peter Breitenlohner (and the NTS team).
+.PP
+\*(TX was designed by Donald E. Knuth,
+who implemented it using his \*(WB system for Pascal programs.
+It was ported to Unix at Stanford by Howard Trickey, and
+at Cornell by Pavel Curtis.
+The version now offered with the Unix \*(TX distribution is that
+generated by the \*(WB to C system
+.RB ( web2c ),
+originally written by Tomas Rokicki and Tim Morgan.
+.PP
+The enc\*(TX extensions were written by Petr Olsak.
diff --git a/debian/man-pages/omfonts.1 b/debian/man-pages/omfonts.1
new file mode 100644
index 0000000..d3b5a15
--- /dev/null
+++ b/debian/man-pages/omfonts.1
@@ -0,0 +1,14 @@
+.TH "omfonts" "1" "March 2006" "Omega" "Omega" 
+.PP 
+.SH "NAME" 
+omfonts \ - the driver program behind  ofm2opl, opl2ofm, ovf2ovp, and ovp2ovf.
+.PP 
+.SH "DESCRIPTION and SEE ALSO" 
+.PP 
+Please see the respective man pages of \fBofm2opl\fP(1), \fBopl2ofm\fP(1), 
+\fBovf2ovp\fP(1), and \fBovp2ovf\fP(1).
+.PP 
+.SH "AUTHOR" 
+.PP 
+This manual page was written by Norbert Preining <preining at logic.at>, for
+the Debian GNU/Linux system. It is too trivial to deserve special attention.
diff --git a/debian/man-pages/otangle.1 b/debian/man-pages/otangle.1
new file mode 100644
index 0000000..6177d14
--- /dev/null
+++ b/debian/man-pages/otangle.1
@@ -0,0 +1,147 @@
+.TH OTANGLE 1 "20 October 2002" "Web2C 7.5.5"
+.\"=====================================================================
+.if n .ds MF Metafont
+.if t .ds MF M\s-2ETAFONT\s0
+.if t .ds TX \fRT\\h'-0.1667m'\\v'0.20v'E\\v'-0.20v'\\h'-0.125m'X\fP
+.if n .ds TX TeX
+.ie t .ds OX \fIT\v'+0.25m'E\v'-0.25m'X\fP for troff
+.el .ds OX TeX for nroff
+.\" the same but obliqued
+.\" BX definition must follow TX so BX can use TX
+.if t .ds BX \fRB\s-2IB\s0\fP\*(TX
+.if n .ds BX BibTeX
+.\" LX definition must follow TX so LX can use TX
+.if t .ds LX \fRL\\h'-0.36m'\\v'-0.15v'\s-2A\s0\\h'-0.15m'\\v'0.15v'\fP\*(TX
+.if n .ds LX LaTeX
+.if n .ds WB Web
+.if t .ds WB W\s-2EB\s0
+.\"=====================================================================
+.SH NAME
+otangle \- translate WEB to Pascal
+.SH SYNOPSIS
+.B otangle
+[
+.RI options
+]
+.I webfile[.web]
+[
+.I changefile[.ch]
+]
+.\"=====================================================================
+.SH DESCRIPTION
+This manual page is not meant to be exhaustive.  The complete
+documentation for this version of \*(TX can be found in the info file
+or manual
+.IR "Web2C: A TeX implementation" .
+.PP
+The
+.B otangle
+program converts a \*(WB
+source document into a Pascal program that may be compiled in the usual
+way with the on-line Pascal compiler (e.g.,
+.BR pc (1)).
+The output file is packed into lines of 72 characters or less, with
+the only concession to readability being the termination of lines at
+semicolons when this can be done conveniently.
+.PP
+The \*(WB language allows you to prepare a single document containing all
+the information that is needed both to produce a compilable Pascal
+program and to produce a well-formatted document describing the program
+in as much detail as the writer may desire.  The user of \*(WB must be
+familiar with both \*(TX and Pascal.  \*(WB also provides a relatively
+simple, although adequate, macro facility that permits a Pascal program
+to be written in small easily-understood modules.
+.PP
+The command line should have either one or two names on it.
+The first is taken as the \*(WB file (and
+.I .web
+is added if there is no
+extension).
+If there is another name, it is a change file (and
+.I .ch
+is added if there is
+no extension).  The change file overrides parts of the \*(WB file,
+as described in the \*(WB system documentation.
+.PP
+The output files are a Pascal file and a string pool file,
+whose names are formed by adding
+.I .p
+and
+.I .pool
+respectively to the root of the \*(WB file name.
+.\"=====================================================================
+.SH "OPTIONS"
+This version of
+.B otangle
+understands the following options.  Note that some of these options
+may render the output unsuitable for processing by a Pascal compiler.
+.TP
+.B --help
+.rb
+Print help message and exit.
+.TP
+.B --version
+.rb
+Print version information and exit.
+.\"=====================================================================
+.SH "SEE ALSO"
+.BR pc (1),
+.BR pxp (1)
+(for formatting
+.B otangle
+output when debugging),
+.BR tex (1).
+.PP
+Donald E. Knuth,
+.IR "The \*(WB System of Structured Documentation" .
+.PP
+Donald E. Knuth,
+.IR "Literate Programming" ,
+Computer Journal
+.BR 27 ,
+97\-111, 1984.
+.PP
+Wayne Sewell,
+.IR "Weaving a Program" ,
+Van Nostrand Reinhold, 1989, ISBN 0-442-31946-0.
+.PP
+Donald E. Knuth,
+.I "\*(OX: The Program"
+(Volume B of
+.IR "Computers and Typesetting" ),
+Addison-Wesley, 1986, ISBN 0-201-13437-3.
+.PP
+Donald E. Knuth,
+.I "\*(MF: The Program"
+(Volume D of
+.IR "Computers and Typesetting" ),
+Addison-Wesley, 1986, ISBN 0-201-13438-1.
+.PP
+These last two are by far the largest extant examples of \*(WB
+programs.
+.PP
+There is an active Internet electronic mail discussion list on the
+subject of literate programming; send a subscription request to
+.I litprog-request at shsu.edu
+to join.
+.\"=====================================================================
+.SH AUTHORS
+\*(WB was designed by Donald E. Knuth, based on an earlier system
+called DOC (implemented by Ignacio Zabala).
+The
+.B tangle
+and
+.B weave
+programs are themselves written in \*(WB. The system
+was originally ported to Unix at Stanford by Howard Trickey, and at
+Cornell by Pavel Curtis.
+.PP
+.B otangle 
+incorporates extensions for Omega, and is written by 
+John Plaice and Yannis Haralambous.
+.PP
+This manpage has
+been written by Norbert Preining for Debian/GNU Linux by adapting the
+man page for tangle and may be used, modified and/or distributed freely 
+by anyone.
+
diff --git a/debian/man-pages/pdfopen.1 b/debian/man-pages/pdfopen.1
new file mode 100644
index 0000000..863037b
--- /dev/null
+++ b/debian/man-pages/pdfopen.1
@@ -0,0 +1,49 @@
+.TH PDFOPEN "1" "April 2006" "pdfopen 0.4: Acrobat Reader remote control" "User Commands"
+.SH NAME
+pdfopen, pdfclose \- manual page for pdfopen 0.4: Acrobat Reader remote control
+.SH DESCRIPTION
+.B pdfopen
+and
+.B pdfclose
+can be used to control a running instance of Acrobat Reader.
+.IP
+pdfopen [\-\-file 
+.I <pdfname>
+]
+.IP
+pdfclose [\-\-file 
+.I <pdfname>
+]
+.PP
+Without argument, the 
+.B pdfopen
+program sends a "Ctrl\-<\-" to an existing X window with the name
+.B Acrobat Reader,
+and "Alt-<-" to a window with the name 
+.B AdobeReader,
+if such windows exist.
+.B pdfclose
+sends a "Ctrl\-w" instead.
+.SH OPTIONS
+.TP
+\-\-file <pdfname>
+With this argument,
+.B pdfclose
+closes an existing window with the name <pdfname>, and
+.B pdfopen
+opens a window with the name <pdfname> (starting a reader if
+necesary), or it reloads <pdfname> if it was already open.
+.TP
+--all,--page
+These arguments, accepted by Fabrice Popineau's Windows originals of
+.B pdfopen
+and
+.B pdfclose,
+are silently ignored.
+.SH AUTHORS
+.B pdfopen
+and
+.B pdfclose
+are written by Taco Hoekwater <taco at metatex.org>.  This manpage has
+been written by Frank K\[:u]ster for Debian/GNU Linux and may be used,
+modified and/or distributed freely by anyone.
diff --git a/debian/man-pages/synctex.5 b/debian/man-pages/synctex.5
new file mode 100644
index 0000000..128bdce
--- /dev/null
+++ b/debian/man-pages/synctex.5
@@ -0,0 +1,310 @@
+.Dd May 11, 2008
+.Dt SYNCTEX 5
+.Os "Independant"
+.\"
+.\"
+.Sh NAME
+.Nm synctex
+.Nd Synchronize TeXnology help file
+.\"
+.\"
+.Sh DESCRIPTION
+Synchronize TeXnology help file
+.Pq synctexs
+are text files that help input/output synchronization during document preparation with the TeX typesetting system.
+.Sh BASICS
+The structure of this file should not be considered public, in the sense that no one should need to parse its contents, except the synctex command line utility, and the synctex_parser library.
+Unless it is absolutely not avoidable, access to the contents of the synctex file should only be made through requests made to the synctex command line utility.
+.\"
+.Sh STRUCTURE
+The element structure of a synctex file is a list of text line records as follows.
+.Sq \&* ,
+.Sq \&+ ,
+and
+.Sq \&?
+have their usual EBNF meanings:
+.Sq \&*
+means zero or more,
+.Sq \&+
+means one or more, and
+.Sq \&?
+means zero or one
+.Pq i.e., optional .
+.Pp
+.Bl -item -offset indent
+.\"
+.It
+.Li <SyncTeX> ::=
+.Pq The whole contents in 4 sections
+.Bl -item -offset indent
+.It
+.Li <Preamble>
+.It
+.Li <Content>
+.It
+.Li <Postamble>
+.It
+.Li <Post Scriptum>
+.El
+.\"
+.El
+.Pp
+Each section starts with the first occurrence of a sectioning line, and ends with the next section, if any.
+In the following definitions, we do not mention the section ending condition.
+.Sh The preamble
+.Bl -item -offset indent
+.\"
+.It
+.Li <Preamble> ::=
+.Bl -item -offset indent
+.It
+.Li Qq SyncTeX Version:
+<Version Number> <EOL>
+.It
+.Li <Input Line>*
+.It
+.Li Qq Magnification:
+<TeX magnification> <EOL>
+.It
+.Li Qq Unit:
+<unit in scaled point> <EOL>
+.It
+.Li Qq X Offset:
+<horizontal offset in scaled point> <EOL>
+.It
+.Li Qq Y Offset:
+<vertical offset in scaled point> <EOL>
+.El
+.It
+.Li <Input Line> ::= 
+.Qq Input:
+<tag>
+.Qq \&:
+<File Name> <EOL>
+.\"
+.El
+.Sh The content
+.Bl -item -offset indent
+.It
+.Li <Content> ::=
+.Bl -item -offset indent
+.It
+.Li <byte offset record>
+.It
+.Li Qq Content:
+<EOL>
+.It
+.Li <sheet(1)>
+.It
+.Li <Input Line>*
+.It
+.Li <sheet(2)>
+.It
+.Li <Input Line>*
+.It
+.Li ...
+.It
+.Li <sheet(N)>
+.It
+.Li <Input Line>*
+.El
+.It
+.Li <byte offset record> ::=
+.Qq \&!
+<byte offset> <end of record>
+.Pp
+.El
+.Pp
+.Bl -item -offset indent
+.It
+.Li <sheet(n)> ::=
+.Bl -item -offset indent
+.It
+.Li <byte offset record>
+.It
+.Li Qq \&{
+<the integer n> <end of record>/
+.It
+.Li <box content>*
+.It
+.Li <byte offset record>
+.It
+.Li Qq \&}
+<the integer n> <end of record>
+.El
+.El
+.Pp
+The <box content> describes what is inside a box.
+It is either a vertical or horizontal box,
+with some records related to glue, kern or math nodes.
+.Bl -item -offset indent
+.It
+.Li <box content> ::=
+.Bl -item -offset indent
+.It
+.Li <vbox section>|<hbox section>
+.It
+.Li |<void vbox record>|<void hbox record>
+.It
+.Li |<current record>|<glue record>|<kern record>|<math record>
+.El
+.It
+.Li <vbox section> ::=
+.Bl -item -offset indent
+.It
+.Li Qq \&[
+<link>
+.Qq \&:
+<point>
+.Qq \&:
+<size> <end of record>
+.It
+.Li <box content>*
+.It
+.Li Qq \&]
+<end of record>
+.El
+.It
+.Li <hbox section> ::=
+.Bl -item -offset indent
+.It
+.Li Qq \&(
+<link>
+.Qq \&:
+<point>
+.Qq \&:
+<size> <end of record>
+.It
+.Li <box content>*
+.It
+.Li Qq \&)
+<end of record>
+.El
+.El
+.Pp
+Void boxes:
+.Bl -item -offset indent
+.It
+.Li <void vbox record> ::=
+.Qq v
+<link>
+.Qq \&:
+<point>
+.Qq \&:
+<size> <end of record>
+.It
+.Li <void hbox record> ::=
+.Qq h
+<link>
+.Qq \&:
+<point>
+.Qq \&:
+<size> <end of record>
+.It
+.Li <size> ::= <Width>
+.Qq \&,
+<Height>
+.Qq \&,
+<Depth>
+.It
+.Li <Width> ::= <integer>
+.It
+.Li <Height> ::= <integer>
+.It
+.Li <Depth> ::= <integer>
+.It
+.Li <link> ::= <tag>
+.Qq \&,
+<line>(
+.Qq \&,
+<column>)?
+.It
+.Li <line> ::= <integer>
+.It
+.Li <column> ::= <integer>
+.El
+.Pp
+The forthcoming records are basic one liners.
+.Bl -item -offset indent
+.It
+.Li <current record> ::=
+.Qq x
+<link>
+.Qq \&:
+<point> <end of record>
+.It
+.Li <kern record> ::=
+.Qq k
+<link>
+.Qq \&:
+<point>
+.Qq \&:
+<Width> <end of record>
+.It
+.Li <glue record> ::=
+.Qq g
+<link>
+.Qq \&:
+<point> <end of record>
+.It
+.Li <math record> ::=
+.Qq $
+<link>
+.Qq \&:
+<point> <end of record>
+.El
+.Pp
+.\" .Sx underline, .Dq double quotes, .Pq enclosed in parenthesis
+.Sh The postamble
+The postamble closes the file
+If there is no postamble, it means that the typesetting process did not end correctly.
+.Bl -item -offset indent
+.\"
+.It
+.Li <Postamble>::=
+.Bl -item -offset indent
+.It
+.Li <byte offset record>
+.It
+.Li Qq Count:
+<Number fo records> <EOL>
+.El
+.Sh The post scriptum
+The post scriptum contains material possibly added by 3rd parties.
+It allows to append some transformation (shift and magnify).
+Typically, one applies a dvi to pdf filter with offset options and magnification,
+then he appends the same options to the synctex file, for example
+.Bd -offset indent
+	synctex update -o foo.pdf -m 0.486 -x 9472573sp -y 13.3dd source.dvi
+.Ed
+.Bl -item -offset indent
+.\"
+.It
+.Li <Post Scriptum>::=
+.\"
+.Bl -item -offset indent
+.It
+.Li <byte offset record>
+.It
+.Li Qq Post Scriptum:
+<EOL>
+.It
+.Li Qq Magnification:
+<number> <EOL>
+.Pq Set additional magnification
+.It
+.Li Qq X Offset:
+<dimension> <EOL>
+.Pq Set horizontal offset
+.It
+.Li Qq Y Offset:
+<dimension> <EOL>
+.Pq Set vertical offset
+.El
+This second information will override the offset and magnification previously available in the preamble section.
+All the numbers are encoded using the decimal representation with "C" locale.
+.Sh USAGE
+.Pp
+The <current record> is used to compute the visible size of hbox's.
+The byte offset is an implicit anchor to navigate the synctex file from sheet to sheet.
+.
diff --git a/debian/man-pages/texconfig-dialog.1 b/debian/man-pages/texconfig-dialog.1
new file mode 100644
index 0000000..5788415
--- /dev/null
+++ b/debian/man-pages/texconfig-dialog.1
@@ -0,0 +1,9 @@
+.TH texconfig-dialog 1 "February 2005" "teTeX" "teTeX"
+.SH NAME
+texconfig-dialog \- helper program for texconfig and texconfig-sys
+.SH DESCRIPTION
+.I texconfig-dialog
+is a helper program for texconfig and texconfig-sys, see the respective
+man pages for details.
+.SH AUTHOR
+Thomas Esser <te at dbs.uni-hannover.de>
diff --git a/debian/patches/12_fix_epstopdf_invocation b/debian/patches/12_fix_epstopdf_invocation
new file mode 100755
index 0000000..bf30f59
--- /dev/null
+++ b/debian/patches/12_fix_epstopdf_invocation
@@ -0,0 +1,21 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 12_fix_epstopdf_invocation.dpatch  <preining at logic.at>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Fix invocation of epstopdf to get rid of magic
+
+ at DPATCH@
+ texk/texlive/linked_scripts/epstopdf/epstopdf.pl |    3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+Index: texlive-bin-2011.20120216/texk/texlive/linked_scripts/epstopdf/epstopdf.pl
+===================================================================
+--- texlive-bin-2011.20120216.orig/texk/texlive/linked_scripts/epstopdf/epstopdf.pl	2011-03-01 18:20:55.000000000 +0900
++++ texlive-bin-2011.20120216/texk/texlive/linked_scripts/epstopdf/epstopdf.pl	2012-02-17 10:35:21.030873107 +0900
+@@ -1,5 +1,4 @@
+-eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
+-  if 0;
++#!/usr/bin/perl
+ use strict;
+ 
+ # $Id: epstopdf.pl 18319 2010-05-17 16:34:21Z karl $
diff --git a/debian/patches/12a_fix_thumbpdf_invocation b/debian/patches/12a_fix_thumbpdf_invocation
new file mode 100644
index 0000000..cbcf7f4
--- /dev/null
+++ b/debian/patches/12a_fix_thumbpdf_invocation
@@ -0,0 +1,19 @@
+12a_fix_thumbpdf_invocation.dpatch  <preining at logic.at>
+Fix invocation of thumbpdf to get rid of magic
+---
+ texk/texlive/linked_scripts/thumbpdf/thumbpdf.pl |    5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+Index: texlive-bin-2009~svn13478/texk/texlive/linked_scripts/thumbpdf/thumbpdf.pl
+===================================================================
+--- texlive-bin-2009~svn13478.orig/texk/texlive/linked_scripts/thumbpdf/thumbpdf.pl	2009-05-26 11:00:08.000000000 +0200
++++ texlive-bin-2009~svn13478/texk/texlive/linked_scripts/thumbpdf/thumbpdf.pl	2009-05-27 22:16:27.000000000 +0200
+@@ -1,7 +1,4 @@
+-eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
+-  if 0;
+-use strict;
+-$^W=1; # turn warning on
++#!/usr/bin/perl -w
+ #
+ # thumbpdf.pl
+ #
diff --git a/debian/patches/12b_fix_a2ping_invocation b/debian/patches/12b_fix_a2ping_invocation
new file mode 100644
index 0000000..7a20f28
--- /dev/null
+++ b/debian/patches/12b_fix_a2ping_invocation
@@ -0,0 +1,29 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 12b_fix_a2ping_invocation.dpatch  <preining at logic.at>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Fix invocation of a2ping to get rid of magic
+
+ at DPATCH@
+---
+ texk/texlive/linked_scripts/a2ping/a2ping.pl |   10 ++--------
+ 1 file changed, 2 insertions(+), 8 deletions(-)
+
+Index: texlive-bin-2009~svn13478/texk/texlive/linked_scripts/a2ping/a2ping.pl
+===================================================================
+--- texlive-bin-2009~svn13478.orig/texk/texlive/linked_scripts/a2ping/a2ping.pl	2009-05-26 11:00:07.000000000 +0200
++++ texlive-bin-2009~svn13478/texk/texlive/linked_scripts/a2ping/a2ping.pl	2009-05-27 22:16:58.000000000 +0200
+@@ -1,11 +1,5 @@
+-#! /bin/sh
+-eval '(exit $?0)' && eval 'PERL_BADLANG=x;export PERL_BADLANG;: \
+-;exec perl -x -S -- "$0" ${1+"$@"};#'if 0;
+-eval 'setenv PERL_BADLANG x;exec perl -x -S -- "$0" $argv:q;#'.q+
+-#!perl -w
+-package Htex::a2ping;  $0=~/(.*)/s;unshift at INC,'.';do($1);die$@if$@;__END__+if !1;
+-# This Perl script was generated by JustLib2 at Wed Apr 23 09:14:13 2003.
+-# Don't touch/remove any lines above; http://www.inf.bme.hu/~pts/justlib
++#! /usr/bin/perl -w
++package Htex::a2ping;
+ #
+ # This program is free software, licensed under the GNU GPL, >=2.0.
+ # This software comes with absolutely NO WARRANTY. Use at your own risk!
diff --git a/debian/patches/12c_fix_pdfcrop_invocation b/debian/patches/12c_fix_pdfcrop_invocation
new file mode 100644
index 0000000..9f19955
--- /dev/null
+++ b/debian/patches/12c_fix_pdfcrop_invocation
@@ -0,0 +1,19 @@
+12c_fix_pdfcrop_invocation.dpatch  <preining at logic.at>
+Fix invocation of pdfcrop to get rid of magic
+---
+ texk/texlive/linked_scripts/pdfcrop/pdfcrop.pl |    4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+Index: texlive-bin-2009~svn13478/texk/texlive/linked_scripts/pdfcrop/pdfcrop.pl
+===================================================================
+--- texlive-bin-2009~svn13478.orig/texk/texlive/linked_scripts/pdfcrop/pdfcrop.pl	2009-05-26 11:00:08.000000000 +0200
++++ texlive-bin-2009~svn13478/texk/texlive/linked_scripts/pdfcrop/pdfcrop.pl	2009-05-27 22:17:17.000000000 +0200
+@@ -1,7 +1,5 @@
+-eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
+-  if 0;
++#!/usr/bin/perl -w
+ use strict;
+-$^W=1; # turn warning on
+ #
+ # pdfcrop.pl
+ #
diff --git a/debian/patches/12e_fix_vpe_invocation b/debian/patches/12e_fix_vpe_invocation
new file mode 100644
index 0000000..53dd776
--- /dev/null
+++ b/debian/patches/12e_fix_vpe_invocation
@@ -0,0 +1,15 @@
+---
+ texk/texlive/linked_scripts/vpe/vpe.pl |    3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+Index: texlive-bin-2009~svn13478/texk/texlive/linked_scripts/vpe/vpe.pl
+===================================================================
+--- texlive-bin-2009~svn13478.orig/texk/texlive/linked_scripts/vpe/vpe.pl	2009-05-26 11:00:06.000000000 +0200
++++ texlive-bin-2009~svn13478/texk/texlive/linked_scripts/vpe/vpe.pl	2009-05-27 22:18:41.000000000 +0200
+@@ -1,5 +1,4 @@
+-eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
+-  if 0;
++#!/usr/bin/perl -w
+ use strict;
+ #
+ # vpe.pl
diff --git a/debian/patches/17_texdoc b/debian/patches/17_texdoc
new file mode 100644
index 0000000..fa9fb2d
--- /dev/null
+++ b/debian/patches/17_texdoc
@@ -0,0 +1,33 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 17_texdoc.dpatch
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: texdoc should follow symlinks, and man pages, and sec fixes, from tetex
+
+ at DPATCH@
+ texk/texlive/linked_scripts/texdoc/texdoc.tlu |    5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+Index: texlive-bin-2009~svn13478/texk/texlive/linked_scripts/texdoc/texdoc.tlu
+===================================================================
+--- texlive-bin-2009~svn13478.orig/texk/texlive/linked_scripts/texdoc/texdoc.tlu	2009-05-26 11:00:08.000000000 +0200
++++ texlive-bin-2009~svn13478/texk/texlive/linked_scripts/texdoc/texdoc.tlu	2009-05-27 22:20:00.000000000 +0200
+@@ -6,6 +6,9 @@
+     Origial shell script by Thomas Esser, David Aspinall, and Simon Wilkinson.
+     Public domain.]]
+ --[[ Changelog
++  0.4-debian 2008-07
++  - set support_zipped to true [fk]
++
+   0.4 2008-07
+   - moved configuration from texmf.cnf to texdoc.cnf
+   - added an 'alias' feature
+@@ -77,7 +80,7 @@
+ -- everything  works for them (look for support_zipped in the code).
+ -- If you use this feature, please let us know: if nobody uses it,
+ -- we'll drop it at some point.
+-support_zipped = false
++support_zipped = true
+ 
+ 
+ -- BEGIN function definitions (till the 'END' mark)
diff --git a/debian/patches/23_use_xdvi.bin b/debian/patches/23_use_xdvi.bin
new file mode 100644
index 0000000..89cea9b
--- /dev/null
+++ b/debian/patches/23_use_xdvi.bin
@@ -0,0 +1,22 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 23_use_xdvi.bin.dpatch
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: use xdvi.bin as xdvi binary, which is handled via alternatives
+## DP: and not xdvi-xaw.real. The alternatives setting updates xdvi.bin
+## DP: to xdvi-xaw.real
+
+ at DPATCH@
+ texk/xdvik/xdvi-sh.in |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: texlive-bin-2009~svn13478/texk/xdvik/xdvi-sh.in
+===================================================================
+--- texlive-bin-2009~svn13478.orig/texk/xdvik/xdvi-sh.in	2009-05-26 10:59:48.000000000 +0200
++++ texlive-bin-2009~svn13478/texk/xdvik/xdvi-sh.in	2009-05-27 22:20:14.000000000 +0200
+@@ -50,4 +50,4 @@
+   XFILESEARCHPATH="$xdviapppath:${XFILESEARCHPATH-%D}"; export XFILESEARCHPATH
+ fi
+ 
+-exec @final_exec_name@ $NAMEOPT ${1+"$@"}
++exec xdvi.bin $NAMEOPT ${1+"$@"}
diff --git a/debian/patches/30_libpoppler_0.10 b/debian/patches/30_libpoppler_0.10
new file mode 100644
index 0000000..a914aac
--- /dev/null
+++ b/debian/patches/30_libpoppler_0.10
@@ -0,0 +1,513 @@
+# 30_libpoppler.dpatch
+#
+# use libpoppler instead of libxpdf in pdfetex and xetex
+# don't build pdftosrc as it needs libpoppler from experimental 
+
+ at DPATCH@
+ configure                           |    6 -
+ configure.in                        |    8 -
+ texk/web2c/pdftexdir/Makefile.in    |    7 +
+ texk/web2c/pdftexdir/depend.mk      |   58 ----------
+ texk/web2c/pdftexdir/pdftex.mk      |    9 +
+ texk/web2c/pdftexdir/pdftexextra.in |    2 
+ texk/web2c/pdftexdir/pdftoepdf.cc   |   41 +++----
+ texk/web2c/pdftexdir/pdftosrc.cc    |   39 +++---
+ texk/web2c/pdftexdir/utils.c        |    6 -
+ texk/web2c/xetexdir/XeTeX_ext.c     |    8 -
+ texk/web2c/xetexdir/pdfimage.cpp    |   26 +++-
+ texk/web2c/xetexdir/xetex.mk        |   12 +-
+ 12 files changed, 100 insertions(+), 122 deletions(-)
+
+Index: texlive-bin-2008.svn12198/texk/web2c/pdftexdir/depend.mk
+===================================================================
+--- texlive-bin-2008.svn12198.orig/texk/web2c/pdftexdir/depend.mk	2009-03-10 20:05:59.000000000 +0100
++++ texlive-bin-2008.svn12198/texk/web2c/pdftexdir/depend.mk	2009-03-10 20:06:13.000000000 +0100
+@@ -1,55 +1,5 @@
+-epdf.o: epdf.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
+- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h
+-mapfile.o: mapfile.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
+- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h
+-papersiz.o: papersiz.c ptexlib.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h
+-utils.o: utils.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
+- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h \
+- ../../../libs/zlib/zlib.h ../../../libs/zlib/zconf.h \
+- ../../../libs/md5/md5.h pdftexextra.h \
+- ../../../libs/obsdcompat/openbsd-compat.h
+-vfpacket.o: vfpacket.c ptexlib.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h
+-pkin.o: pkin.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
+- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h
+-writefont.o: writefont.c ../../../libs/xpdf/goo/gmem.h ptexlib.h \
+- ../pdftexd.h ../texmfmp.h ../cpascal.h ../config.h ../help.h \
+- ../texmfmem.h ../pdftexcoerce.h ptexmac.h
+-writet1.o: writet1.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
+- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h
+-writet3.o: writet3.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
+- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h
+-writezip.o: writezip.c ptexlib.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h ../../../libs/zlib/zlib.h ../../../libs/zlib/zconf.h
+-writeenc.o: writeenc.c ptexlib.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h
+-writettf.o: writettf.c ptexlib.h writettf.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h macnames.c
+-writejpg.o: writejpg.c ptexlib.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h image.h
+-writepng.o: writepng.c ptexlib.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h image.h
+-writeimg.o: writeimg.c ptexlib.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h image.h
+-pdftoepdf.o: pdftoepdf.cc ../../../libs/xpdf/xpdf/Object.h \
+- ../../../libs/xpdf/goo/gmem.h ../../../libs/xpdf/xpdf/Array.h \
+- ../../../libs/xpdf/xpdf/Dict.h ../../../libs/xpdf/xpdf/Stream.h \
+- ../../../libs/xpdf/xpdf/XRef.h ../../../libs/xpdf/xpdf/Catalog.h \
+- ../../../libs/xpdf/xpdf/Page.h ../../../libs/xpdf/xpdf/GfxFont.h \
+- ../../../libs/xpdf/xpdf/Error.h epdf.h
++pdftoepdf.o: pdftoepdf.cc epdf.h ../../kpathsea/c-auto.h \
++  ../../kpathsea/c-proto.h ../../web2c/c-auto.h ../../web2c/config.h \
++  ../../kpathsea/c-fopen.h ../../web2c/pdftexdir/ptexmac.h
+ ttf2afm.o: ttf2afm.c writettf.h macnames.c
+-pdftosrc.o: pdftosrc.cc ../../../libs/xpdf/xpdf/Object.h \
+- ../../../libs/xpdf/xpdf/Array.h ../../../libs/xpdf/xpdf/Dict.h \
+- ../../../libs/xpdf/xpdf/Stream.h ../../../libs/xpdf/xpdf/XRef.h \
+- ../../../libs/xpdf/xpdf/Catalog.h ../../../libs/xpdf/xpdf/Page.h \
+- ../../../libs/xpdf/xpdf/PDFDoc.h ../../../libs/xpdf/xpdf/Link.h \
+- ../../../libs/xpdf/xpdf/Error.h ../../../libs/xpdf/xpdf/config.h
++pdftosrc.o: pdftosrc.cc
+Index: texlive-bin-2008.svn12198/texk/web2c/pdftexdir/pdftoepdf.cc
+===================================================================
+--- texlive-bin-2008.svn12198.orig/texk/web2c/pdftexdir/pdftoepdf.cc	2009-03-10 20:05:59.000000000 +0100
++++ texlive-bin-2008.svn12198/texk/web2c/pdftexdir/pdftoepdf.cc	2009-03-10 20:06:13.000000000 +0100
+@@ -24,25 +24,24 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <ctype.h>
+-#include <aconf.h>
+-#include <GString.h>
+-#include <gmem.h>
+-#include <gfile.h>
+-#include <config.h>
+ #include <assert.h>
+-#include "Object.h"
+-#include "Stream.h"
+-#include "Array.h"
+-#include "Dict.h"
+-#include "XRef.h"
+-#include "Catalog.h"
+-#include "Link.h"
+-#include "Page.h"
+-#include "GfxFont.h"
+-#include "PDFDoc.h"
+-#include "GlobalParams.h"
+-#include "Error.h"
+-
++#include <dirent.h>
++#include <poppler/poppler-config.h>
++#include <poppler/goo/GooString.h>
++#include <poppler/goo/gmem.h>
++#include <poppler/goo/gfile.h>
++#include "poppler/Object.h"
++#include "poppler/Stream.h"
++#include "poppler/Array.h"
++#include "poppler/Dict.h"
++#include "poppler/XRef.h"
++#include "poppler/Link.h"
++#include "poppler/Catalog.h"
++#include "poppler/Page.h"
++#include "poppler/GfxFont.h"
++#include "poppler/PDFDoc.h"
++#include "poppler/GlobalParams.h"
++#include "poppler/Error.h"
+ #include "epdf.h"
+ 
+ static const char _svn_version[] =
+@@ -159,7 +158,7 @@
+     fprintf(stderr, "\npdfTeX Debug: Creating %s (%d)\n", p->file_name,
+             p->occurences);
+ #endif
+-    GString *docName = new GString(p->file_name);
++    GooString *docName = new GooString(p->file_name);
+     p->doc = new PDFDoc(docName);       // takes ownership of docName
+     if (!p->doc->isOk() || !p->doc->okToPrint()) {
+         pdftex_fail("xpdf: reading PDF image failed");
+@@ -520,7 +519,7 @@
+     int i, l, c;
+     Ref ref;
+     char *p;
+-    GString *s;
++    GooString *s;
+     if (obj->isBool()) {
+         pdf_printf("%s", obj->getBool()? "true" : "false");
+     } else if (obj->isInt()) {
+@@ -713,7 +712,7 @@
+     epdf_num_pages = pdf_doc->doc->getCatalog()->getNumPages();
+     if (page_name) {
+         // get page by name
+-        GString name(page_name);
++        GooString name(page_name);
+         LinkDest *link = pdf_doc->doc->findDest(&name);
+         if (link == 0 || !link->isOk())
+             pdftex_fail("PDF inclusion: invalid destination <%s>", page_name);
+Index: texlive-bin-2008.svn12198/texk/web2c/pdftexdir/pdftosrc.cc
+===================================================================
+--- texlive-bin-2008.svn12198.orig/texk/web2c/pdftexdir/pdftosrc.cc	2009-03-10 20:05:59.000000000 +0100
++++ texlive-bin-2008.svn12198/texk/web2c/pdftexdir/pdftosrc.cc	2009-03-10 20:06:13.000000000 +0100
+@@ -23,22 +23,23 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <ctype.h>
+-#include <aconf.h>
+ #include <assert.h>
+-#include <GString.h>
+-#include <gmem.h>
+-#include <gfile.h>
+-#include "Object.h"
+-#include "Stream.h"
+-#include "Array.h"
+-#include "Dict.h"
+-#include "XRef.h"
+-#include "Catalog.h"
+-#include "Page.h"
+-#include "GfxFont.h"
+-#include "PDFDoc.h"
+-#include "GlobalParams.h"
+-#include "Error.h"
++
++#include <dirent.h>
++#include <poppler/goo/GooString.h>
++#include <poppler/goo/gmem.h>
++#include <poppler/goo/gfile.h>
++#include "poppler/Object.h"
++#include "poppler/Stream.h"
++#include "poppler/Array.h"
++#include "poppler/Dict.h"
++#include "poppler/XRef.h"
++#include "poppler/Catalog.h"
++#include "poppler/Page.h"
++#include "poppler/GfxFont.h"
++#include "poppler/PDFDoc.h"
++#include "poppler/GlobalParams.h"
++#include "poppler/Error.h"
+ 
+ static const char _svn_version[] =
+     "$Id: pdftosrc.cc 7945 2008-05-08 14:25:16Z martin $ $URL: http://scm.foundry.supelec.fr/svn/pdftex/branches/stable/source/src/texk/web2c/pdftexdir/pdftosrc.cc $";
+@@ -49,7 +50,7 @@
+ {
+     char *p, buf[1024];
+     PDFDoc *doc;
+-    GString *fileName;
++    GooString *fileName;
+     Stream *s;
+     Object srcStream, srcName, catalogDict;
+     FILE *outfile;
+@@ -63,8 +64,8 @@
+                 "Usage: pdftosrc <PDF-file> [<stream-object-number>]\n");
+         exit(1);
+     }
+-    fileName = new GString(argv[1]);
+-    globalParams = new GlobalParams();
++    fileName = new GooString(argv[1]);
++    globalParams = new GlobalParams(NULL);
+     doc = new PDFDoc(fileName);
+     if (!doc->isOk()) {
+         fprintf(stderr, "Invalid PDF file\n");
+@@ -84,7 +85,7 @@
+     }
+     srcStream.initNull();
+     if (objnum == 0) {
+-        catalogDict.dictLookup("SourceObject", &srcStream);
++        catalogDict.dictLookup(UGooString("SourceObject"), &srcStream);
+         if (!srcStream.isStream("SourceFile")) {
+             fprintf(stderr, "No SourceObject found\n");
+             exit(1);
+Index: texlive-bin-2008.svn12198/texk/web2c/pdftexdir/Makefile.in
+===================================================================
+--- texlive-bin-2008.svn12198.orig/texk/web2c/pdftexdir/Makefile.in	2009-03-10 20:05:59.000000000 +0100
++++ texlive-bin-2008.svn12198/texk/web2c/pdftexdir/Makefile.in	2009-03-10 20:06:13.000000000 +0100
+@@ -11,6 +11,7 @@
+ ALL_CXXFLAGS = @CXXFLAGS@ @DEFS@ $(XXCFLAGS) \
+   -I. -I$(srcdir) \
+   -I$(kpathsea_dir_parent) -I$(kpathsea_srcdir_parent) \
++  -I/usr/include/poppler \
+   @LIBXPDFCPPFLAGS@ \
+   -I$(LIBOBSDCOMPATDIR) -I$(LIBOBSDCOMPATDIR)/.. \
+   -I$(LIBOBSDCOMPATSRCDIR) -I$(LIBOBSDCOMPATSRCDIR)/.. \
+@@ -38,11 +39,15 @@
+ LIBOBSDCOMPATDIR=../../../libs/obsdcompat
+ LIBOBSDCOMPATSRCDIR=$(srcdir)/$(LIBOBSDCOMPATDIR)
+ 
++POPPLERVERSION=`pkg-config --modversion poppler`
++
+ XCPPFLAGS=-I.. -I$(srcdir)/.. -I../.. -I$(srcdir)/../.. -I$(LIBMD5DIR) \
+   -I$(LIBMD5SRCDIR) @LIBPNGCPPFLAGS@ @ZLIBCPPFLAGS@ \
+   -I$(LIBXPDFDIR) -I$(LIBXPDFDIR)/.. -I$(LIBXPDFSRCDIR) -I$(LIBXPDFSRCDIR)/.. \
+   -I$(LIBOBSDCOMPATDIR) -I$(LIBOBSDCOMPATDIR)/.. -I$(LIBOBSDCOMPATSRCDIR) \
+-  -I$(LIBOBSDCOMPATSRCDIR)/.. -DpdfTeX
++  -I$(LIBOBSDCOMPATSRCDIR)/.. -DpdfTeX \
++  -DPOPPLERVERSION=\"$(POPPLERVERSION)\"
++
+ 
+ OBJS = epdf.o mapfile.o utils.o vfpacket.o pkin.o \
+ writefont.o writet1.o writet3.o writezip.o writeenc.o writettf.o \
+Index: texlive-bin-2008.svn12198/texk/web2c/pdftexdir/pdftex.mk
+===================================================================
+--- texlive-bin-2008.svn12198.orig/texk/web2c/pdftexdir/pdftex.mk	2009-03-10 20:05:59.000000000 +0100
++++ texlive-bin-2008.svn12198/texk/web2c/pdftexdir/pdftex.mk	2009-03-10 20:06:13.000000000 +0100
+@@ -3,6 +3,9 @@
+ # differ between releases of pdfeTeX.
+ # $Id: pdftex.mk 9446 2008-07-11 06:51:52Z thanh $
+ 
++# use libpoppler instead of included xpdf code
++ADDLDFLAGS = -lpoppler
++
+ # We build pdftex
+ pdftex = @PETEX@ pdftex
+ pdftexdir = pdftexdir
+@@ -30,7 +33,7 @@
+ 
+ # Making pdftex
+ pdftex: pdftexd.h $(pdftex_o) $(pdftexextra_o) $(pdftexlibsdep)
+-	@CXXHACKLINK@ $(pdftex_o) $(pdftexextra_o) $(pdftexlibs) $(socketlibs) @CXXHACKLDLIBS@ @CXXLDEXTRA@
++	@CXXHACKLINK@ $(pdftex_o) $(pdftexextra_o) $(pdftexlibs) $(socketlibs) @CXXHACKLDLIBS@ @CXXLDEXTRA@ $(ADDLDFLAGS)
+ 
+ # C file dependencies.
+ $(pdftex_c) pdftexcoerce.h pdftexd.h: pdftex.p $(web2c_texmf) $(srcdir)/$(pdftexdir)/pdftex.defines $(srcdir)/$(pdftexdir)/pdftex.h
+@@ -135,10 +138,10 @@
+ 	rm -f ttf2afm.c macnames.c
+ # 

+ # pdftosrc
+-pdftosrc = pdftosrc
++pdftosrc = 
+ 
+ pdftosrc: $(pdftexdir)/pdftosrc.o $(LIBXPDFDEP)
+-	@CXXHACKLINK@ $(pdftexdir)/pdftosrc.o $(LDLIBXPDF) -lm @CXXLDEXTRA@
++	@CXXHACKLINK@ $(pdftexdir)/pdftosrc.o $(LDLIBXPDF) -lm @CXXLDEXTRA@  $(ADDLDFLAGS)
+ $(pdftexdir)/pdftosrc.o:$(srcdir)/$(pdftexdir)/pdftosrc.cc
+ 	cd $(pdftexdir) && $(MAKE) pdftosrc.o
+ check: pdftosrc-check
+Index: texlive-bin-2008.svn12198/configure
+===================================================================
+--- texlive-bin-2008.svn12198.orig/configure	2009-03-10 20:06:05.000000000 +0100
++++ texlive-bin-2008.svn12198/configure	2009-03-10 20:06:13.000000000 +0100
+@@ -6835,9 +6835,9 @@
+ 
+ # we need libxpdf for pdf[ex]tex, xetex
+ test ! -d $srcdir/$LIBXPDFDIR && : ${needs_libxpdf=no}
+-test "$with_pdftex"  != no    && : ${needs_libxpdf=yes}
+-test "$with_pdfetex" != no    && : ${needs_libxpdf=yes}
+-test "$with_xetex"   != no    && : ${needs_libxpdf=yes}
++test "$with_pdftex"  != no    && : ${needs_libxpdf=no}
++test "$with_pdfetex" != no    && : ${needs_libxpdf=no}
++test "$with_xetex"   != no    && : ${needs_libxpdf=no}
+ : ${needs_libxpdf=no}
+ export needs_libxpdf
+ 
+Index: texlive-bin-2008.svn12198/configure.in
+===================================================================
+--- texlive-bin-2008.svn12198.orig/configure.in	2009-03-10 20:06:05.000000000 +0100
++++ texlive-bin-2008.svn12198/configure.in	2009-03-10 20:06:13.000000000 +0100
+@@ -163,9 +163,9 @@
+ 
+ # we need libxpdf for pdf[ex]tex, xetex
+ test ! -d $srcdir/$LIBXPDFDIR && : ${needs_libxpdf=no}
+-test "$with_pdftex"  != no    && : ${needs_libxpdf=yes}
+-test "$with_pdfetex" != no    && : ${needs_libxpdf=yes}
+-test "$with_xetex"   != no    && : ${needs_libxpdf=yes}
++test "$with_pdftex"  != no    && : ${needs_libxpdf=no}
++test "$with_pdfetex" != no    && : ${needs_libxpdf=no}
++test "$with_xetex"   != no    && : ${needs_libxpdf=no}
+ : ${needs_libxpdf=no}
+ export needs_libxpdf
+ 
+@@ -220,7 +220,7 @@
+ sinclude(libs/ncurses/ncurses.ac)
+ sinclude(libs/zlib/zlib.ac)
+ sinclude(libs/libpng/libpng.ac)
+-sinclude(libs/xpdf/libxpdf.ac)
++#sinclude(libs/xpdf/libxpdf.ac)
+ sinclude(libs/t1lib/t1lib.ac)
+ sinclude(libs/freetype/freetype.ac)
+ sinclude(libs/freetype2/freetype2.ac)
+Index: texlive-bin-2008.svn12198/texk/web2c/xetexdir/XeTeX_ext.c
+===================================================================
+--- texlive-bin-2008.svn12198.orig/texk/web2c/xetexdir/XeTeX_ext.c	2009-03-10 20:05:59.000000000 +0100
++++ texlive-bin-2008.svn12198/texk/web2c/xetexdir/XeTeX_ext.c	2009-03-10 20:06:13.000000000 +0100
+@@ -33,7 +33,7 @@
+  */
+ 
+ #ifdef XETEX_OTHER
+-#include "xpdf/config.h"
++#include "poppler/poppler-config.h"
+ #include "png.h"
+ #endif
+ 
+@@ -190,7 +190,7 @@
+ #else
+ 		"Compiled with fontconfig version %d.%d.%d; using %d.%d.%d\n"
+ 		"Compiled with libpng version %s; using %s\n"
+-		"Compiled with xpdf version %s\n"
++		"Compiled with libpoppler version %s\n"
+ #endif
+ 		;
+ 
+@@ -201,7 +201,7 @@
+ #ifdef XETEX_OTHER
+ 			+ strlen(PNG_LIBPNG_VER_STRING)
+ 			+ strlen(png_libpng_ver)
+-			+ strlen(xpdfVersion)
++			+ strlen(POPPLERVERSION)
+ 			+ 6 * 3 /* for fontconfig version #s (won't really need 3 digits per field!) */
+ #endif
+ 			+ 6 * 3; /* for freetype version #s (ditto) */
+@@ -226,7 +226,7 @@
+ 		FC_VERSION / 10000, (FC_VERSION % 10000) / 100, FC_VERSION % 100,
+ 		fc_version / 10000, (fc_version % 10000) / 100, fc_version % 100,
+ 		PNG_LIBPNG_VER_STRING, png_libpng_ver,
+-		xpdfVersion
++		POPPLERVERSION
+ #endif
+ 		);
+ }
+Index: texlive-bin-2008.svn12198/texk/web2c/xetexdir/pdfimage.cpp
+===================================================================
+--- texlive-bin-2008.svn12198.orig/texk/web2c/xetexdir/pdfimage.cpp	2009-03-10 20:05:59.000000000 +0100
++++ texlive-bin-2008.svn12198/texk/web2c/xetexdir/pdfimage.cpp	2009-03-10 20:06:59.000000000 +0100
+@@ -11,10 +11,24 @@
+ 
+ #include "pdfimage.h"
+ 
+-#include "PDFDoc.h"
+-#include "Catalog.h"
+-#include "Page.h"
+-#include "GString.h"
++#include <dirent.h>
++#include <poppler/poppler-config.h>
++#include <poppler/goo/GooString.h>
++#include <poppler/goo/gmem.h>
++#include <poppler/goo/gfile.h>
++#include "poppler/Object.h"
++#include "poppler/Stream.h"
++#include "poppler/Array.h"
++#include "poppler/Dict.h"
++#include "poppler/XRef.h"
++#include "poppler/Link.h"
++#include "poppler/Catalog.h"
++#include "poppler/Page.h"
++#include "poppler/GfxFont.h"
++#include "poppler/PDFDoc.h"
++#include "poppler/GlobalParams.h"
++#include "poppler/Error.h"
++
+ 
+ #include "XeTeX_ext.h"
+ 
+@@ -29,7 +43,7 @@
+ pdf_get_rect(char* filename, int page_num, int pdf_box, realrect* box)
+ 	/* return the box converted to TeX points */
+ {
+-	GString*	name = new GString(filename);
++	GooString*	name = new GooString(filename);
+ 	PDFDoc*		doc = new PDFDoc(name);
+ 	
+ 	if (!doc) {
+@@ -88,7 +102,7 @@
+ pdf_count_pages(char* filename)
+ {
+ 	int			pages = 0;
+-	GString*	name = new GString(filename);
++	GooString*	name = new GooString(filename);
+ 	PDFDoc*		doc = new PDFDoc(name);
+ 	
+ 	if (!doc) {
+Index: texlive-bin-2008.svn12198/texk/web2c/xetexdir/xetex.mk
+===================================================================
+--- texlive-bin-2008.svn12198.orig/texk/web2c/xetexdir/xetex.mk	2009-03-10 20:05:59.000000000 +0100
++++ texlive-bin-2008.svn12198/texk/web2c/xetexdir/xetex.mk	2009-03-10 20:06:13.000000000 +0100
+@@ -8,6 +8,10 @@
+ # but need to check possible effect on other programs
+ ALL_CXXFLAGS = @CXXFLAGS@
+ 
++# use libpoppler instead of included xpdf code
++ADDLDFLAGS = -lpoppler
++
++
+ # We build xetex unless configure decides to skip it
+ xetex = @XETEX@ xetex
+ 
+@@ -33,7 +37,7 @@
+ 
+ @XETEX_GENERIC@ XETEX_DEFINES = -DXETEX_OTHER
+ 
+- at XETEX_GENERIC@ EXTRALIBS = @LDLIBXPDF@ @LDLIBPNG@ @LDFONTCONFIG@
++ at XETEX_GENERIC@ EXTRALIBS = @LDLIBXPDF@ @LDLIBPNG@ @LDFONTCONFIG@ $(ADDLDFLAGS)
+ 
+ @XETEX_GENERIC@ EXTRADEPS = @LIBXPDFDEP@ @LIBPNGDEP@
+ 
+@@ -168,7 +172,7 @@
+ 	$(compile) $(ALL_CFLAGS) $(FTFLAGS) $(LIBPNGCPPFLAGS) $(ZLIBCPPFLAGS) -c $< -o $@
+ 
+ pdfimage.o: $(srcdir)/xetexdir/pdfimage.cpp $(srcdir)/xetexdir/pdfimage.h
+-	$(CXX) $(ALL_CFLAGS) $(FTFLAGS) $(LIBXPDFCPPFLAGS) -c $< -o $@
++	$(CXX) $(ALL_CFLAGS) $(FTFLAGS) $(LIBXPDFCPPFLAGS) -I/usr/include/poppler -c $< -o $@
+ 
+ XeTeX_pic.o: $(srcdir)/xetexdir/XeTeX_pic.c $(srcdir)/xetexdir/XeTeX_ext.h $(XeTeXImageHdrs)
+ 	$(compile) $(TECKITFLAGS) $(FTFLAGS) $(ALL_CFLAGS) $(XETEX_DEFINES) -c $< -o $@
+@@ -214,9 +218,11 @@
+ 		$(XeTeXFontHdrs) $(GRAPHITESRCDIR)/include/graphite/Font.h
+ 	$(CXX) $(ICUCFLAGS) $(FTFLAGS) $(FONTCONFIGCPPFLAGS) $(GRAPHITEFLAGS) $(ALL_CXXFLAGS) $(XETEX_DEFINES) -c $< -o $@
+ 
++POPPLERVERSION=`pkg-config --modversion poppler`
++
+ # special rules for files that need the TECkit headers as well
+ XeTeX_ext.o: $(srcdir)/xetexdir/XeTeX_ext.c xetexd.h
+-	$(compile) $(ICUCFLAGS) $(FTFLAGS) $(TECKITFLAGS) $(LIBPNGCPPFLAGS) $(LIBXPDFCPPFLAGS) $(ZLIBCPPFLAGS) $(ALL_CFLAGS) $(XETEX_DEFINES) $(XETEX_GRAPHITE) -c $< -o $@
++	$(compile) $(ICUCFLAGS) $(FTFLAGS) $(TECKITFLAGS) $(LIBPNGCPPFLAGS) $(LIBXPDFCPPFLAGS) $(ZLIBCPPFLAGS) $(ALL_CFLAGS) $(XETEX_DEFINES) $(XETEX_GRAPHITE) -DPOPPLERVERSION=\"$(POPPLERVERSION)\" -c $< -o $@
+ XeTeX_mac.o: $(srcdir)/xetexdir/XeTeX_mac.c xetexd.h
+ 	$(compile) $(ICUCFLAGS) $(TECKITFLAGS) $(ALL_CFLAGS) $(XETEX_DEFINES) -c $< -o $@
+ 
+Index: texlive-bin-2008.svn12198/texk/web2c/pdftexdir/utils.c
+===================================================================
+--- texlive-bin-2008.svn12198.orig/texk/web2c/pdftexdir/utils.c	2009-03-10 20:05:59.000000000 +0100
++++ texlive-bin-2008.svn12198/texk/web2c/pdftexdir/utils.c	2009-03-10 20:06:13.000000000 +0100
+@@ -35,7 +35,7 @@
+ #include "zlib.h"
+ #include "ptexlib.h"
+ #include "png.h"
+-#include "xpdf/config.h"        /* just to get the xpdf version */
++#include "poppler/poppler-config.h"        /* just to get the xpdf version */
+ 
+ static const char _svn_version[] =
+     "$Id: utils.c 7945 2008-05-08 14:25:16Z martin $ $URL: http://scm.foundry.supelec.fr/svn/pdftex/branches/stable/source/src/texk/web2c/pdftexdir/utils.c $";
+@@ -1267,9 +1267,9 @@
+     (void) asprintf(versions,
+                     "Compiled with libpng %s; using libpng %s\n"
+                     "Compiled with zlib %s; using zlib %s\n"
+-                    "Compiled with xpdf version %s\n",
++                    "Compiled with libpoppler version %s\n",
+                     PNG_LIBPNG_VER_STRING, png_libpng_ver,
+-                    ZLIB_VERSION, zlib_version, xpdfVersion);
++                    ZLIB_VERSION, zlib_version, POPPLERVERSION);
+ }
+ 
+ 
+Index: texlive-bin-2008.svn12198/texk/web2c/pdftexdir/pdftexextra.in
+===================================================================
+--- texlive-bin-2008.svn12198.orig/texk/web2c/pdftexdir/pdftexextra.in	2009-03-10 20:05:59.000000000 +0100
++++ texlive-bin-2008.svn12198/texk/web2c/pdftexdir/pdftexextra.in	2009-03-10 20:06:13.000000000 +0100
+@@ -26,7 +26,7 @@
+    (generated from ../lib/texmfmp.c).
+ */
+ 
+-#define BANNER "This is pdfTeX, Version 3.1415926-PDFTEX-VERSION-ETEX-VERSION"
++#define BANNER "This is pdfTeX using libpoppler, Version 3.1415926-PDFTEX-VERSION-ETEX-VERSION"
+ #define COPYRIGHT_HOLDER "Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX)"
+ #define AUTHOR NULL
+ #define PROGRAM_HELP PDFTEXHELP
diff --git a/debian/patches/30_libpoppler_0.4.5 b/debian/patches/30_libpoppler_0.4.5
new file mode 100644
index 0000000..9d4af64
--- /dev/null
+++ b/debian/patches/30_libpoppler_0.4.5
@@ -0,0 +1,440 @@
+# 30_libpoppler.dpatch
+#
+# use libpoppler instead of libxpdf in pdfetex and xetex
+# don't build pdftosrc as it needs libpoppler from experimental 
+
+ at DPATCH@
+ configure                         |    6 +-
+ configure.in                      |    8 +--
+ texk/web2c/pdftexdir/Makefile.in  |    2 
+ texk/web2c/pdftexdir/depend.mk    |   58 +------------------------
+ texk/web2c/pdftexdir/pdftex.mk    |    9 ++-
+ texk/web2c/pdftexdir/pdftoepdf.cc |   43 +++++++++---------
+ texk/web2c/pdftexdir/pdftosrc.cc  |   37 ++++++++-------
+ texk/web2c/pdftexdir/utils.c      |    4 -
+ texk/web2c/xetexdir/XeTeX_ext.c   |    4 -
+ texk/web2c/xetexdir/pdfimage.cpp  |   24 ++++++++--
+ texk/web2c/xetexdir/xetex.mk      |    8 ++-
+ 11 files changed, 87 insertions(+), 116 deletions(-)
+
+Index: texlive-bin-2007/texk/web2c/pdftexdir/depend.mk
+===================================================================
+--- texlive-bin-2007.orig/texk/web2c/pdftexdir/depend.mk	2006-12-27 00:37:34.000000000 +0100
++++ texlive-bin-2007/texk/web2c/pdftexdir/depend.mk	2007-04-16 15:30:03.000000000 +0200
+@@ -1,55 +1,5 @@
+-epdf.o: epdf.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
+- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h
+-mapfile.o: mapfile.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
+- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h
+-papersiz.o: papersiz.c ptexlib.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h
+-utils.o: utils.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
+- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h \
+- ../../../libs/zlib/zlib.h ../../../libs/zlib/zconf.h \
+- ../../../libs/md5/md5.h pdftexextra.h \
+- ../../../libs/obsdcompat/openbsd-compat.h
+-vfpacket.o: vfpacket.c ptexlib.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h
+-pkin.o: pkin.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
+- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h
+-writefont.o: writefont.c ../../../libs/xpdf/goo/gmem.h ptexlib.h \
+- ../pdftexd.h ../texmfmp.h ../cpascal.h ../config.h ../help.h \
+- ../texmfmem.h ../pdftexcoerce.h ptexmac.h
+-writet1.o: writet1.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
+- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h
+-writet3.o: writet3.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
+- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h
+-writezip.o: writezip.c ptexlib.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h ../../../libs/zlib/zlib.h ../../../libs/zlib/zconf.h
+-writeenc.o: writeenc.c ptexlib.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h
+-writettf.o: writettf.c ptexlib.h writettf.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h macnames.c
+-writejpg.o: writejpg.c ptexlib.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h image.h
+-writepng.o: writepng.c ptexlib.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h image.h
+-writeimg.o: writeimg.c ptexlib.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h image.h
+-pdftoepdf.o: pdftoepdf.cc ../../../libs/xpdf/xpdf/Object.h \
+- ../../../libs/xpdf/goo/gmem.h ../../../libs/xpdf/xpdf/Array.h \
+- ../../../libs/xpdf/xpdf/Dict.h ../../../libs/xpdf/xpdf/Stream.h \
+- ../../../libs/xpdf/xpdf/XRef.h ../../../libs/xpdf/xpdf/Catalog.h \
+- ../../../libs/xpdf/xpdf/Page.h ../../../libs/xpdf/xpdf/GfxFont.h \
+- ../../../libs/xpdf/xpdf/Error.h epdf.h
++pdftoepdf.o: pdftoepdf.cc epdf.h ../../kpathsea/c-auto.h \
++  ../../kpathsea/c-proto.h ../../web2c/c-auto.h ../../web2c/config.h \
++  ../../kpathsea/c-fopen.h ../../web2c/pdftexdir/ptexmac.h
+ ttf2afm.o: ttf2afm.c writettf.h macnames.c
+-pdftosrc.o: pdftosrc.cc ../../../libs/xpdf/xpdf/Object.h \
+- ../../../libs/xpdf/xpdf/Array.h ../../../libs/xpdf/xpdf/Dict.h \
+- ../../../libs/xpdf/xpdf/Stream.h ../../../libs/xpdf/xpdf/XRef.h \
+- ../../../libs/xpdf/xpdf/Catalog.h ../../../libs/xpdf/xpdf/Page.h \
+- ../../../libs/xpdf/xpdf/PDFDoc.h ../../../libs/xpdf/xpdf/Link.h \
+- ../../../libs/xpdf/xpdf/Error.h ../../../libs/xpdf/xpdf/config.h
++pdftosrc.o: pdftosrc.cc
+Index: texlive-bin-2007/texk/web2c/pdftexdir/pdftoepdf.cc
+===================================================================
+--- texlive-bin-2007.orig/texk/web2c/pdftexdir/pdftoepdf.cc	2006-12-27 00:37:34.000000000 +0100
++++ texlive-bin-2007/texk/web2c/pdftexdir/pdftoepdf.cc	2007-04-16 15:30:03.000000000 +0200
+@@ -26,25 +26,24 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <ctype.h>
+-#include <aconf.h>
+-#include <GString.h>
+-#include <gmem.h>
+-#include <gfile.h>
+-#include <config.h>
+ #include <assert.h>
+-#include "Object.h"
+-#include "Stream.h"
+-#include "Array.h"
+-#include "Dict.h"
+-#include "XRef.h"
+-#include "Catalog.h"
+-#include "Link.h"
+-#include "Page.h"
+-#include "GfxFont.h"
+-#include "PDFDoc.h"
+-#include "GlobalParams.h"
+-#include "Error.h"
+-
++#include <dirent.h>
++#include <poppler/poppler-config.h>
++#include <poppler/goo/GooString.h>
++#include <poppler/goo/gmem.h>
++#include <poppler/goo/gfile.h>
++#include "poppler/Object.h"
++#include "poppler/Stream.h"
++#include "poppler/Array.h"
++#include "poppler/Dict.h"
++#include "poppler/XRef.h"
++#include "poppler/Link.h"
++#include "poppler/Catalog.h"
++#include "poppler/Page.h"
++#include "poppler/GfxFont.h"
++#include "poppler/PDFDoc.h"
++#include "poppler/GlobalParams.h"
++#include "poppler/Error.h"
+ #include "epdf.h"
+ 
+ // This file is mostly C and not very much C++; it's just used to interface
+@@ -169,7 +168,7 @@
+     fprintf(stderr, "\npdfTeX Debug: Creating %s (%d)\n", p->file_name,
+             p->occurences);
+ #endif
+-    GString *docName = new GString(p->file_name);
++    GooString *docName = new GooString(p->file_name);
+     p->doc = new PDFDoc(docName);       // takes ownership of docName
+     if (!p->doc->isOk() || !p->doc->okToPrint()) {
+         pdftex_fail("xpdf: reading PDF image failed");
+@@ -511,7 +510,7 @@
+     int i, l, c;
+     Ref ref;
+     char *p;
+-    GString *s;
++    GooString *s;
+     if (obj->isBool()) {
+         pdf_printf("%s", obj->getBool()? "true" : "false");
+     } else if (obj->isInt()) {
+@@ -677,7 +676,7 @@
+     float pdf_version_found, pdf_version_wanted;
+     // initialize
+     if (!isInit) {
+-        globalParams = new GlobalParams();
++        globalParams = new GlobalParams(NULL);
+         globalParams->setErrQuiet(gFalse);
+         isInit = gTrue;
+     }
+@@ -703,7 +702,7 @@
+     epdf_num_pages = pdf_doc->doc->getCatalog()->getNumPages();
+     if (page_name) {
+         // get page by name
+-        GString name(page_name);
++        GooString name(page_name);
+         LinkDest *link = pdf_doc->doc->findDest(&name);
+         if (link == 0 || !link->isOk())
+             pdftex_fail("PDF inclusion: invalid destination <%s>", page_name);
+Index: texlive-bin-2007/texk/web2c/pdftexdir/pdftosrc.cc
+===================================================================
+--- texlive-bin-2007.orig/texk/web2c/pdftexdir/pdftosrc.cc	2006-12-27 00:37:34.000000000 +0100
++++ texlive-bin-2007/texk/web2c/pdftexdir/pdftosrc.cc	2007-04-16 15:30:03.000000000 +0200
+@@ -25,22 +25,23 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <ctype.h>
+-#include <aconf.h>
+ #include <assert.h>
+-#include <GString.h>
+-#include <gmem.h>
+-#include <gfile.h>
+-#include "Object.h"
+-#include "Stream.h"
+-#include "Array.h"
+-#include "Dict.h"
+-#include "XRef.h"
+-#include "Catalog.h"
+-#include "Page.h"
+-#include "GfxFont.h"
+-#include "PDFDoc.h"
+-#include "GlobalParams.h"
+-#include "Error.h"
++
++#include <dirent.h>
++#include <poppler/goo/GooString.h>
++#include <poppler/goo/gmem.h>
++#include <poppler/goo/gfile.h>
++#include "poppler/Object.h"
++#include "poppler/Stream.h"
++#include "poppler/Array.h"
++#include "poppler/Dict.h"
++#include "poppler/XRef.h"
++#include "poppler/Catalog.h"
++#include "poppler/Page.h"
++#include "poppler/GfxFont.h"
++#include "poppler/PDFDoc.h"
++#include "poppler/GlobalParams.h"
++#include "poppler/Error.h"
+ 
+ static XRef *xref = 0;
+ 
+@@ -48,7 +49,7 @@
+ {
+     char *p, buf[1024];
+     PDFDoc *doc;
+-    GString *fileName;
++    GooString *fileName;
+     Stream *s;
+     Object srcStream, srcName, catalogDict;
+     FILE *outfile;
+@@ -62,8 +63,8 @@
+                 "Usage: pdftosrc <PDF-file> [<stream-object-number>]\n");
+         exit(1);
+     }
+-    fileName = new GString(argv[1]);
+-    globalParams = new GlobalParams();
++    fileName = new GooString(argv[1]);
++    globalParams = new GlobalParams(NULL);
+     doc = new PDFDoc(fileName);
+     if (!doc->isOk()) {
+         fprintf(stderr, "Invalid PDF file\n");
+Index: texlive-bin-2007/texk/web2c/pdftexdir/Makefile.in
+===================================================================
+--- texlive-bin-2007.orig/texk/web2c/pdftexdir/Makefile.in	2006-12-27 00:37:34.000000000 +0100
++++ texlive-bin-2007/texk/web2c/pdftexdir/Makefile.in	2007-04-16 15:30:03.000000000 +0200
+@@ -8,7 +8,7 @@
+ kpathsea_srcdir_parent = $(srcdir)/../..
+ kpathsea_dir_parent = ../..
+ 
+-ALL_CXXFLAGS = @CXXFLAGS@ @DEFS@ $(XXCFLAGS) -I. -I$(srcdir) -I$(kpathsea_dir_parent) -I$(kpathsea_srcdir_parent) @LIBXPDFCPPFLAGS@ -I$(LIBOBSDCOMPATDIR) -I$(LIBOBSDCOMPATDIR)/.. -I$(LIBOBSDCOMPATFSRCDIR) -I$(LIBOBSDCOMPATFSRCDIR)/..
++ALL_CXXFLAGS = @CXXFLAGS@ @DEFS@ $(XXCFLAGS) -I. -I$(srcdir) -I$(kpathsea_dir_parent) -I$(kpathsea_srcdir_parent) -I/usr/include/poppler -I$(LIBOBSDCOMPATDIR) -I$(LIBOBSDCOMPATDIR)/.. -I$(LIBOBSDCOMPATFSRCDIR) -I$(LIBOBSDCOMPATFSRCDIR)/..
+ CXX = @CXX@
+ 
+ .SUFFIXES: .cc .o
+Index: texlive-bin-2007/texk/web2c/pdftexdir/pdftex.mk
+===================================================================
+--- texlive-bin-2007.orig/texk/web2c/pdftexdir/pdftex.mk	2006-12-27 00:37:34.000000000 +0100
++++ texlive-bin-2007/texk/web2c/pdftexdir/pdftex.mk	2007-04-16 15:30:03.000000000 +0200
+@@ -2,6 +2,9 @@
+ # This fragment contains the parts of the makefile that are most likely to
+ # differ between releases of pdfeTeX.
+ 
++# use libpoppler instead of included xpdf code
++ADDLDFLAGS = -lpoppler
++
+ # We build pdftex
+ pdftex = @PETEX@ pdftex
+ pdftexdir = pdftexdir
+@@ -29,7 +32,7 @@
+ 
+ # Making pdftex
+ pdftex: pdftexd.h $(pdftex_o) $(pdftexextra_o) $(pdftexlibsdep)
+-	@CXXHACKLINK@ $(pdftex_o) $(pdftexextra_o) $(pdftexlibs) $(socketlibs) @CXXHACKLDLIBS@ @CXXLDEXTRA@
++	@CXXHACKLINK@ $(pdftex_o) $(pdftexextra_o) $(pdftexlibs) $(socketlibs) @CXXHACKLDLIBS@ @CXXLDEXTRA@ $(ADDLDFLAGS)
+ 
+ # C file dependencies.
+ $(pdftex_c) pdftexcoerce.h pdftexd.h: pdftex.p $(web2c_texmf) $(srcdir)/$(pdftexdir)/pdftex.defines $(srcdir)/$(pdftexdir)/pdftex.h
+@@ -153,10 +156,10 @@
+ 	rm -f ttf2afm.c macnames.c
+ # 

+ # pdftosrc
+-pdftosrc = pdftosrc
++pdftosrc = 
+ 
+ pdftosrc: $(pdftexdir)/pdftosrc.o $(LIBXPDFDEP)
+-	@CXXHACKLINK@ $(pdftexdir)/pdftosrc.o $(LDLIBXPDF) -lm @CXXLDEXTRA@
++	@CXXHACKLINK@ $(pdftexdir)/pdftosrc.o $(LDLIBXPDF) -lm @CXXLDEXTRA@  $(ADDLDFLAGS)
+ $(pdftexdir)/pdftosrc.o:$(srcdir)/$(pdftexdir)/pdftosrc.cc
+ 	cd $(pdftexdir) && $(MAKE) pdftosrc.o
+ check: pdftosrc-check
+Index: texlive-bin-2007/configure
+===================================================================
+--- texlive-bin-2007.orig/configure	2007-04-16 15:29:55.000000000 +0200
++++ texlive-bin-2007/configure	2007-04-16 15:30:03.000000000 +0200
+@@ -3459,9 +3459,9 @@
+ 
+ # we need libxpdf for pdf[ex]tex, xetex
+ test ! -d $srcdir/$LIBXPDFDIR && : ${needs_libxpdf=no}
+-test "$with_pdftex"  != no    && : ${needs_libxpdf=yes}
+-test "$with_pdfetex" != no    && : ${needs_libxpdf=yes}
+-test "$with_xetex"   != no    && : ${needs_libxpdf=yes}
++test "$with_pdftex"  != no    && : ${needs_libxpdf=no}
++test "$with_pdfetex" != no    && : ${needs_libxpdf=no}
++test "$with_xetex"   != no    && : ${needs_libxpdf=no}
+ : ${needs_libxpdf=no}
+ export needs_libxpdf
+ 
+Index: texlive-bin-2007/configure.in
+===================================================================
+--- texlive-bin-2007.orig/configure.in	2007-04-16 15:29:55.000000000 +0200
++++ texlive-bin-2007/configure.in	2007-04-16 15:30:03.000000000 +0200
+@@ -157,9 +157,9 @@
+ 
+ # we need libxpdf for pdf[ex]tex, xetex
+ test ! -d $srcdir/$LIBXPDFDIR && : ${needs_libxpdf=no}
+-test "$with_pdftex"  != no    && : ${needs_libxpdf=yes}
+-test "$with_pdfetex" != no    && : ${needs_libxpdf=yes}
+-test "$with_xetex"   != no    && : ${needs_libxpdf=yes}
++test "$with_pdftex"  != no    && : ${needs_libxpdf=no}
++test "$with_pdfetex" != no    && : ${needs_libxpdf=no}
++test "$with_xetex"   != no    && : ${needs_libxpdf=no}
+ : ${needs_libxpdf=no}
+ export needs_libxpdf
+ 
+@@ -207,7 +207,7 @@
+ sinclude(libs/libpng/libpng.ac)
+ sinclude(libs/zlib/zlib.ac)
+ sinclude(libs/ncurses/ncurses.ac)
+-sinclude(libs/xpdf/libxpdf.ac)
++#sinclude(libs/xpdf/libxpdf.ac)
+ sinclude(libs/t1lib/t1lib.ac)
+ sinclude(libs/gd/gd.ac)
+ sinclude(libs/freetype/freetype.ac)
+Index: texlive-bin-2007/texk/web2c/xetexdir/XeTeX_ext.c
+===================================================================
+--- texlive-bin-2007.orig/texk/web2c/xetexdir/XeTeX_ext.c	2007-01-15 14:04:36.000000000 +0100
++++ texlive-bin-2007/texk/web2c/xetexdir/XeTeX_ext.c	2007-04-16 15:30:03.000000000 +0200
+@@ -33,7 +33,7 @@
+  */
+ 
+ #ifdef XETEX_OTHER
+-#include "xpdf/config.h"
++#include "poppler/poppler-config.h"
+ #include "png.h"
+ #endif
+ 
+@@ -194,7 +194,7 @@
+ #else
+ 		"Compiled with fontconfig version %d.%d.%d; using %d.%d.%d\n"
+ 		"Compiled with libpng version %s; using %s\n"
+-		"Compiled with xpdf version %s\n"
++		"Compiled with libpoppler version %s\n"
+ #endif
+ 		;
+ 
+Index: texlive-bin-2007/texk/web2c/xetexdir/pdfimage.cpp
+===================================================================
+--- texlive-bin-2007.orig/texk/web2c/xetexdir/pdfimage.cpp	2006-12-09 11:29:12.000000000 +0100
++++ texlive-bin-2007/texk/web2c/xetexdir/pdfimage.cpp	2007-04-16 15:30:03.000000000 +0200
+@@ -11,10 +11,24 @@
+ 
+ #include "pdfimage.h"
+ 
+-#include "PDFDoc.h"
+-#include "Catalog.h"
+-#include "Page.h"
+-#include "GString.h"
++#include <dirent.h>
++#include <poppler/poppler-config.h>
++#include <poppler/goo/GooString.h>
++#include <poppler/goo/gmem.h>
++#include <poppler/goo/gfile.h>
++#include "poppler/Object.h"
++#include "poppler/Stream.h"
++#include "poppler/Array.h"
++#include "poppler/Dict.h"
++#include "poppler/XRef.h"
++#include "poppler/Link.h"
++#include "poppler/Catalog.h"
++#include "poppler/Page.h"
++#include "poppler/GfxFont.h"
++#include "poppler/PDFDoc.h"
++#include "poppler/GlobalParams.h"
++#include "poppler/Error.h"
++
+ 
+ #include "XeTeX_ext.h"
+ 
+@@ -28,7 +42,7 @@
+ int
+ pdf_get_rect(char* filename, int page_num, int pdf_box, realrect* box)
+ {
+-	GString*	name = new GString(filename);
++	GooString*	name = new GooString(filename);
+ 	PDFDoc*		doc = new PDFDoc(name);
+ 	
+ 	if (!doc) {
+Index: texlive-bin-2007/texk/web2c/xetexdir/xetex.mk
+===================================================================
+--- texlive-bin-2007.orig/texk/web2c/xetexdir/xetex.mk	2007-01-20 13:44:35.000000000 +0100
++++ texlive-bin-2007/texk/web2c/xetexdir/xetex.mk	2007-04-16 15:30:03.000000000 +0200
+@@ -4,6 +4,10 @@
+ 
+ Makefile: $(srcdir)/xetexdir/xetex.mk
+ 
++# use libpoppler instead of included xpdf code
++ADDLDFLAGS = -lpoppler
++
++
+ # We build xetex unless configure decides to skip it
+ xetex = @XETEX@ xetex
+ 
+@@ -29,7 +33,7 @@
+ 
+ @XETEX_GENERIC@ XETEX_DEFINES = -DXETEX_OTHER
+ 
+- at XETEX_GENERIC@ EXTRALIBS = @LDLIBXPDF@ @LDLIBPNG@ @LDFONTCONFIG@
++ at XETEX_GENERIC@ EXTRALIBS = @LDLIBXPDF@ @LDLIBPNG@ @LDFONTCONFIG@ $(ADDLDFLAGS)
+ 
+ @XETEX_GENERIC@ EXTRADEPS = @LIBXPDFDEP@ @LIBPNGDEP@
+ 
+@@ -144,7 +148,7 @@
+ 	$(compile) $(ALL_CFLAGS) $(LIBPNGCPPFLAGS) $(ZLIBCPPFLAGS) -c $< -o $@
+ 
+ pdfimage.o: $(srcdir)/xetexdir/pdfimage.cpp $(srcdir)/xetexdir/pdfimage.h
+-	$(CXX) $(ALL_CFLAGS) $(LIBXPDFCPPFLAGS) -c $< -o $@
++	$(CXX) $(ALL_CFLAGS) $(LIBXPDFCPPFLAGS) -I/usr/include/poppler -c $< -o $@
+ 
+ XeTeX_pic.o: $(srcdir)/xetexdir/XeTeX_pic.c $(srcdir)/xetexdir/XeTeX_ext.h $(XeTeXImageHdrs)
+ 	$(compile) $(TECKITFLAGS) $(ALL_CFLAGS) $(XETEX_DEFINES) -c $< -o $@
+Index: texlive-bin-2007/texk/web2c/pdftexdir/utils.c
+===================================================================
+--- texlive-bin-2007.orig/texk/web2c/pdftexdir/utils.c	2007-01-01 18:20:03.000000000 +0100
++++ texlive-bin-2007/texk/web2c/pdftexdir/utils.c	2007-04-16 15:30:03.000000000 +0200
+@@ -37,7 +37,7 @@
+ #include "zlib.h"
+ #include "ptexlib.h"
+ #include "png.h"
+-#include "xpdf/config.h"        /* just to get the xpdf version */
++#include "poppler/poppler-config.h"        /* just to get the xpdf version */
+ 
+ #define check_nprintf(size_get, size_want) \
+     if ((unsigned)(size_get) >= (unsigned)(size_want)) \
+@@ -1261,7 +1261,7 @@
+     (void) asprintf(versions,
+                     "Compiled with libpng %s; using libpng %s\n"
+                     "Compiled with zlib %s; using zlib %s\n"
+-                    "Compiled with xpdf version %s\n",
++                    "Compiled with libpoppler version %s\n",
+                     PNG_LIBPNG_VER_STRING, png_libpng_ver,
+                     ZLIB_VERSION, zlib_version, xpdfVersion);
+ }
diff --git a/debian/patches/30_libpoppler_0.5.9 b/debian/patches/30_libpoppler_0.5.9
new file mode 100644
index 0000000..f5a028d
--- /dev/null
+++ b/debian/patches/30_libpoppler_0.5.9
@@ -0,0 +1,454 @@
+# 30_libpoppler.dpatch
+#
+# use libpoppler instead of libxpdf in pdfetex and xetex
+# don't build pdftosrc as it needs libpoppler from experimental 
+
+ at DPATCH@
+ configure                           |    6 -
+ configure.in                        |    8 -
+ texk/web2c/pdftexdir/Makefile.in    |    2 
+ texk/web2c/pdftexdir/depend.mk      |   58 ----------
+ texk/web2c/pdftexdir/pdftex.mk      |    9 +
+ texk/web2c/pdftexdir/pdftexextra.in |    2 
+ texk/web2c/pdftexdir/pdftoepdf.cc   |   41 +++----
+ texk/web2c/pdftexdir/pdftosrc.cc    |   39 +++---
+ texk/web2c/pdftexdir/utils.c        |    4 
+ texk/web2c/xetexdir/XeTeX_ext.c     |    4 
+ texk/web2c/xetexdir/pdfimage.cpp    |   24 +++-
+ texk/web2c/xetexdir/xetex.mk        |    8 +
+ 12 files changed, 88 insertions(+), 117 deletions(-)
+
+Index: texlive-bin-2008.svn12198/texk/web2c/pdftexdir/depend.mk
+===================================================================
+--- texlive-bin-2008.svn12198.orig/texk/web2c/pdftexdir/depend.mk	2008-03-23 17:38:33.000000000 +0100
++++ texlive-bin-2008.svn12198/texk/web2c/pdftexdir/depend.mk	2009-02-21 22:40:51.000000000 +0100
+@@ -1,55 +1,5 @@
+-epdf.o: epdf.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
+- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h
+-mapfile.o: mapfile.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
+- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h
+-papersiz.o: papersiz.c ptexlib.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h
+-utils.o: utils.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
+- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h \
+- ../../../libs/zlib/zlib.h ../../../libs/zlib/zconf.h \
+- ../../../libs/md5/md5.h pdftexextra.h \
+- ../../../libs/obsdcompat/openbsd-compat.h
+-vfpacket.o: vfpacket.c ptexlib.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h
+-pkin.o: pkin.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
+- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h
+-writefont.o: writefont.c ../../../libs/xpdf/goo/gmem.h ptexlib.h \
+- ../pdftexd.h ../texmfmp.h ../cpascal.h ../config.h ../help.h \
+- ../texmfmem.h ../pdftexcoerce.h ptexmac.h
+-writet1.o: writet1.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
+- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h
+-writet3.o: writet3.c ptexlib.h ../pdftexd.h ../texmfmp.h ../cpascal.h \
+- ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h ptexmac.h
+-writezip.o: writezip.c ptexlib.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h ../../../libs/zlib/zlib.h ../../../libs/zlib/zconf.h
+-writeenc.o: writeenc.c ptexlib.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h
+-writettf.o: writettf.c ptexlib.h writettf.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h macnames.c
+-writejpg.o: writejpg.c ptexlib.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h image.h
+-writepng.o: writepng.c ptexlib.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h image.h
+-writeimg.o: writeimg.c ptexlib.h ../pdftexd.h ../texmfmp.h \
+- ../cpascal.h ../config.h ../help.h ../texmfmem.h ../pdftexcoerce.h \
+- ptexmac.h image.h
+-pdftoepdf.o: pdftoepdf.cc ../../../libs/xpdf/xpdf/Object.h \
+- ../../../libs/xpdf/goo/gmem.h ../../../libs/xpdf/xpdf/Array.h \
+- ../../../libs/xpdf/xpdf/Dict.h ../../../libs/xpdf/xpdf/Stream.h \
+- ../../../libs/xpdf/xpdf/XRef.h ../../../libs/xpdf/xpdf/Catalog.h \
+- ../../../libs/xpdf/xpdf/Page.h ../../../libs/xpdf/xpdf/GfxFont.h \
+- ../../../libs/xpdf/xpdf/Error.h epdf.h
++pdftoepdf.o: pdftoepdf.cc epdf.h ../../kpathsea/c-auto.h \
++  ../../kpathsea/c-proto.h ../../web2c/c-auto.h ../../web2c/config.h \
++  ../../kpathsea/c-fopen.h ../../web2c/pdftexdir/ptexmac.h
+ ttf2afm.o: ttf2afm.c writettf.h macnames.c
+-pdftosrc.o: pdftosrc.cc ../../../libs/xpdf/xpdf/Object.h \
+- ../../../libs/xpdf/xpdf/Array.h ../../../libs/xpdf/xpdf/Dict.h \
+- ../../../libs/xpdf/xpdf/Stream.h ../../../libs/xpdf/xpdf/XRef.h \
+- ../../../libs/xpdf/xpdf/Catalog.h ../../../libs/xpdf/xpdf/Page.h \
+- ../../../libs/xpdf/xpdf/PDFDoc.h ../../../libs/xpdf/xpdf/Link.h \
+- ../../../libs/xpdf/xpdf/Error.h ../../../libs/xpdf/xpdf/config.h
++pdftosrc.o: pdftosrc.cc
+Index: texlive-bin-2008.svn12198/texk/web2c/pdftexdir/pdftoepdf.cc
+===================================================================
+--- texlive-bin-2008.svn12198.orig/texk/web2c/pdftexdir/pdftoepdf.cc	2008-08-12 19:15:53.000000000 +0200
++++ texlive-bin-2008.svn12198/texk/web2c/pdftexdir/pdftoepdf.cc	2009-02-21 22:40:51.000000000 +0100
+@@ -24,25 +24,24 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <ctype.h>
+-#include <aconf.h>
+-#include <GString.h>
+-#include <gmem.h>
+-#include <gfile.h>
+-#include <config.h>
+ #include <assert.h>
+-#include "Object.h"
+-#include "Stream.h"
+-#include "Array.h"
+-#include "Dict.h"
+-#include "XRef.h"
+-#include "Catalog.h"
+-#include "Link.h"
+-#include "Page.h"
+-#include "GfxFont.h"
+-#include "PDFDoc.h"
+-#include "GlobalParams.h"
+-#include "Error.h"
+-
++#include <dirent.h>
++#include <poppler/poppler-config.h>
++#include <poppler/goo/GooString.h>
++#include <poppler/goo/gmem.h>
++#include <poppler/goo/gfile.h>
++#include "poppler/Object.h"
++#include "poppler/Stream.h"
++#include "poppler/Array.h"
++#include "poppler/Dict.h"
++#include "poppler/XRef.h"
++#include "poppler/Link.h"
++#include "poppler/Catalog.h"
++#include "poppler/Page.h"
++#include "poppler/GfxFont.h"
++#include "poppler/PDFDoc.h"
++#include "poppler/GlobalParams.h"
++#include "poppler/Error.h"
+ #include "epdf.h"
+ 
+ static const char _svn_version[] =
+@@ -159,7 +158,7 @@
+     fprintf(stderr, "\npdfTeX Debug: Creating %s (%d)\n", p->file_name,
+             p->occurences);
+ #endif
+-    GString *docName = new GString(p->file_name);
++    GooString *docName = new GooString(p->file_name);
+     p->doc = new PDFDoc(docName);       // takes ownership of docName
+     if (!p->doc->isOk() || !p->doc->okToPrint()) {
+         pdftex_fail("xpdf: reading PDF image failed");
+@@ -520,7 +519,7 @@
+     int i, l, c;
+     Ref ref;
+     char *p;
+-    GString *s;
++    GooString *s;
+     if (obj->isBool()) {
+         pdf_printf("%s", obj->getBool()? "true" : "false");
+     } else if (obj->isInt()) {
+@@ -713,7 +712,7 @@
+     epdf_num_pages = pdf_doc->doc->getCatalog()->getNumPages();
+     if (page_name) {
+         // get page by name
+-        GString name(page_name);
++        GooString name(page_name);
+         LinkDest *link = pdf_doc->doc->findDest(&name);
+         if (link == 0 || !link->isOk())
+             pdftex_fail("PDF inclusion: invalid destination <%s>", page_name);
+Index: texlive-bin-2008.svn12198/texk/web2c/pdftexdir/pdftosrc.cc
+===================================================================
+--- texlive-bin-2008.svn12198.orig/texk/web2c/pdftexdir/pdftosrc.cc	2008-05-08 16:25:16.000000000 +0200
++++ texlive-bin-2008.svn12198/texk/web2c/pdftexdir/pdftosrc.cc	2009-02-21 22:40:51.000000000 +0100
+@@ -23,22 +23,23 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <ctype.h>
+-#include <aconf.h>
+ #include <assert.h>
+-#include <GString.h>
+-#include <gmem.h>
+-#include <gfile.h>
+-#include "Object.h"
+-#include "Stream.h"
+-#include "Array.h"
+-#include "Dict.h"
+-#include "XRef.h"
+-#include "Catalog.h"
+-#include "Page.h"
+-#include "GfxFont.h"
+-#include "PDFDoc.h"
+-#include "GlobalParams.h"
+-#include "Error.h"
++
++#include <dirent.h>
++#include <poppler/goo/GooString.h>
++#include <poppler/goo/gmem.h>
++#include <poppler/goo/gfile.h>
++#include "poppler/Object.h"
++#include "poppler/Stream.h"
++#include "poppler/Array.h"
++#include "poppler/Dict.h"
++#include "poppler/XRef.h"
++#include "poppler/Catalog.h"
++#include "poppler/Page.h"
++#include "poppler/GfxFont.h"
++#include "poppler/PDFDoc.h"
++#include "poppler/GlobalParams.h"
++#include "poppler/Error.h"
+ 
+ static const char _svn_version[] =
+     "$Id: pdftosrc.cc 7945 2008-05-08 14:25:16Z martin $ $URL: http://scm.foundry.supelec.fr/svn/pdftex/branches/stable/source/src/texk/web2c/pdftexdir/pdftosrc.cc $";
+@@ -49,7 +50,7 @@
+ {
+     char *p, buf[1024];
+     PDFDoc *doc;
+-    GString *fileName;
++    GooString *fileName;
+     Stream *s;
+     Object srcStream, srcName, catalogDict;
+     FILE *outfile;
+@@ -63,8 +64,8 @@
+                 "Usage: pdftosrc <PDF-file> [<stream-object-number>]\n");
+         exit(1);
+     }
+-    fileName = new GString(argv[1]);
+-    globalParams = new GlobalParams();
++    fileName = new GooString(argv[1]);
++    globalParams = new GlobalParams(NULL);
+     doc = new PDFDoc(fileName);
+     if (!doc->isOk()) {
+         fprintf(stderr, "Invalid PDF file\n");
+@@ -84,7 +85,7 @@
+     }
+     srcStream.initNull();
+     if (objnum == 0) {
+-        catalogDict.dictLookup("SourceObject", &srcStream);
++        catalogDict.dictLookup(UGooString("SourceObject"), &srcStream);
+         if (!srcStream.isStream("SourceFile")) {
+             fprintf(stderr, "No SourceObject found\n");
+             exit(1);
+Index: texlive-bin-2008.svn12198/texk/web2c/pdftexdir/Makefile.in
+===================================================================
+--- texlive-bin-2008.svn12198.orig/texk/web2c/pdftexdir/Makefile.in	2008-07-17 19:58:14.000000000 +0200
++++ texlive-bin-2008.svn12198/texk/web2c/pdftexdir/Makefile.in	2009-02-21 22:42:43.000000000 +0100
+@@ -11,7 +11,7 @@
+ ALL_CXXFLAGS = @CXXFLAGS@ @DEFS@ $(XXCFLAGS) \
+   -I. -I$(srcdir) \
+   -I$(kpathsea_dir_parent) -I$(kpathsea_srcdir_parent) \
+-  @LIBXPDFCPPFLAGS@ \
++  -I/usr/include/poppler \
+   -I$(LIBOBSDCOMPATDIR) -I$(LIBOBSDCOMPATDIR)/.. \
+   -I$(LIBOBSDCOMPATSRCDIR) -I$(LIBOBSDCOMPATSRCDIR)/.. \
+   -DPDF_PARSER_ONLY
+Index: texlive-bin-2008.svn12198/texk/web2c/pdftexdir/pdftex.mk
+===================================================================
+--- texlive-bin-2008.svn12198.orig/texk/web2c/pdftexdir/pdftex.mk	2008-07-11 08:51:52.000000000 +0200
++++ texlive-bin-2008.svn12198/texk/web2c/pdftexdir/pdftex.mk	2009-02-21 22:40:51.000000000 +0100
+@@ -3,6 +3,9 @@
+ # differ between releases of pdfeTeX.
+ # $Id: pdftex.mk 9446 2008-07-11 06:51:52Z thanh $
+ 
++# use libpoppler instead of included xpdf code
++ADDLDFLAGS = -lpoppler
++
+ # We build pdftex
+ pdftex = @PETEX@ pdftex
+ pdftexdir = pdftexdir
+@@ -30,7 +33,7 @@
+ 
+ # Making pdftex
+ pdftex: pdftexd.h $(pdftex_o) $(pdftexextra_o) $(pdftexlibsdep)
+-	@CXXHACKLINK@ $(pdftex_o) $(pdftexextra_o) $(pdftexlibs) $(socketlibs) @CXXHACKLDLIBS@ @CXXLDEXTRA@
++	@CXXHACKLINK@ $(pdftex_o) $(pdftexextra_o) $(pdftexlibs) $(socketlibs) @CXXHACKLDLIBS@ @CXXLDEXTRA@ $(ADDLDFLAGS)
+ 
+ # C file dependencies.
+ $(pdftex_c) pdftexcoerce.h pdftexd.h: pdftex.p $(web2c_texmf) $(srcdir)/$(pdftexdir)/pdftex.defines $(srcdir)/$(pdftexdir)/pdftex.h
+@@ -135,10 +138,10 @@
+ 	rm -f ttf2afm.c macnames.c
+ # 

+ # pdftosrc
+-pdftosrc = pdftosrc
++pdftosrc = 
+ 
+ pdftosrc: $(pdftexdir)/pdftosrc.o $(LIBXPDFDEP)
+-	@CXXHACKLINK@ $(pdftexdir)/pdftosrc.o $(LDLIBXPDF) -lm @CXXLDEXTRA@
++	@CXXHACKLINK@ $(pdftexdir)/pdftosrc.o $(LDLIBXPDF) -lm @CXXLDEXTRA@  $(ADDLDFLAGS)
+ $(pdftexdir)/pdftosrc.o:$(srcdir)/$(pdftexdir)/pdftosrc.cc
+ 	cd $(pdftexdir) && $(MAKE) pdftosrc.o
+ check: pdftosrc-check
+Index: texlive-bin-2008.svn12198/configure
+===================================================================
+--- texlive-bin-2008.svn12198.orig/configure	2009-02-21 22:34:42.000000000 +0100
++++ texlive-bin-2008.svn12198/configure	2009-02-21 22:40:51.000000000 +0100
+@@ -6835,9 +6835,9 @@
+ 
+ # we need libxpdf for pdf[ex]tex, xetex
+ test ! -d $srcdir/$LIBXPDFDIR && : ${needs_libxpdf=no}
+-test "$with_pdftex"  != no    && : ${needs_libxpdf=yes}
+-test "$with_pdfetex" != no    && : ${needs_libxpdf=yes}
+-test "$with_xetex"   != no    && : ${needs_libxpdf=yes}
++test "$with_pdftex"  != no    && : ${needs_libxpdf=no}
++test "$with_pdfetex" != no    && : ${needs_libxpdf=no}
++test "$with_xetex"   != no    && : ${needs_libxpdf=no}
+ : ${needs_libxpdf=no}
+ export needs_libxpdf
+ 
+Index: texlive-bin-2008.svn12198/configure.in
+===================================================================
+--- texlive-bin-2008.svn12198.orig/configure.in	2009-02-21 22:34:42.000000000 +0100
++++ texlive-bin-2008.svn12198/configure.in	2009-02-21 22:43:36.000000000 +0100
+@@ -163,9 +163,9 @@
+ 
+ # we need libxpdf for pdf[ex]tex, xetex
+ test ! -d $srcdir/$LIBXPDFDIR && : ${needs_libxpdf=no}
+-test "$with_pdftex"  != no    && : ${needs_libxpdf=yes}
+-test "$with_pdfetex" != no    && : ${needs_libxpdf=yes}
+-test "$with_xetex"   != no    && : ${needs_libxpdf=yes}
++test "$with_pdftex"  != no    && : ${needs_libxpdf=no}
++test "$with_pdfetex" != no    && : ${needs_libxpdf=no}
++test "$with_xetex"   != no    && : ${needs_libxpdf=no}
+ : ${needs_libxpdf=no}
+ export needs_libxpdf
+ 
+@@ -220,7 +220,7 @@
+ sinclude(libs/ncurses/ncurses.ac)
+ sinclude(libs/zlib/zlib.ac)
+ sinclude(libs/libpng/libpng.ac)
+-sinclude(libs/xpdf/libxpdf.ac)
++#sinclude(libs/xpdf/libxpdf.ac)
+ sinclude(libs/t1lib/t1lib.ac)
+ sinclude(libs/freetype/freetype.ac)
+ sinclude(libs/freetype2/freetype2.ac)
+Index: texlive-bin-2008.svn12198/texk/web2c/xetexdir/XeTeX_ext.c
+===================================================================
+--- texlive-bin-2008.svn12198.orig/texk/web2c/xetexdir/XeTeX_ext.c	2008-08-01 15:54:24.000000000 +0200
++++ texlive-bin-2008.svn12198/texk/web2c/xetexdir/XeTeX_ext.c	2009-02-21 22:40:51.000000000 +0100
+@@ -33,7 +33,7 @@
+  */
+ 
+ #ifdef XETEX_OTHER
+-#include "xpdf/config.h"
++#include "poppler/poppler-config.h"
+ #include "png.h"
+ #endif
+ 
+@@ -190,7 +190,7 @@
+ #else
+ 		"Compiled with fontconfig version %d.%d.%d; using %d.%d.%d\n"
+ 		"Compiled with libpng version %s; using %s\n"
+-		"Compiled with xpdf version %s\n"
++		"Compiled with libpoppler version %s\n"
+ #endif
+ 		;
+ 
+Index: texlive-bin-2008.svn12198/texk/web2c/xetexdir/pdfimage.cpp
+===================================================================
+--- texlive-bin-2008.svn12198.orig/texk/web2c/xetexdir/pdfimage.cpp	2008-05-21 15:43:19.000000000 +0200
++++ texlive-bin-2008.svn12198/texk/web2c/xetexdir/pdfimage.cpp	2009-02-21 22:40:51.000000000 +0100
+@@ -11,10 +11,24 @@
+ 
+ #include "pdfimage.h"
+ 
+-#include "PDFDoc.h"
+-#include "Catalog.h"
+-#include "Page.h"
+-#include "GString.h"
++#include <dirent.h>
++#include <poppler/poppler-config.h>
++#include <poppler/goo/GooString.h>
++#include <poppler/goo/gmem.h>
++#include <poppler/goo/gfile.h>
++#include "poppler/Object.h"
++#include "poppler/Stream.h"
++#include "poppler/Array.h"
++#include "poppler/Dict.h"
++#include "poppler/XRef.h"
++#include "poppler/Link.h"
++#include "poppler/Catalog.h"
++#include "poppler/Page.h"
++#include "poppler/GfxFont.h"
++#include "poppler/PDFDoc.h"
++#include "poppler/GlobalParams.h"
++#include "poppler/Error.h"
++
+ 
+ #include "XeTeX_ext.h"
+ 
+@@ -29,7 +43,7 @@
+ pdf_get_rect(char* filename, int page_num, int pdf_box, realrect* box)
+ 	/* return the box converted to TeX points */
+ {
+-	GString*	name = new GString(filename);
++	GooString*	name = new GooString(filename);
+ 	PDFDoc*		doc = new PDFDoc(name);
+ 	
+ 	if (!doc) {
+Index: texlive-bin-2008.svn12198/texk/web2c/xetexdir/xetex.mk
+===================================================================
+--- texlive-bin-2008.svn12198.orig/texk/web2c/xetexdir/xetex.mk	2008-06-03 17:24:50.000000000 +0200
++++ texlive-bin-2008.svn12198/texk/web2c/xetexdir/xetex.mk	2009-02-21 22:45:11.000000000 +0100
+@@ -8,6 +8,10 @@
+ # but need to check possible effect on other programs
+ ALL_CXXFLAGS = @CXXFLAGS@
+ 
++# use libpoppler instead of included xpdf code
++ADDLDFLAGS = -lpoppler
++
++
+ # We build xetex unless configure decides to skip it
+ xetex = @XETEX@ xetex
+ 
+@@ -33,7 +37,7 @@
+ 
+ @XETEX_GENERIC@ XETEX_DEFINES = -DXETEX_OTHER
+ 
+- at XETEX_GENERIC@ EXTRALIBS = @LDLIBXPDF@ @LDLIBPNG@ @LDFONTCONFIG@
++ at XETEX_GENERIC@ EXTRALIBS = @LDLIBXPDF@ @LDLIBPNG@ @LDFONTCONFIG@ $(ADDLDFLAGS)
+ 
+ @XETEX_GENERIC@ EXTRADEPS = @LIBXPDFDEP@ @LIBPNGDEP@
+ 
+@@ -168,7 +172,7 @@
+ 	$(compile) $(ALL_CFLAGS) $(FTFLAGS) $(LIBPNGCPPFLAGS) $(ZLIBCPPFLAGS) -c $< -o $@
+ 
+ pdfimage.o: $(srcdir)/xetexdir/pdfimage.cpp $(srcdir)/xetexdir/pdfimage.h
+-	$(CXX) $(ALL_CFLAGS) $(FTFLAGS) $(LIBXPDFCPPFLAGS) -c $< -o $@
++	$(CXX) $(ALL_CFLAGS) $(FTFLAGS) $(LIBXPDFCPPFLAGS) -I/usr/include/poppler -c $< -o $@
+ 
+ XeTeX_pic.o: $(srcdir)/xetexdir/XeTeX_pic.c $(srcdir)/xetexdir/XeTeX_ext.h $(XeTeXImageHdrs)
+ 	$(compile) $(TECKITFLAGS) $(FTFLAGS) $(ALL_CFLAGS) $(XETEX_DEFINES) -c $< -o $@
+Index: texlive-bin-2008.svn12198/texk/web2c/pdftexdir/utils.c
+===================================================================
+--- texlive-bin-2008.svn12198.orig/texk/web2c/pdftexdir/utils.c	2008-05-08 16:25:16.000000000 +0200
++++ texlive-bin-2008.svn12198/texk/web2c/pdftexdir/utils.c	2009-02-21 22:40:51.000000000 +0100
+@@ -35,7 +35,7 @@
+ #include "zlib.h"
+ #include "ptexlib.h"
+ #include "png.h"
+-#include "xpdf/config.h"        /* just to get the xpdf version */
++#include "poppler/poppler-config.h"        /* just to get the xpdf version */
+ 
+ static const char _svn_version[] =
+     "$Id: utils.c 7945 2008-05-08 14:25:16Z martin $ $URL: http://scm.foundry.supelec.fr/svn/pdftex/branches/stable/source/src/texk/web2c/pdftexdir/utils.c $";
+@@ -1267,7 +1267,7 @@
+     (void) asprintf(versions,
+                     "Compiled with libpng %s; using libpng %s\n"
+                     "Compiled with zlib %s; using zlib %s\n"
+-                    "Compiled with xpdf version %s\n",
++                    "Compiled with libpoppler version %s\n",
+                     PNG_LIBPNG_VER_STRING, png_libpng_ver,
+                     ZLIB_VERSION, zlib_version, xpdfVersion);
+ }
+Index: texlive-bin-2008.svn12198/texk/web2c/pdftexdir/pdftexextra.in
+===================================================================
+--- texlive-bin-2008.svn12198.orig/texk/web2c/pdftexdir/pdftexextra.in	2008-03-23 17:38:33.000000000 +0100
++++ texlive-bin-2008.svn12198/texk/web2c/pdftexdir/pdftexextra.in	2009-02-21 22:46:18.000000000 +0100
+@@ -26,7 +26,7 @@
+    (generated from ../lib/texmfmp.c).
+ */
+ 
+-#define BANNER "This is pdfTeX, Version 3.1415926-PDFTEX-VERSION-ETEX-VERSION"
++#define BANNER "This is pdfTeX using libpoppler, Version 3.1415926-PDFTEX-VERSION-ETEX-VERSION"
+ #define COPYRIGHT_HOLDER "Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX)"
+ #define AUTHOR NULL
+ #define PROGRAM_HELP PDFTEXHELP
diff --git a/debian/patches/41_maketexmf b/debian/patches/41_maketexmf
new file mode 100644
index 0000000..a4c2564
--- /dev/null
+++ b/debian/patches/41_maketexmf
@@ -0,0 +1,43 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 41_maketexmf.dpatch
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: fix for mktexmf script from perforce depot
+
+ at DPATCH@
+ texk/kpathsea/mktexmf |   19 +++++++++++--------
+ 1 file changed, 11 insertions(+), 8 deletions(-)
+
+Index: texlive-bin-2009~svn13478/texk/kpathsea/mktexmf
+===================================================================
+--- texlive-bin-2009~svn13478.orig/texk/kpathsea/mktexmf	2009-05-26 11:00:24.000000000 +0200
++++ texlive-bin-2009~svn13478/texk/kpathsea/mktexmf	2009-05-27 22:44:43.000000000 +0200
+@@ -36,17 +36,20 @@
+   rootfile=$sauterroot
+   rootname=b-$rootname
+ else
+-  case $rootname in
++  case $name in
+     # csso12[0-5][0-9] from CJK package; unsupported by mktexmf
+     csso12[0-5][0-9])
+-       rootfile=;;
+-    cs*|lcsss*|icscsc*|icstt*|ilcsss*)
+-       rootfile=`kpsewhich cscode.mf`;;
+-    wn[bcdfirstuv]*|rx[bcdfiorstuvx][bcfhilmostx]|l[abcdhl][bcdfiorstuvx]*)
+-       lhprefix=`echo "$name" | sed 's/^\(..\).*/\1/'`
+-       rootfile=`kpsewhich ${lhprefix}codes.mf 2>/dev/null`;;
++      rootfile=;;
+     *)
+-       rootfile=`kpsewhich $rootname.mf 2>/dev/null`;;
++      case $rootname in
++        cs*|lcsss*|icscsc*|icstt*|ilcsss*)
++          rootfile=`kpsewhich cscode.mf`;;
++        wn[bcdfirstuv]*|rx[bcdfiorstuvx][bcfhilmostx]|l[abcdhl][bcdfiorstuvx]*)
++          lhprefix=`echo "$name" | sed 's/^\(..\).*/\1/'`
++          rootfile=`kpsewhich ${lhprefix}codes.mf 2>/dev/null`;;
++        *)
++          rootfile=`kpsewhich $rootname.mf 2>/dev/null`;;
++      esac;;
+   esac
+ fi
+ { test -z "$rootfile" || test ! -f "$rootfile"; } && exit 1
diff --git a/debian/patches/50_fmtutil_deb b/debian/patches/50_fmtutil_deb
new file mode 100644
index 0000000..334849a
--- /dev/null
+++ b/debian/patches/50_fmtutil_deb
@@ -0,0 +1,103 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 50_fmtutil_deb.dpatch
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: debianize fmtutil, updmap etc, taken from tetex
+
+ at DPATCH@
+ texk/tetex/fmtutil     |   28 +++++++++-------------------
+ texk/tetex/fmtutil.man |    7 +++++--
+ 2 files changed, 14 insertions(+), 21 deletions(-)
+
+Index: texlive-bin-2011.20120216/texk/tetex/fmtutil.man
+===================================================================
+--- texlive-bin-2011.20120216.orig/texk/tetex/fmtutil.man	2011-06-28 06:32:19.000000000 +0900
++++ texlive-bin-2011.20120216/texk/tetex/fmtutil.man	2012-02-17 10:41:07.061487176 +0900
+@@ -45,7 +45,7 @@
+ no-op in TeX Live
+ .TP
+ .BI --enablefmt \ formatname
+-ensable
++enable
+ .I formatname
+ in config file
+ .TP
+@@ -100,8 +100,11 @@
+ .TP
+ .I fmtutil\&.cnf
+ default configuration file
++.IP "\fI/etc/texmf/fmt.d/\fP"
++Debian-specific directory for configuration file snippets
+ .SH "SEE ALSO"
+-.BR kpsewhich (1)
++.BR kpsewhich (1),
++\fBupdate-fmtutil\fP(1)
+ .SH "BUGS"
+ None known, but report any bugs found to <tex-k at tug.org> (mailing list).
+ .SH "AUTHOR"
+Index: texlive-bin-2011.20120216/texk/tetex/fmtutil
+===================================================================
+--- texlive-bin-2011.20120216.orig/texk/tetex/fmtutil	2011-06-28 06:32:19.000000000 +0900
++++ texlive-bin-2011.20120216/texk/tetex/fmtutil	2012-02-17 10:42:46.161039803 +0900
+@@ -541,9 +541,11 @@
+       grep -v '^ *#' "$cnf_file" | sed 's@^ *@@; s@ *$@@' | grep . | sort
+       cleanup $? ;;
+     edit)
+-      echo "$0: fmtutil --edit is disabled in TeX Live;" >&2
+-      echo "$0: use a file fmtutil-local.cnf instead." >&2
+-      echo "$0: See tlmgr --help or http://tug.org/texlive/doc/tlmgr.html." >&2
++      # defined by debianize-fmtutil
++      debianEditWarnAndShow
++      #echo "$0: fmtutil --edit is disabled in TeX Live;" >&2
++      #echo "$0: use a file fmtutil-local.cnf instead." >&2
++      #echo "$0: See tlmgr --help or http://tug.org/texlive/doc/tlmgr.html." >&2
+       cleanup 0 ;;
+     enablefmt|disablefmt)
+       $cmd $arg ;;  # does not return
+@@ -555,22 +557,6 @@
+       cleanup $? ;;
+   esac
+ 
+-  if test -n "$cfgmaint"; then
+-    if test -z "$cfgparam"; then
+-      ci=`tcfmgr --tmp $tmpdir --cmd ci --id $id`
+-      if test $? = 0; then
+-        if test -n "$ci"; then
+-          verboseMsg "$progname: configuration file updated: \`$ci'"
+-        else
+-          verboseMsg "$progname: configuration file unchanged."
+-        fi
+-      else
+-        abort "failed to update configuration file."
+-      fi
+-    fi
+-    cleanup $?
+-  fi
+-
+   # set up destdir:
+   if test -z "$destdir"; then
+     : ${MT_TEXMFVAR=`kpsewhich -var-value=TEXMFVAR`}
+@@ -984,6 +970,7 @@
+ ###############################################################################
+ # disablefmt(format)
+ #   disables format in configuration file
++#    [ redefined by debianize-fmtutil ]
+ ###############################################################################
+ disablefmt()
+ {
+@@ -1000,6 +987,7 @@
+ ###############################################################################
+ #  enablefmt(format)
+ #    enables format in configuration file
++#    [ redefined by debianize-fmtutil ]
+ ###############################################################################
+ enablefmt()
+ {
+@@ -1012,5 +1000,7 @@
+   (exit 0); return 0
+ }
+ 
++. /usr/share/texlive-bin/debianize-fmtutil
++
+ main ${1+"$@"}
+ cleanup 0
diff --git a/debian/patches/51_fmtutil_keep_failedlog b/debian/patches/51_fmtutil_keep_failedlog
new file mode 100644
index 0000000..5af0382
--- /dev/null
+++ b/debian/patches/51_fmtutil_keep_failedlog
@@ -0,0 +1,26 @@
+---
+ texk/tetex/fmtutil |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+Index: texlive-bin-2011.20120216/texk/tetex/fmtutil
+===================================================================
+--- texlive-bin-2011.20120216.orig/texk/tetex/fmtutil	2012-02-17 10:42:46.161039803 +0900
++++ texlive-bin-2011.20120216/texk/tetex/fmtutil	2012-02-17 10:42:59.924975955 +0900
+@@ -762,7 +762,6 @@
+       log_warning "\`$engine -ini $tcxflag $jobswitch $prgswitch $texargs' possibly failed."
+ 
+     # We don't want user-interaction for the following "mv" commands:
+-    mv "$format.log" "$fulldestdir/$format.log" </dev/null
+     #
+     destfile=$fulldestdir/$fmtfile
+     if mv "$fmtfile" "$destfile" </dev/null; then
+@@ -801,6 +800,9 @@
+   else
+     log_failure "\`$engine -ini $tcxflag $jobswitch $prgswitch $texargs' failed"
+   fi
++  rm -f "$fulldestdir/$format.log"
++  # We don't want user-interaction for the following "mv" command:
++  mv "$format.log" "$fulldestdir/$format.log" </dev/null
+ }
+ 
+ ###############################################################################
diff --git a/debian/patches/52_feynmf-perl-sec-fix b/debian/patches/52_feynmf-perl-sec-fix
new file mode 100644
index 0000000..13c2d4f
--- /dev/null
+++ b/debian/patches/52_feynmf-perl-sec-fix
@@ -0,0 +1,31 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 52_feynmf-perl-sec-fix.dpatch by Kevin B. McCarty
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: secure tmp file handling
+
+ at DPATCH@
+--- ./texmf-dist/source/texlive-20080816-source/latex/feynmf/feynmf.pl.orig
++++ ./texmf-dist/source/texlive-20080816-source/latex/feynmf/feynmf.pl
+@@ -270,10 +270,11 @@
+     my @tfm = @_;
+     # Prepare a fake temporary PL file
+     # (/dev/null won't do, because the font must not be empty):
+-    my ($pl) = "/tmp/feynmf$$.pl";
++    my ($pl) = `/bin/tempfile -p feynmf -s .pl`;
+     my ($tfm);
+     $pltotf_prog
+ 	or die "feynmf: fatal: pltopf programm required unless -notfm\n";
++    chop ($pl);
+     open (PL, ">$pl") or die "feynmf: can't open temporary file $pl: $!\n";
+     push @temporay_files, $pl;
+     print PL <<__END_PL__;
+@@ -373,7 +374,7 @@
+ 			maybe_run "$gftopk_prog $gf" if $gftopk_prog;
+ 		    }
+ 		}
+-		close (<LOG>);
++		close (LOG);
+ 	    }
+ 	}
+     }
diff --git a/debian/patches/53_builtin-searchpath-fix b/debian/patches/53_builtin-searchpath-fix
new file mode 100644
index 0000000..af8b613
--- /dev/null
+++ b/debian/patches/53_builtin-searchpath-fix
@@ -0,0 +1,56 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 53_builtin-searchpath-fix.dpatch
+##
+## DP: adjust built-in search paths for kpathsea library to Debian standard
+
+ at DPATCH@
+ texk/kpathsea/texmf.cnf |   14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+Index: texlive-bin-2011.20120216/texk/kpathsea/texmf.cnf
+===================================================================
+--- texlive-bin-2011.20120216.orig/texk/kpathsea/texmf.cnf	2011-12-22 08:58:58.000000000 +0900
++++ texlive-bin-2011.20120216/texk/kpathsea/texmf.cnf	2012-02-17 10:44:42.948485022 +0900
+@@ -53,19 +53,19 @@
+ 
+ % The tree containing runtime files related to the specific
+ % distribution and version.
+-TEXMFMAIN = $TEXMFROOT/texmf
++TEXMFMAIN = /usr/share/texmf
+ 
+ % The main tree of packages, distribution-agnostic:
+-TEXMFDIST = $TEXMFROOT/texmf-dist
++TEXMFDIST = /usr/share/texmf-dist
+ 
+ % Local additions to the distribution trees.
+-TEXMFLOCAL = $TEXMFROOT/../texmf-local
++TEXMFLOCAL = /usr/local/share/texmf
+ 
+ % TEXMFSYSVAR, where *-sys store cached runtime data.
+-TEXMFSYSVAR = $TEXMFROOT/texmf-var
++TEXMFSYSVAR = /var/lib/texmf
+ 
+ % TEXMFSYSCONFIG, where *-sys store configuration data.
+-TEXMFSYSCONFIG = $TEXMFROOT/texmf-config
++TEXMFSYSCONFIG = /etc/texmf
+ 
+ % Per-user texmf tree(s) -- organized per the TDS, as usual.  To define
+ % more than one per-user tree, set this to a list of directories in
+@@ -111,7 +111,7 @@
+ % Where generated fonts may be written.  This tree is used when the sources
+ % were found in a system tree and either that tree wasn't writable, or the
+ % varfonts feature was enabled in MT_FEATURES in mktex.cnf.
+-VARTEXFONTS = $TEXMFVAR/fonts
++VARTEXFONTS = /var/cache/fonts
+ 
+ % On some systems, there will be a system tree which contains all the font
+ % files that may be created as well as the formats.  For example
+@@ -463,7 +463,7 @@
+ % 
+ % For security reasons, it is better not to include . in this path.
+ %
+-TEXMFCNF = {$SELFAUTOLOC,$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}
++TEXMFCNF = /usr/share/texmf/web2c;/usr/share/texmf-texlive/web2c;/usr/local/share/texmf/web2c
+ 
+ % kpathsea 3.5.3 and later sets these at runtime. To avoid empty
+ % expansions from binaries linked against an earlier version of the
diff --git a/debian/patches/55_texconfig_stuff b/debian/patches/55_texconfig_stuff
new file mode 100644
index 0000000..6045950
--- /dev/null
+++ b/debian/patches/55_texconfig_stuff
@@ -0,0 +1,179 @@
+55_texconfig_stuff 
+- expand texconfig man page, some random texconfig fixes
+- remove code that texconfig formats is not longer supported and refer to tlmgr
+  we rely on fmtutil being debianized and let texconfig work as before.
+--
+ texk/tetex/texconfig     |   52 ++++++++++++-----------------------------------
+ texk/tetex/texconfig.man |   28 ++++++++++++++++++++++++-
+ 2 files changed, 41 insertions(+), 39 deletions(-)
+
+Index: texlive-bin-2011.20120216/texk/tetex/texconfig
+===================================================================
+--- texlive-bin-2011.20120216.orig/texk/tetex/texconfig	2011-01-07 20:45:38.000000000 +0900
++++ texlive-bin-2011.20120216/texk/tetex/texconfig	2012-02-17 10:45:03.752383135 +0900
+@@ -567,7 +567,7 @@
+        $progname help                  (or --help; show this help)
+        $progname hyphen FORMAT         (edit hyphenation config for FORMAT)
+        $progname init [FORMAT]...      (rebuild FORMATs, or all formats
+-                                        plus run texlinks and updmap)
++                                        plus run updmap)
+        $progname mode MODE             (set Metafont MODE)
+        $progname paper PAPER           (set default paper size to PAPER)
+        $progname pdftex [OPTION]...    (pdftex options)
+@@ -890,8 +890,8 @@
+ 
+     faq)
+       setupTexmfmain
+-      if test -f $MT_TEXMFMAIN/doc/tetex/teTeX-FAQ; then
+-        <$MT_TEXMFMAIN/doc/tetex/teTeX-FAQ eval ${PAGER-more}
++      if test -f $MT_TEXMFDIST/doc/tetex/teTeX-FAQ.gz; then
++        <$MT_TEXMFDIST/doc/tetex/teTeX-FAQ.gz eval zcat | ${PAGER-sensible-pager}
+       else
+         echo "$progname: faq not found (usually in \$TEXMFMAIN/doc/tetex/teTeX-FAQ)" >&2
+         rc=1
+@@ -931,16 +931,19 @@
+               ;;
+             *)
+               tcBatchFontVardir=$3
+-              tfc=`kpsewhich texmf.cnf`
++	      tfcs=$(grep -l '^[[:space:]]*VARTEXFONTS[[:space:]]*=' /etc/texmf/texmf.d/*.cnf)
++	      # last match wins
++	      for file in $tfcs; do tfc=$file; done
+               if test -n "$tfc"; then
+                 if test -w "$tfc"; then
+                   configReplace "$tfc" '^VARTEXFONTS' "VARTEXFONTS  = $tcBatchFontVardir"
++		  update-texmf
+                 else
+                   echo "$progname: setting up vardir failed. Reason: no permission to write file \`$tfc'" >&2
+                   rc=1
+                 fi
+               else
+-                echo "$progname: setting up vardir failed. Reason: failed to find file texmf.cnf" >&2
++                echo "$progname: setting up vardir failed. Reason: failed to find file \`$tfc'" >&2
+                 rc=1
+               fi
+               ;;
+@@ -1007,21 +1010,6 @@
+       ;;
+ 
+     formats)
+-      cat >&2 <<EOM
+-texconfig formats is no longer supported, because manual edits of
+-fmtutil.cnf will be overwritten by the new TeX Live package manager,
+-tlmgr, which regenerates that file as needed upon package changes.
+-Thus, to add or remove formats, the recommended method is to use tlmgr
+-to add or remove the appropriate package.
+-
+-If you need to make manual additions, you can edit the file
+-fmtutil-local.cnf under TEXMFLOCAL.  Further information with
+-tlmgr --help and at http://tug.org/texlive/tlmgr.html.
+-
+-Exiting.
+-EOM
+-      exit 1  # but leave the real code for posterity
+-
+       setupTmpDir
+       echo "$progname: analyzing old configuration..." >&2
+       fmtutil --catcfg > $tmpdir/pre
+@@ -1037,7 +1025,6 @@
+         for i in `awk '{print $1}' $tmpdir/addOrChange`; do
+           fmtutil --byfmt "$i" || rc=1
+         done
+-        texlinks --multiplatform || rc=1
+       fi
+       ;;
+ 
+@@ -1047,22 +1034,6 @@
+ 
+     # "hyphen FORMAT"
+     hyphen)
+-      cat >&2 <<EOM
+-texconfig hyphen is no longer supported, because manual edits of
+-language.dat (or language.def) will be overwritten by the new TeX Live
+-package manager, tlmgr, which regenerates those configuration files as
+-needed upon package changes.  Thus, to add or remove hyphenation
+-patterns, the recommended method is to use tlmgr to add or remove the
+-appropriate package.
+-
+-If you need to make manual additions, you can edit the files
+-language-local.dat and language-local.def under TEXMFLOCAL.  Further
+-information with tlmgr --help and at http://tug.org/texlive/tlmgr.html.
+-
+-Exiting.
+-EOM
+-      exit 1  # but leave the real code for posterity
+-
+       tcBatchHyphenFormat=$2
+       formatsForHyphen=`getFormatsForHyphen`
+       formatsForHyphenFmt=`echo "$formatsForHyphen" | myFmt | sed 's@^@  @'`
+@@ -1084,6 +1055,11 @@
+                 rc=1
+                 return
+                 ;;
++	      /var/lib/texmf/*)
++		echo "$progname: The hyphenation file for $tcBatchHyphenFormat is a generated file in Debian"
++		echo "You cannot use this texconfig command, use \`update-language(1)' instead."
++		echo "Please read its manual page or /usr/share/tex-common/TeX-on-Debian*"
++		;;
+             esac
+ 
+             getRelDir "$tcBatchHyphenFile"
+@@ -1111,7 +1087,7 @@
+                 fi
+                 ;;
+             esac
+-            ${VISUAL-${EDITOR-vi}} "$tcBatchHFEdit"
++            ${VISUAL:-${EDITOR:-sensible-editor}} "$tcBatchHFEdit"
+             if cmp "$tcBatchHFEdit" "$tcBatchHFOrig" >/dev/null 2>&1; then
+               echo "$progname: configuration unchanged." >&2
+             else
+Index: texlive-bin-2011.20120216/texk/tetex/texconfig.man
+===================================================================
+--- texlive-bin-2011.20120216.orig/texk/tetex/texconfig.man	2011-09-29 21:14:07.000000000 +0900
++++ texlive-bin-2011.20120216/texk/tetex/texconfig.man	2012-02-17 10:46:05.492075357 +0900
+@@ -46,6 +46,20 @@
+ .IR TEXMFSYSCONFIG .
+ (You may need to be root to do this.)
+ .PP
++Note that on a Debian system, changes to formats, font setup,
++hyphenation for different languages, etc. should not be done with
++texconfig, because
++.B fmtutil.cnf(5), updmap.cfg(5), texmf.cnf
++and
++.B language.dat
++are generated files in Debian.  See
++.I TeX-on-Debian.pdf, TeX-on-Debian.txt.gz
++or
++.I TeX-on-Debian.html/index.html
++in
++.I /usr/share/doc/tex-common/
++for alternatives.
++.PP
+ .I texconfig
+ also offers a non-interactive batch mode which can be accessed with
+ the following commands
+@@ -128,11 +142,23 @@
+ (and their answers).
+ .TP
+ .B font vardir DIR, font ro, font rw
++These options should not be used on a Debian system unless you really
++know what you are doing.  For details, look at the output of
++.B texconfig fonts
++and read section 2.5, font caching, in the TeX-on-Debian documentation
++in
++.I /usr/share/doc/tex-common/.
+ .TP
+ .B formats
+ This command allows to edit
+ .B fmtutil.cnf(5)
+-and (re)creates any new or changed formats afterwards.  
++and (re)creates any new or changed formats afterwards.  It should not
++be used on Debian systems, unless you want to temporarily create and
++test a specific format, because
++.B fmtutil.cnf(5)
++is a generated file in Debian, and changes will be overwritten.  See
++.B update-fmtutil
++for details.
+ .TP
+ .B hyphen FORMAT
+ This command allows to edit the hyphenation configuration file for
diff --git a/debian/patches/56_updmap_deb b/debian/patches/56_updmap_deb
new file mode 100644
index 0000000..54a0a22
--- /dev/null
+++ b/debian/patches/56_updmap_deb
@@ -0,0 +1,143 @@
+---
+ texk/tetex/updmap     |   23 ++++++++++++++++-------
+ texk/tetex/updmap.man |   27 +++++++++++++++++++--------
+ 2 files changed, 35 insertions(+), 15 deletions(-)
+
+Index: texlive-bin-2009~svn15596/texk/tetex/updmap.man
+===================================================================
+--- texlive-bin-2009~svn15596.orig/texk/tetex/updmap.man	2009-08-15 08:13:49.000000000 +0900
++++ texlive-bin-2009~svn15596/texk/tetex/updmap.man	2009-10-03 23:37:05.000000000 +0900
+@@ -32,11 +32,20 @@
+ line, \fBupdmap\fP will write generated map files to a directory of
+ your choosing (via one of the \fB--*outputdir\fP options), or automatically
+ determine where to place the files\&.  In the latter case, it tries to
+-use the tree where the variable TEXMFVAR points to.
++use the tree where the variable TEXMFVAR -- or TEXMFSYSVAR if called
++as \fBupdmap-sys\fP -- points to.
++.PP
+ When used with the options \fB--edit\fP, \fB--setoption\fP,
+-\fB--enable\fP, \fB--disable\fP, or \fB--syncwithtrees\fP, \fBupdmap\fP will first write
+-\fBupdmap\&.cfg\fP(5) and regenerate the map files only if this file
+-has been changed\&.
++\fB--enable\fP, \fB--disable\fP, or \fB--syncwithtrees\fP,
++\fBupdmap\fP will first write \fBupdmap\&.cfg\fP(5) and regenerate the
++map files only if this file has been changed\&.  In Debian, updmap has
++been adapted so that \fB--enable\fP and \fB--disable\fP do the "right
++thing": change the configuration snippets in \fIupdmap.d\fP instead,
++call \fBupdate-updmap\fP(1) to regenerate \fBupdmap\&.cfg\fP(5) and
++regenerate the map files afterwards.  There are some limitations,
++though: \fBupdmap\fP will regenerate the map files even if
++\fBupdmap\&.cfg\fP(5) has not been changed, and \fB--edit\fP and
++\fB--syncwithtrees\fP cannot be used.
+ .PP
+ .SH "OPTIONS"
+ .PP
+@@ -98,10 +107,10 @@
+ \fBdvipdfmDownloadBase14\fP
+ .IP
+ .IP "\fB--enable\fP \fImaptype\fP \fImapfile\fP"
+-Add or enable a \fBMap\fP or \fBMixedMap\fP for \fImapfile\fP\&.
++Permanently add or enable a \fBMap\fP or \fBMixedMap\fP for \fImapfile\fP\&.
+ .IP
+ .IP "\fB--enable Map=\fImapfile\fP"
+-Add or enable a Map for \fImapfile\fP\&.
++Permanently add or enable a Map for \fImapfile\fP\&.
+ .IP
+ .IP "\fB--enable MixedMap=\fP\fImapfile\fP"
+ Add or enable a MixedMap for \fImapfile\fP\&.
+@@ -126,7 +135,9 @@
+ .IP "\fIupdmap\&.cfg\fP"
+ Main configuration file\&.  In
+ \fItexmf/web2c\fP by default, but may be located elsewhere
+-depending on your distribution\&.
++depending on your distribution\&. \fBNote for Debian\fP: On Debian
+++ that file is generated out of files in \fI/etc/texmf/updmap.d\fP.
+++ See \fBupdate-updmap\fP(8) or the \fITeX-on-Debian\fP document.
+ .IP
+ .IP "\fIdvips35\&.map\fP"
+ Map file for standard 35 PostScript fonts for
+@@ -240,7 +251,7 @@
+ .PP
+ .SH "SEE ALSO"
+ .PP
+-\fBupdmap\&.cfg\fP(5), \fBdvipdfm\fP(1), \fBdvips\fP(1),
++\fBupdmap\&.cfg\fP(5), \fBupdate-updmap\fP(8), \fBdvipdfm\fP(1), \fBdvips\fP(1),
+ \fBgsftopk\fP(1), \fBpdftex\fP(1), \fBps2pk\fP(1),
+ \fBtexhash\fP(1), \fBxdvi\fP(1)\&.
+ .PP
+Index: texlive-bin-2009~svn15596/texk/tetex/updmap
+===================================================================
+--- texlive-bin-2009~svn15596.orig/texk/tetex/updmap	2009-07-24 02:09:15.000000000 +0900
++++ texlive-bin-2009~svn15596/texk/tetex/updmap	2009-10-03 23:37:05.000000000 +0900
+@@ -350,6 +350,8 @@
+ #   sets option to value in the config file (replacing the existing setting
+ #   or by adding a new line to the config file).
+ ###############################################################################
++# for Debian, this is superseded by a function defined in debianize-updmap
++# (see below)
+ setOption()
+ {
+   opt=$1
+@@ -384,6 +386,8 @@
+ # enableMap (type, map)
+ #   enables an entry in the config file for map with a given type.
+ ###############################################################################
++# for Debian, this is superseded by a function defined in debianize-updmap
++# (see below)
+ enableMap()
+ {
+   case $1 in
+@@ -406,6 +410,8 @@
+ # disableMap (map)
+ #   disables map in config file (any type)
+ ###############################################################################
++# for Debian, this is superseded by a function defined in debianize-updmap
++# (see below)
+ disableMap()
+ {
+   #mapType=`awk '($1 == "MixedMap" || $1 == "Map") && $2 == map { print $1 }' \
+@@ -759,12 +765,8 @@
+ !!! ERROR! The map file \`$2' has not been found at all.
+ 
+     Either put this file into the right place or remove the
+-    reference from the configuration file. An automatic way
+-    to disable unavailable map files is to call
+-      $progname --syncwithtrees
+-
+-    For manual editing, call
+-      $progname --edit
++    reference from the configuration files - see
++    update-updmap(1).
+ "
+ 
+     false; return 1
+@@ -1071,6 +1073,8 @@
+ #   update the config file: uncomment all lines which refer to map files that
+ #   are unavailabe in the texmf trees
+ ###############################################################################
++# for Debian, this is superseded by a function defined in debianize-updmap
++# (see below)
+ syncWithTrees()
+ {
+   for i in `egrep '^(Mixed)?Map' "$cnfFile" | sed 's at .* @@'`; do
+@@ -1084,6 +1088,11 @@
+ }
+ 
+ ###############################################################################
++# source Debian-specific changes, superseding the last three functions
++###############################################################################
++. /usr/share/tex-common/debianize-updmap
++
++###############################################################################
+ # normalizeLines()
+ #   remove comments, whitespace is exactly one space, no empty lines,
+ #   no whitespace at end of line, one space before and after ",
+@@ -1386,7 +1395,7 @@
+ 
+     case "$cmd" in
+       edit)
+-        ${VISUAL-${EDITOR-vi}} "$cnfFile";;
++	debianEditWarnAndShow;;
+       setoption)
+         setOption "$setoptionOpt" "$setoptionVal";;
+       enable)
diff --git a/debian/patches/57_texconfig_papersizes_for_upstream b/debian/patches/57_texconfig_papersizes_for_upstream
new file mode 100644
index 0000000..1fd5360
--- /dev/null
+++ b/debian/patches/57_texconfig_papersizes_for_upstream
@@ -0,0 +1,524 @@
+---
+ texk/tetex/texconfig |  346 ++++++++++++++++++++++++++++++++++++++++++++-------
+ 1 file changed, 301 insertions(+), 45 deletions(-)
+
+
+Index: texlive-bin-2011.20120216/texk/tetex/texconfig
+===================================================================
+--- texlive-bin-2011.20120216.orig/texk/tetex/texconfig	2012-02-17 10:45:03.000000000 +0900
++++ texlive-bin-2011.20120216/texk/tetex/texconfig	2012-02-17 10:47:57.239498209 +0900
+@@ -25,7 +25,7 @@
+ progname=texconfig
+ 
+ # the version string
+-version='$Id$'
++version='$Id$'plus_paperconf
+ 
+ envVars="
+   AFMFONTS BIBINPUTS BSTINPUTS CMAPFONTS CWEBINPUTS ENCFONTS GFFONTS
+@@ -333,6 +333,18 @@
+ }
+ 
+ ###############################################################################
++# fmgrConfigShowPaper (file regex)
++#   shows the paper setting in file, according to regex
++#
++fmgrConfigShow()
++{
++  fmgrConfigShowFile=`tcfmgr --cmd find --file $1`
++  fmgrConfigShowRegex=$2
++
++  sed -n "$fmgrConfigShowRegex" $fmgrConfigShowFile
++}
++
++###############################################################################
+ # fmgrConfigReplace (file regex value)
+ #   replaces line matching regex by value in file
+ #
+@@ -546,6 +558,178 @@
+ 
+ # 

+ ###############################################################################
++# Main functions,
++#   called from tcBatch with original positional parameters shifted by 1
++###############################################################################
++
++###############################################################################
++# SizeToPaper
++#   Convert paper dimensions to a unique paper name
++###############################################################################
++SizeToPaper()
++{
++  UsageSizeToPaper="Usage: texconfig size-to-paper height width"
++  case $1 in
++    "")
++      echo $UsageSizeToPaper >&2
++      ;;
++    *)
++      AskedHeight=$1
++      AskedWidth=$2
++      locateConfigPsFile
++      papername=$(listDvipsPapers | \
++	grep "$AskedWidth[[:space:]]*$AskedHeight" | \
++	sed 's/[[:space:]].*//' \
++	)
++      if [ ! -n "$papername" ] || [ "$papername" = "unknown" ] || [ "$papername" = "nopaper" ]; then
++	echo "No paper configured with height $AskedHeight and width $AskedWidth"  >&2
++	echo "in file /etc/texmf/dvips/config/config.ps."
++	echo "Known units are mm and in, decimal separator is \`.'"
++	echo "Maybe height and width have been exchanged, or units changed?" >&2
++	cleanup 1
++      else
++	if [ $(echo $papername | wc -w) -gt 1 ]; then
++	  # filter out duplicates.  This command line shows duplicates in the current config.ps:
++	  # ./texconfig dvips paper-list | \
++	  #     sed 's/\([[:alnum:]]*\)[[:space:]]\(.*\)/\2 \1/' | \
++	  #     sort | \
++	  #     sed 's/\(.*\)[[:space:]]\([[:alnum:]]*\)/\2 \1/' | \
++	  #     uniq -D -f 1
++	  papernameList=$papername
++	  papername=$(echo $papername | \
++	    sed 's/11x17//;s/statement//;s/a4size//;s/letterSize//;s/flse//;s/[[:space:]]//g' \
++	    )
++	  echo $papername
++	fi
++	:
++      fi
++      ;;
++  esac
++}
++
++###############################################################################
++# PaperToSize
++#   Convert paper name to dimensions, values taken from config.ps
++###############################################################################
++PaperToSize()
++{
++  UsagePaperToSize="Usage: texconfig paper-to-size [-m|--machine-readable] papername"
++  sparseOutput=0
++  case $1 in
++    -m|--machine-readable)
++      sparseOutput=1
++      shift
++      ;;
++  esac
++  case $1 in
++    "")
++      echo $UsagePaperToSize >&2
++      ;;
++    *)
++      AskedPaper=$1
++      locateConfigPsFile
++      paperline=$(listDvipsPapers | grep "^$AskedPaper[[:space:]]")
++      if [ ! -n "$paperline" ]; then
++	echo "unknown paper size: $AskedPaper" >&2
++	cleanup 1
++      fi
++      allowedUnitLetters="min"
++      width=$(echo $paperline | sed \
++	"s/.*['\'']\([[:digit:].]*[$allowedUnitLetters][$allowedUnitLetters]\).*/\1/" \
++	)
++      height=$(echo $paperline | sed \
++	"s/.*[[:space:]]\([[:digit:].]*[$allowedUnitLetters][$allowedUnitLetters]\).$/\1/" \
++	)
++      if [ $sparseOutput = 1 ]; then
++	echo $height $width
++      else
++	echo "Paper $AskedPaper has height $height and width $width"
++      fi
++      ;;
++  esac
++
++}
++
++###############################################################################
++# pdftexSetPaper
++#   set paper for pdftex
++###############################################################################
++pdftexSetPaper()
++{
++  pdfPaperHelp="Usage: $progname pdftex paper PAPER"
++
++  pdfPaperName="$1"
++
++  if [ -z $pdfPaperName ]; then
++    echo "$help" >&2
++    rc=1
++    return $rc
++  fi
++
++  pdfPaperDims=$(PaperToSize -m $pdfPaperName)
++  PaperHeight=$(echo $pdfPaperDims | sed 's/ .*//') # keep value before blank
++  PaperWidth=$( echo $pdfPaperDims | sed 's/.* //') # keep value after blank
++
++  pdfPaperHeight=$(echo $PaperHeight | sed 's/mm/ true mm/;s/in/ true in/')
++  pdfPaperWidth=$( echo $PaperWidth  | sed 's/mm/ true mm/;s/in/ true in/')
++
++  setupTmpDir
++  fmgrConfigReplace pdftexconfig.tex pdfpagewidth '\pdfpagewidth='"$pdfPaperWidth"
++  wChanged=$fmgrConfigReplaceChanged
++  fmgrConfigReplace pdftexconfig.tex pdfpageheight '\pdfpageheight='"$pdfPaperHeight"
++  if $wChanged || $fmgrConfigReplaceChanged; then
++    echo "pdftex paper size has changed, refreshing formats"
++    fmtutil --refresh
++  fi
++}
++
++###############################################################################
++# pdftexPaperConf
++#   get paper for pdftex
++###############################################################################
++pdftexPaperConf(){
++  pdftexconfig=`tcfmgr --cmd find --file pdftexconfig.tex`
++  pdftexPaperWidth=$(sed -n '/^\\pdfpagewidth/ {s/^\\pdfpagewidth=//;s/ true //;p}' $pdftexconfig)
++  pdftexPaperHeight=$(sed -n '/^\\pdfpageheight/ {s/^\\pdfpageheight=//;s/ true //;p}' $pdftexconfig)
++
++  SizeToPaper $pdftexPaperHeight $pdftexPaperWidth
++}
++
++###############################################################################
++# dvipdfmPaperConf
++#   get paper for dvipdfm
++###############################################################################
++dvipdfmPaperConf(){
++  fmgrConfigShow config '/^p/ {s/^p //;p}'
++}
++
++###############################################################################
++# dvipdfmxPaperConf
++#   get paper for dvipdfmx
++###############################################################################
++dvipdfmxPaperConf(){
++  fmgrConfigShow dvipdfmx.cfg '/^p/ {s/^p //;p}'
++}
++
++###############################################################################
++# dvipsPaperConf
++#   get paper for dvips
++###############################################################################
++dvipsPaperConf(){
++  locateConfigPsFile
++  fmgrConfigShow config.ps '/^@ / {s/^@ \([^[:space:]]*\).*/\1/;p;q}'
++}
++
++###############################################################################
++# XDviPaperConf
++#   get paper for XDvi
++###############################################################################
++XDviPaperConf(){
++  fmgrConfigShow XDvi '/^\*paper:/ {s/^\*paper: \([^[:space:]]*\).*/\1/;p;q}'
++}
++
++# 

++###############################################################################
+ # tcBatch(args)
+ #   handle batch mode
+ ###############################################################################
+@@ -616,6 +800,18 @@
+       echo
+       echo '==== kpathsea variables from environment only (ok if no output here) ===='
+       echoShowVariable $envVars
++      echo
++      echo '========================== default paper sizes =========================='
++      echo -n "dvipdfm: "
++      dvipdfmPaperConf
++      echo -n "dvipdfmx: "
++      dvipdfmxPaperConf
++      echo -n "dvips: "
++      dvipsPaperConf
++      echo -n "pdftex: "
++      pdftexPaperConf
++      echo -n "XDvi: "
++      XDviPaperConf
+       ;;
+ 
+     # texconfig dvipdfm
+@@ -639,6 +835,9 @@
+              echo "$progname: try \`$progname dvipdfm paper' for help" >&2
+              rc=1 ;;
+           esac ;;
++	paperconf)
++	  dvipdfmPaperConf
++	  ;;
+         # texconfig dvipdfm ""
+         "")
+           echo "$help" >&2; rc=1 ;;
+@@ -673,6 +872,9 @@
+              rc=1 ;;
+           esac ;;
+         # texconfig dvipdfmx ""
++	paperconf)
++	  dvipdfmxPaperConf
++	  ;;
+         "")
+           echo "$help" >&2; rc=1 ;;
+         # texconfig dvipdfmx <unknown>
+@@ -690,6 +892,7 @@
+       help="Usage: $progname dvips add PRINTER
+        $progname dvips del PRINTER
+        $progname dvips paper PAPER
++       $progname dvips paper-list
+        $progname dvips [-P PRINTER] mode MODE
+        $progname dvips [-P PRINTER] offset OFFSET
+        $progname dvips [-P PRINTER] printcmd CMD"
+@@ -822,6 +1025,9 @@
+               ;;
+           esac
+           ;;
++	paperconf)
++	  dvipsPaperConf
++	  ;;
+         mode)
+           case $2 in
+             "")
+@@ -1189,23 +1395,25 @@
+       help="Usage: $progname paper PAPER
+ 
+ Valid PAPER settings:
+-  letter a4"
++  a0 a1 a10 a2 a3 a4 a5 a6 a7 a8 a9 b0 b1 b2 b3 b4 b5 b6 c5 ledger legal letter tabloid"
+ 
+-      p=$2; pXdvi=$2; pDvips=$2
++      p=$2
+       case $2 in
+-        letter)
+-          pXdvi=us;;
+-        a4)
+-          pXdvi=a4;;
++	a0|a1|a10|a2|a3|a4|a5|a6|a7|a8|a9|b0|b1|b2|b3|b4|b5|b6|c5|ledger|legal|letter|tabloid)
++	  # handled by xdvi and dvips (and hence all others)
++	  :
++	  ;;
+         "") echo "$help" >&2; rc=1; return;;
+         *)
+-          echo "$progname: unknown PAPER \`$2' given as argument for \`$progname paper'" >&2
++          echo "$progname: PAPER \`$2' is not understood by all programs." >&2
+           echo "$progname: try \`$progname paper' for help" >&2
++	  echo "           or use \`$progname PROGNAME paper $2' instead " >&2
++	  echo "           for the programs you need." >&2
+           rc=1
+           return;;
+       esac
+       if checkForBinary dvips >/dev/null && tcfmgr --cmd find --file config.ps >/dev/null 2>&1; then
+-        tcBatch dvips paper $pDvips
++        tcBatch dvips paper $p
+       fi
+       if checkForBinary dvipdfm >/dev/null && tcfmgr --cmd find --file config >/dev/null 2>&1; then
+         tcBatch dvipdfm paper $p
+@@ -1214,7 +1422,7 @@
+         tcBatch dvipdfmx paper $p
+       fi
+       if checkForBinary xdvi >/dev/null && tcfmgr --cmd find --file XDvi >/dev/null 2>&1; then
+-        tcBatch xdvi paper $pXdvi
++        tcBatch xdvi paper $p
+       fi
+       if checkForBinary pdftex >/dev/null && tcfmgr --cmd find --file pdftexconfig.tex >/dev/null 2>&1; then
+         tcBatch pdftex paper $p
+@@ -1222,10 +1430,16 @@
+       ;;
+ 
+     pdftex)
+-      help="Usage: $progname pdftex paper PAPER
++      help="Usage:
++       $progname pdftex paper PAPER
+ 
+-Valid PAPER settings:
+-  a4 letter"
++          Valid PAPER settings: Same as for dvips, use
++            $progname dvips paper-list
++          to get a list of valid PAPER values.
++
++       $progname pdftex paperconf
++       $progname pdftex mode MODE
++"
+       case $2 in
+ 
+         mode)
+@@ -1253,32 +1467,12 @@
+           ;;
+ 
+         paper)
+-          case $3 in
+-            letter)
+-              w="8.5 true in"; h="11 true in"
+-              setupTmpDir
+-              fmgrConfigReplace pdftexconfig.tex pdfpagewidth '\pdfpagewidth='"$w"
+-              wChanged=$fmgrConfigReplaceChanged
+-              fmgrConfigReplace pdftexconfig.tex pdfpageheight '\pdfpageheight='"$h"
+-              if $wChanged || $fmgrConfigReplaceChanged; then
+-                fmtutil --refresh
+-              fi
+-              ;;
+-            a4)
+-              w="210 true mm"; h="297 true mm"
+-              fmgrConfigReplace pdftexconfig.tex pdfpagewidth '\pdfpagewidth='"$w"
+-              wChanged=$fmgrConfigReplaceChanged
+-              fmgrConfigReplace pdftexconfig.tex pdfpageheight '\pdfpageheight='"$h"
+-              if $wChanged || $fmgrConfigReplaceChanged; then
+-                fmtutil --refresh
+-              fi
+-              ;;
+-            "") echo "$help" >&2; rc=1;;
+-            *)
+-             echo "$progname: unknown PAPER \`$3' given as argument for \`$progname pdftex paper'" >&2
+-             echo "$progname: try \`$progname pdftex paper' for help" >&2
+-             rc=1 ;;
+-          esac ;;
++	  shift; shift
++	  pdftexSetPaper $@
++	  ;;
++	paperconf)
++	  pdftexPaperConf
++	  ;;
+         "")
+           echo "$help" >&2; rc=1;;
+         *)
+@@ -1303,10 +1497,17 @@
+ 
+     # handle "xdvi paper PAPER"
+     xdvi)
++      # 20100125: added paper sizes found in xdvi.c, version.h says 22.84.16 in TeXLive 2010
+       tcBatchXdviPapers='us           "8.5x11"
++letter       "8.5x11"
+ usr          "11x8.5"
++ledger       "17x11"
++tabloid      "11x17"
+ legal        "8.5x14"
++legalr       "14x8.5"
+ foolscap     "13.5x17.0"
++foolscap     "17.0x13.5"
++a0           "84.1x118.9cm"
+ a1           "59.4x84.0cm"
+ a2           "42.0x59.4cm"
+ a3           "29.7x42.0cm"
+@@ -1314,6 +1515,10 @@
+ a5           "14.85x21.0cm"
+ a6           "10.5x14.85cm"
+ a7           "7.42x10.5cm"
++a8           "5.2x7.4cm"
++a9           "3.7x5.2cm"
++a10          "2.6x3.7cm"
++a0r          "118.9x84.1cm"
+ a1r          "84.0x59.4cm"
+ a2r          "59.4x42.0cm"
+ a3r          "42.0x29.7cm"
+@@ -1321,6 +1526,10 @@
+ a5r          "21.0x14.85cm"
+ a6r          "14.85x10.5cm"
+ a7r          "10.5x7.42cm"
++a8r          "7.4x5.2cm"
++a9r          "5.2x3.7cm"
++a10r         "3.7x2.6cm"
++b0           "1000.0x141.4cm"
+ b1           "70.6x100.0cm"
+ b2           "50.0x70.6cm"
+ b3           "35.3x50.0cm"
+@@ -1328,6 +1537,10 @@
+ b5           "17.6x25.0cm"
+ b6           "13.5x17.6cm"
+ b7           "8.8x13.5cm"
++b8           "6.2x8.8cm"
++b9           "4.4x6.2cm"
++b10          "3.1x4.4cm"
++b0           "141.4x100cm"
+ b1r          "100.0x70.6cm"
+ b2r          "70.6x50.0cm"
+ b3r          "50.0x35.3cm"
+@@ -1335,6 +1548,10 @@
+ b5r          "25.0x17.6cm"
+ b6r          "17.6x13.5cm"
+ b7r          "13.5x8.8cm"
++b8r          "8.8x6.2cm"
++b9r          "6.2x4.4cm"
++b10r         "4.4x3.1cm"
++c0           "91.7x129.7cm"
+ c1           "64.8x91.6cm"
+ c2           "45.8x64.8cm"
+ c3           "32.4x45.8cm"
+@@ -1342,27 +1559,35 @@
+ c5           "16.2x22.9cm"
+ c6           "11.46x16.2cm"
+ c7           "8.1x11.46cm"
++c8           "5.7x8.1cm"
++c9           "4.0x5.7cm"
++c10          "2.8x4.0cm"
++c0r          "129.7x91.7cm"
+ c1r          "91.6x64.8cm"
+ c2r          "64.8x45.8cm"
+ c3r          "45.8x32.4cm"
+ c4r          "32.4x22.9cm"
+ c5r          "22.9x16.2cm"
+ c6r          "16.2x11.46cm"
+-c7r          "11.46x8.1cm"'
++c7r          "11.46x8.1cm"
++c8r          "8.1x5.7cm"
++c9r          "5.7x4.0cm"
++c10r         "4.0x2.8cm"'
+       help="Usage: $progname xdvi paper PAPER
+ 
+ Valid PAPER settings:
+-  a1 a1r a2 a2r a3 a3r a4 a4r a5 a5r a6 a6r a7 a7r
+-  b1 b1r b2 b2r b3 b3r b4 b4r b5 b5r b6 b6r b7 b7r
+-  c1 c1r c2 c2r c3 c3r c4 c4r c5 c5r c6 c6r c7 c7r
+-  foolscap legal us usr"
++  a0 a0r a1 a1r a2 a2r a3 a3r a4 a4r a5 a5r a6 a6r a7 a7r a8 a8r a9 a9r a10 a10r
++  b0 b0r b1 b1r b2 b2r b3 b3r b4 b4r b5 b5r b6 b6r b7 b7r b8 b8r b9 b9r b10 b10r
++  c0 c0r c1 c1r c2 c2r c3 c3r c4 c4r c5 c5r c6 c6r c7 c7r c8 c8r c9 c9r c10 c10r
++  foolscap foolscapr legal legalr us|letter usr ledger tabloid"
+       case $2 in
+         paper-list)
+           echo "$tcBatchXdviPapers"
+           ;;
+         paper)
+           case $3 in
+-            a1|a1r|a2|a2r|a3|a3r|a4|a4r|a5|a5r|a6|a6r|a7|a7r|b1|b1r|b2|b2r|b3|b3r|b4|b4r|b5|b5r|b6|b6r|b7|b7r|c1|c1r|c2|c2r|c3|c3r|c4|c4r|c5|c5r|c6|c6r|c7|c7r|foolscap|legal|us|usr)
++	    # 20100125: added paper sizes found in xdvi.c, version.h says 22.84.16 in TeXLive 2010
++            a0|a1|a1r|a2|a2r|a3|a3r|a4|a4r|a5|a5r|a6|a6r|a7|a7r|a8|a8r|a9|a9r|a10|a10r|b0|b0r|b1|b1r|b2|b2r|b3|b3r|b4|b4r|b5|b5r|b6|b6r|b7|b7r|b8|b8r|b9|b9r|b10|b10r|c0|c0r|c1|c1r|c2|c2r|c3|c3r|c4|c4r|c5|c5r|c6|c6r|c7|c7r|c8|c8r|c9|c9r|c10|c10r|foolscap|foolscapr|legal|legalr|us|usr|letter|ledger|tabloid)
+               fmgrConfigReplace XDvi paper: "*paper: $3"
+               ;;
+             "") echo "$help" >&2; rc=1;;
+@@ -1371,6 +1596,9 @@
+              echo "$progname: try \`$progname xdvi paper' for help" >&2
+              rc=1 ;;
+           esac ;;
++	paperconf)
++	  XDviPaperConf
++	  ;;
+         "")
+           echo "$help" >&2; rc=1;;
+         *)
+@@ -1380,6 +1608,34 @@
+           ;;
+       esac
+       ;;
++    paper-to-size)
++      shift
++      PaperToSize $@
++      ;;
++    size-to-paper)
++      shift
++      SizeToPaper $@
++      ;;
++    # compare-papers)
++    #   # this option is not meant to be used by users; therefore I don't care for insecure tempfiles
++    #   tcBatch xdvi paper-list | cut -d " " -f 1 | sort -u > ${TMPDIR:-/tmp}/xdvi.list
++    #   tcBatch dvips paper-list | cut -d " " -f 1 | sort -u > ${TMPDIR:-/tmp}/dvips.list
++    #   xdviOnly=$(comm -2 -3 ${TMPDIR:-/tmp}/xdvi.list ${TMPDIR:-/tmp}/dvips.list)
++    #   dvipsOnly=$(comm -1 -3 ${TMPDIR:-/tmp}/xdvi.list ${TMPDIR:-/tmp}/dvips.list)
++    #   knownToBoth=$(comm -1 -2 ${TMPDIR:-/tmp}/xdvi.list ${TMPDIR:-/tmp}/dvips.list)
++    #   echo "xdvi only:"
++    #   eval echo $xdviOnly
++    #   echo
++    #   echo
++    #   echo "dvips only:"
++    #   eval echo $dvipsOnly
++    #   echo
++    #   echo
++    #   echo "known to both:"
++    #   eval echo $knownToBoth
++    #   rm ${TMPDIR:-/tmp}/dvips.list
++    #   rm ${TMPDIR:-/tmp}/xdvi.list
++    #   ;;
+     *)
+       echo "$progname: unknown option \`$1' given as argument for \`$progname'" >&2
+       echo "$progname: try \`$progname help' for help" >&2
diff --git a/debian/patches/58_texconfig_papersizes_use_ucf b/debian/patches/58_texconfig_papersizes_use_ucf
new file mode 100644
index 0000000..4edc8c9
--- /dev/null
+++ b/debian/patches/58_texconfig_papersizes_use_ucf
@@ -0,0 +1,203 @@
+---
+ texk/tetex/texconfig |  106 +++++++++++++++++++++++++++++++++++++--------------
+ 1 file changed, 77 insertions(+), 29 deletions(-)
+
+Index: texlive-bin-2011.20120216/texk/tetex/texconfig
+===================================================================
+--- texlive-bin-2011.20120216.orig/texk/tetex/texconfig	2012-02-17 10:47:57.239498209 +0900
++++ texlive-bin-2011.20120216/texk/tetex/texconfig	2012-02-17 10:48:08.363439360 +0900
+@@ -353,12 +353,22 @@
+   fmgrConfigReplaceChanged=false
+ 
+   moreArgs=""
++  use_ucf=false
+   while
+     case $1 in
+-      --*) moreArgs="$moreArgs $1 $2";;
++      --ucf)
++	use_ucf=true
++	shift
++	;;
++      --*)
++	moreArgs="$moreArgs $1 $2"
++	shift; shift
++	;;
+       *) break;;
+     esac
+-  do shift; shift; done
++  do
++    :
++  done
+   fmgrConfigReplaceFile=$1
+   fmgrConfigReplaceRegex=$2
+   fmgrConfigReplaceValue=$3
+@@ -372,19 +382,37 @@
+   set x $co; shift
+   fmgrConfigReplaceID=$1; fmgrConfigReplaceCfgFile=$3; fmgrConfigReplaceOrigFile=$4
+   configReplace "$fmgrConfigReplaceCfgFile" "$fmgrConfigReplaceRegex" "$fmgrConfigReplaceValue"
+-  ci=`tcfmgr --tmp $tmpdir --cmd ci --id "$fmgrConfigReplaceID"`
+-  if test $? != 0; then
+-    echo "$progname: fmgrConfigReplace ci failed for \`$fmgrConfigReplaceFile'" >&2
+-    (exit 1); return 1
+-  fi
+-  case $ci in
+-    "") :;;
+-    $lastUpdatedFile)
+-      fmgrConfigReplaceChanged=true;;
+-    *) echo "$progname: updated configuration saved as file \`$ci'" >&2
+-       fmgrConfigReplaceChanged=true
+-       lastUpdatedFile=$ci;;
+-  esac
++
++  if [ $use_ucf = true ]; then
++    # use ucf in Debian.  Since we just copied the file and made only
++    # one change, there shouldn't be any need for prompting.  But since
++    # texconfig might be called by a maintainer script with debconf
++    # running, pass the option, if only to prevent it from nagging.
++    if ! $(diff $fmgrConfigReplaceCfgFile $fmgrConfigReplaceOrigFile >/dev/null); then
++      fmgrConfigReplaceChanged=true
++    fi
++    ucf --debconf-ok $fmgrConfigReplaceCfgFile $fmgrConfigReplaceOrigFile
++    # here is a bug: We should somehow check whether the file had been
++    # changed, in order to be able to recreate formats etc.
++    if test $? != 0; then
++      echo "$progname: fmgrConfigReplace failed to call ucf for \`$fmgrConfigReplaceOrigFile'" >&2
++      (exit 1); return 1
++    fi
++  else
++    ci=`tcfmgr --tmp $tmpdir --cmd ci --id "$fmgrConfigReplaceID"`
++    if test $? != 0; then
++      echo "$progname: fmgrConfigReplace ci failed for \`$fmgrConfigReplaceFile'" >&2
++      (exit 1); return 1
++    fi
++      case $ci in
++        "") :;;
++        $lastUpdatedFile)
++          fmgrConfigReplaceChanged=true;;
++        *) echo "$progname: updated configuration saved as file \`$ci'" >&2
++           fmgrConfigReplaceChanged=true
++           lastUpdatedFile=$ci;;
++      esac
++      fi
+   (exit 0); return 0
+ }
+ 
+@@ -418,11 +446,20 @@
+ 	q
+ eof
+ 
+-  ci=`tcfmgr --tmp $tmpdir --cmd ci --id "$setupDvipsPaperID"`
++  # use ucf in Debian.  Since we just copied the file and made only
++  # one change, there shouldn't be any need for prompting.  But since
++  # texconfig might be called by a maintainer script with debconf
++  # running, pass the option, if only to prevent it from nagging.
++  ucf --debconf-ok $setupDvipsPaperCfgFile $setupDvipsPaperOrigFile
+   if test $? != 0; then
+-    echo "$progname: setupDvipsPaper ci failed for \`$setupDvipsPaperFile'" >&2
++    echo "$progname: fmgrConfigReplace failed to call ucf for \`$fmgrConfigReplaceOrigFile'" >&2
+     (exit 1); return 1
+   fi
++  # ci=`tcfmgr --tmp $tmpdir --cmd ci --id "$fmgrConfigReplaceID"`
++  # if test $? != 0; then
++  #   echo "$progname: fmgrConfigReplace ci failed for \`$fmgrConfigReplaceFile'" >&2
++  #   (exit 1); return 1
++  # fi
+   case $ci in
+     "") :;;
+     $lastUpdatedFile)
+@@ -599,9 +636,8 @@
+ 	  papername=$(echo $papername | \
+ 	    sed 's/11x17//;s/statement//;s/a4size//;s/letterSize//;s/flse//;s/[[:space:]]//g' \
+ 	    )
+-	  echo $papername
+ 	fi
+-	:
++	echo $papername
+       fi
+       ;;
+   esac
+@@ -658,7 +694,9 @@
+ {
+   pdfPaperHelp="Usage: $progname pdftex paper PAPER"
+ 
++  skipFormats=false
+   pdfPaperName="$1"
++  if [ -n "$2" ] && [ "$2" = "no-recreate-formats" ]; then skipFormats=true; fi
+ 
+   if [ -z $pdfPaperName ]; then
+     echo "$help" >&2
+@@ -674,12 +712,18 @@
+   pdfPaperWidth=$( echo $PaperWidth  | sed 's/mm/ true mm/;s/in/ true in/')
+ 
+   setupTmpDir
+-  fmgrConfigReplace pdftexconfig.tex pdfpagewidth '\pdfpagewidth='"$pdfPaperWidth"
++  fmgrConfigReplace --ucf pdftexconfig.tex pdfpagewidth '\pdfpagewidth='"$pdfPaperWidth"
+   wChanged=$fmgrConfigReplaceChanged
+-  fmgrConfigReplace pdftexconfig.tex pdfpageheight '\pdfpageheight='"$pdfPaperHeight"
++  if $wChanged; then
++    # don't tell again about replacing pdftexconfig
++    fmgrConfigReplace --ucf pdftexconfig.tex pdfpageheight '\pdfpageheight='"$pdfPaperHeight" 2>/dev/null
++  else
++    fmgrConfigReplace --ucf pdftexconfig.tex pdfpageheight '\pdfpageheight='"$pdfPaperHeight"
++  fi
++  if $skipFormats; then return 0; fi
+   if $wChanged || $fmgrConfigReplaceChanged; then
+     echo "pdftex paper size has changed, refreshing formats"
+-    fmtutil --refresh
++    fmtutil --byengine pdftex 2>&1 | grep "^fmtutil"
+   fi
+ }
+ 
+@@ -708,7 +752,7 @@
+ #   get paper for dvipdfmx
+ ###############################################################################
+ dvipdfmxPaperConf(){
+-  fmgrConfigShow dvipdfmx.cfg '/^p/ {s/^p //;p}'
++  fmgrConfigShow dvipdfmx.cfg '/^p/ {s/^p[[:space:]]*//;p}'
+ }
+ 
+ ###############################################################################
+@@ -828,7 +872,7 @@
+         paper)
+           case $3 in
+             letter|legal|ledger|tabloid|a4|a3)
+-              fmgrConfigReplace config '^p' "p $3";;
++              fmgrConfigReplace --ucf config '^p' "p $3";;
+             "") echo "$help" >&2; rc=1;;
+             *)
+              echo "$progname: unknown PAPER \`$3' given as argument for \`$progname dvipdfm paper'" >&2
+@@ -864,7 +908,7 @@
+         paper)
+           case $3 in
+             letter|legal|ledger|tabloid|a4|a3)
+-              fmgrConfigReplace dvipdfmx.cfg '^p' "p $3";;
++              fmgrConfigReplace --ucf dvipdfmx.cfg '^p' "p $3";;
+             "") echo "$help" >&2; rc=1;;
+             *)
+              echo "$progname: unknown PAPER \`$3' given as argument for \`$progname dvipdfmx paper'" >&2
+@@ -1415,9 +1459,13 @@
+       if checkForBinary dvips >/dev/null && tcfmgr --cmd find --file config.ps >/dev/null 2>&1; then
+         tcBatch dvips paper $p
+       fi
+-      if checkForBinary dvipdfm >/dev/null && tcfmgr --cmd find --file config >/dev/null 2>&1; then
+-        tcBatch dvipdfm paper $p
+-      fi
++      # dvipdfm is now only a symlink to dvipdfmx. Changing the old
++      # config file doesn't make sense.  moreover, it is not under ucf
++      # control in Debian, so running the command from the libpaper
++      # hook would give false ucf questions
++      # if checkForBinary dvipdfm >/dev/null && tcfmgr --cmd find --file config >/dev/null 2>&1; then
++      #   tcBatch dvipdfm paper $p
++      # fi
+       if checkForBinary dvipdfmx >/dev/null && tcfmgr --cmd find --file dvipdfmx.cfg >/dev/null 2>&1; then
+         tcBatch dvipdfmx paper $p
+       fi
+@@ -1588,7 +1636,7 @@
+           case $3 in
+ 	    # 20100125: added paper sizes found in xdvi.c, version.h says 22.84.16 in TeXLive 2010
+             a0|a1|a1r|a2|a2r|a3|a3r|a4|a4r|a5|a5r|a6|a6r|a7|a7r|a8|a8r|a9|a9r|a10|a10r|b0|b0r|b1|b1r|b2|b2r|b3|b3r|b4|b4r|b5|b5r|b6|b6r|b7|b7r|b8|b8r|b9|b9r|b10|b10r|c0|c0r|c1|c1r|c2|c2r|c3|c3r|c4|c4r|c5|c5r|c6|c6r|c7|c7r|c8|c8r|c9|c9r|c10|c10r|foolscap|foolscapr|legal|legalr|us|usr|letter|ledger|tabloid)
+-              fmgrConfigReplace XDvi paper: "*paper: $3"
++              fmgrConfigReplace --ucf XDvi paper: "*paper: $3"
+               ;;
+             "") echo "$help" >&2; rc=1;;
+             *)
diff --git a/debian/patches/60_unneeded_linking b/debian/patches/60_unneeded_linking
new file mode 100644
index 0000000..a0d129e
--- /dev/null
+++ b/debian/patches/60_unneeded_linking
@@ -0,0 +1,17 @@
+---
+ texk/xdvik/Makefile.in |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: texlive-bin-2011.20120216/texk/xdvik/Makefile.in
+===================================================================
+--- texlive-bin-2011.20120216.orig/texk/xdvik/Makefile.in	2012-02-03 00:59:11.000000000 +0900
++++ texlive-bin-2011.20120216/texk/xdvik/Makefile.in	2012-02-17 10:50:18.606731857 +0900
+@@ -387,7 +387,7 @@
+ x_ldflags = $(X_LIBS) $(x_linker_options) $(iconv_libpath)
+ x_extra_libs = $(X_EXTRA_LIBS) $(iconv_libs)
+ xdvi_x_libs = $(x_ldflags) $(x_tool_libs) $(x_xmu_lib) -lXt \
+-	$(X_PRE_LIBS) $(x_ext_lib) $(x_xpm_libs) -lX11 $(x_extra_libs)
++	$(x_xpm_libs) -lX11 $(x_extra_libs)
+ common_ldadd = $(KPATHSEA_LIBS) $(T1LIB_LIBS) $(xdvi_x_libs)
+ common_dependencies = $(KPATHSEA_DEPEND) $(T1LIB_DEPEND)
+ libxdvi_dependencies = ${top_srcdir}/*.[ch] ${top_srcdir}/gui/*.[ch] ${top_builddir}/psheader.c
diff --git a/debian/patches/73_tex_segfault b/debian/patches/73_tex_segfault
new file mode 100644
index 0000000..72b0ca7
--- /dev/null
+++ b/debian/patches/73_tex_segfault
@@ -0,0 +1,22 @@
+--- a/texk/web2c/tex.ch	2011-07-07 21:26:55.779344956 +0200
++++ b/texk/web2c/tex.ch	2009-08-12 23:40:14.000000000 +0200
+@@ -371,7 +371,7 @@
+ {Initialize enc\TeX\ data.}
+ for i:=0 to 255 do mubyte_read[i]:=null;
+ for i:=0 to 255 do mubyte_write[i]:=0;
+-for i:=0 to 128 do mubyte_cswrite[i]:=null;
++for i:=0 to 127 do mubyte_cswrite[i]:=null;
+ mubyte_keep := 0; mubyte_start := false; 
+ write_noexpanding := false; cs_converting := false;
+ special_printing := false; message_printing := false;
+--- a/texk/web2c/xetexdir/xetex.ch	2011-07-07 21:26:55.779344956 +0200
++++ b/texk/web2c/xetexdir/xetex.ch	2011-07-07 21:26:55.779344956 +0200
+@@ -335,7 +335,7 @@
+ {Initialize enc\TeX\ data.}
+ for i:=0 to 255 do mubyte_read[i]:=null;
+ for i:=0 to 255 do mubyte_write[i]:=0;
+-for i:=0 to 128 do mubyte_cswrite[i]:=null;
++for i:=0 to 127 do mubyte_cswrite[i]:=null;
+ mubyte_keep := 0; mubyte_start := false;
+ write_noexpanding := false; cs_converting := false;
+ special_printing := false; message_printing := false;
diff --git a/debian/patches/cve-2010-0739.patch b/debian/patches/cve-2010-0739.patch
new file mode 100644
index 0000000..11c901a
--- /dev/null
+++ b/debian/patches/cve-2010-0739.patch
@@ -0,0 +1,17 @@
+Index: dospecial.c
+===================================================================
+--- a/texk/dvipsk/dospecial.c	(revision 17558)
++++ b/texk/dvipsk/dospecial.c	(revision 17569)
+@@ -297,6 +297,12 @@
+    static int omega_specials = 0;
+ 
+    if (nextstring + numbytes > maxstring) {
++      if (numbytes < 0
++          || (numbytes > 0 && 2 > INT_MAX / numbytes)
++          || 2 * numbytes > 1000 + 2 * numbytes) {
++         error("! Integer overflow in predospecial");
++         exit(1);
++      }
+       p = nextstring = mymalloc(1000 + 2 * numbytes) ;
+       maxstring = nextstring + 2 * numbytes + 700 ;
+    }
diff --git a/debian/patches/cve-2010-0827.patch b/debian/patches/cve-2010-0827.patch
new file mode 100644
index 0000000..717666e
--- /dev/null
+++ b/debian/patches/cve-2010-0827.patch
@@ -0,0 +1,28 @@
+---
+ texk/dvipsk/virtualfont.c |    6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+Index: texlive-bin-2009/texk/dvipsk/virtualfont.c
+===================================================================
+--- texlive-bin-2009.orig/texk/dvipsk/virtualfont.c	2010-05-01 02:12:57.000000000 +0900
++++ texlive-bin-2009/texk/dvipsk/virtualfont.c	2010-05-01 02:16:19.000000000 +0900
+@@ -36,7 +36,7 @@
+  *   Subroutine vfbyte returns the next byte.
+  */
+ static FILE *vffile ;
+-static char name[50] ;
++static char name[500] ;
+ void
+ badvf(char *s)
+ {
+@@ -93,6 +93,10 @@
+    if (*d==0)
+       d = vfpath ;
+ #endif
++   if (strlen(n) + 5 >= sizeof (name)) {
++     /* 5 for vf() + null */
++     error("! VF file name too long in vfopen") ; 
++   }
+ #ifdef MVSXA   /* IBM: MVS/XA */
+    (void)sprintf(name, "vf(%s)", n) ;
+ #else
diff --git a/debian/patches/cve-2010-1440 b/debian/patches/cve-2010-1440
new file mode 100644
index 0000000..a346807
--- /dev/null
+++ b/debian/patches/cve-2010-1440
@@ -0,0 +1,43 @@
+Fix for CVE-2010-1440
+From Jan Lieskovsky <jlieskov at redhat.com>
+
+  we decided to treat the CVE-2010-1440 issue as a completely
+  new tetex / texlive issue, rather than an incomplete fix for CVE-2010-0739
+  (in fact, the reproducer for CVE-2010-0739 is only catalyst / accelerator
+  to see this flaw on ppc architecture, but in fact, it's another occurrence
+  of integer overflow in teTeX / TeXLive code).
+
+---
+ texk/dvipsk/dospecial.c |   12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+Index: texlive-bin-2009/texk/dvipsk/dospecial.c
+===================================================================
+--- texlive-bin-2009.orig/texk/dvipsk/dospecial.c	2010-05-01 02:15:09.000000000 +0900
++++ texlive-bin-2009/texk/dvipsk/dospecial.c	2010-05-01 02:15:16.000000000 +0900
+@@ -333,7 +333,11 @@
+    int j ;
+    static int omega_specials = 0;
+ 
+-   if (nextstring + numbytes > maxstring) {
++   if (numbytes < 0 || numbytes > maxstring - nextstring) {
++      if (numbytes < 0 || numbytes > (INT_MAX - 1000) / 2 ) {
++         error("! Integer overflow in predospecial");
++         exit(1);
++      }
+       p = nextstring = mymalloc(1000 + 2 * numbytes) ;
+       maxstring = nextstring + 2 * numbytes + 700 ;
+    }
+@@ -918,7 +922,11 @@
+    char seen[NKEYS] ;
+    float valseen[NKEYS] ;
+ 
+-   if (nextstring + nbytes > maxstring) {
++   if (nbytes < 0 || nbytes > maxstring - nextstring) {
++      if (nbytes < 0 || nbytes > (INT_MAX - 1000) / 2 ) {
++         error("! Integer overflow in bbdospecial");
++         exit(1);
++      }
+       p = nextstring = mymalloc(1000 + 2 * nbytes) ;
+       maxstring = nextstring + 2 * nbytes + 700 ;
+    }
diff --git a/debian/patches/detex-hurd.diff b/debian/patches/detex-hurd.diff
new file mode 100644
index 0000000..483a380
--- /dev/null
+++ b/debian/patches/detex-hurd.diff
@@ -0,0 +1,22 @@
+Fix building on hurd-i386. From Samuel Thibault <samuel.thibault at ens-lyon.org>
+> There was also a problem with xxx.l which uses the NOFILE macro which is
+> linux-only.
+---
+ texk/detex/detex.l |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+Index: texlive-bin-2009/texk/detex/detex.l
+===================================================================
+--- texlive-bin-2009.orig/texk/detex/detex.l	2009-12-21 18:18:10.000000000 +0900
++++ texlive-bin-2009/texk/detex/detex.l	2009-12-21 18:18:34.000000000 +0900
+@@ -59,6 +59,10 @@
+ 
+ #endif
+ 
++#ifndef NOFILE
++#define NOFILE 256
++#endif
++
+ void SetEnvIgnore(char *sbEnvList);
+ int BeginEnv(char *sbEnv);
+ int EndEnv(char *sbEnv);
diff --git a/debian/patches/fix-mpost-segfault b/debian/patches/fix-mpost-segfault
new file mode 100644
index 0000000..6c541fe
--- /dev/null
+++ b/debian/patches/fix-mpost-segfault
@@ -0,0 +1,17 @@
+---
+ texk/web2c/mplibdir/mpxout.w |    2 ++
+ 1 file changed, 2 insertions(+)
+
+Index: texlive-bin-2009/texk/web2c/mplibdir/mpxout.w
+===================================================================
+--- texlive-bin-2009.orig/texk/web2c/mplibdir/mpxout.w	2009-12-21 08:05:13.000000000 +0900
++++ texlive-bin-2009/texk/web2c/mplibdir/mpxout.w	2009-12-21 08:05:45.000000000 +0900
+@@ -260,6 +260,8 @@
+   va_start(ap, msg);
+   fprintf(stderr, "fatal: ");
+   (void)vfprintf(stderr, msg, ap);
++  va_end(ap);
++  va_start(ap, msg);
+   mpx_printf(mpx, "fatal", msg, ap);
+   va_end(ap);
+   mpx->history=mpx_fatal_error;
diff --git a/debian/patches/fmtutil-fix-infinite-loop_upstream b/debian/patches/fmtutil-fix-infinite-loop_upstream
new file mode 100644
index 0000000..116a1d9
--- /dev/null
+++ b/debian/patches/fmtutil-fix-infinite-loop_upstream
@@ -0,0 +1,30 @@
+inifinite loops should only be checked in mktexfmt mode to make sure that
+double defined format/engine combinations are accepted
+Included upstream, written by Norbert Preining
+---
+ texk/tetex/fmtutil |    5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+Index: texlive-bin-2009/texk/tetex/fmtutil
+===================================================================
+--- texlive-bin-2009.orig/texk/tetex/fmtutil	2011-05-24 21:54:12.000000000 +0200
++++ texlive-bin-2009/texk/tetex/fmtutil	2011-05-24 21:55:52.000000000 +0200
+@@ -60,7 +60,7 @@
+ 
+ progname=fmtutil
+ argv0=$0
+-version=20091009.0222
++version=20091223.1047
+ 
+ cnf=fmtutil.cnf   # name of the config file
+ export PATH
+@@ -701,6 +701,9 @@
+   rm -f $fmtfile
+ 
+   # Check for infinite recursion before running the iniTeX:
++  # We do this check only if we are running in mktexfmt mode
++  # otherwise double format definitions will create an infinite loop, too
++  $mktexfmtMode || mktexfmt_loop=
+   case :$mktexfmt_loop: in
+   *:"$format/$engine":*)
+     abort "Infinite recursion detected, giving up!" ;;
diff --git a/debian/patches/icu-xetex_hurd.diff b/debian/patches/icu-xetex_hurd.diff
new file mode 100644
index 0000000..0de5baa
--- /dev/null
+++ b/debian/patches/icu-xetex_hurd.diff
@@ -0,0 +1,104 @@
+diff -urN icu-xetex.orig/aclocal.m4 icu-xetex/aclocal.m4
+--- texlive-bin-2009.orig/libs/icu/icu-xetex.orig/aclocal.m4	2008-03-04 14:26:36.000000000 +0100
++++ texlive-bin-2009/libs/icu/icu-xetex/aclocal.m4	2009-12-12 21:46:34.000000000 +0100
+@@ -31,6 +31,7 @@
+ 		icu_cv_host_frag=mh-linux-va
+ 	fi ;;
+ *-*-linux*|*-pc-gnu) icu_cv_host_frag=mh-linux ;;
++*-*-gnu*) icu_cv_host_frag=mh-gnu ;;
+ *-*-cygwin|*-*-mingw32)
+ 	if test "$GCC" = yes; then
+ 		AC_TRY_COMPILE([
+diff -urN icu-xetex.orig/config/mh-gnu icu-xetex/config/mh-gnu
+--- texlive-bin-2009.orig/libs/icu/icu-xetex.orig/config/mh-gnu	1970-01-01 01:00:00.000000000 +0100
++++ texlive-bin-2009/libs/icu/icu-xetex/config/mh-gnu	2009-12-12 21:42:43.000000000 +0100
+@@ -0,0 +1,78 @@
++## -*-makefile-*-
++## Linux-specific setup
++## Copyright (c) 1999-2006, International Business Machines Corporation and
++## others. All Rights Reserved.
++
++## Commands to generate dependency files
++GEN_DEPS.c=  $(CC) -E -MM $(DEFS) $(CPPFLAGS)
++GEN_DEPS.cc= $(CXX) -E -MM $(DEFS) $(CPPFLAGS)
++
++## Flags for position independent code
++SHAREDLIBCFLAGS = -fPIC
++SHAREDLIBCXXFLAGS = -fPIC
++SHAREDLIBCPPFLAGS = -DPIC
++
++## Additional flags when building libraries and with threads
++THREADSCPPFLAGS = -D_REENTRANT
++LIBCPPFLAGS =
++
++## Compiler switch to embed a runtime search path
++LD_RPATH=	
++LD_RPATH_PRE = -Wl,-rpath,
++
++## These are the library specific LDFLAGS
++LDFLAGSICUDT=-nodefaultlibs -nostdlib
++
++## Compiler switch to embed a library name
++# The initial tab in the next line is to prevent icu-config from reading it.
++	LD_SONAME = -Wl,-soname -Wl,$(notdir $(MIDDLE_SO_TARGET))
++#SH# # We can't depend on MIDDLE_SO_TARGET being set.
++#SH# LD_SONAME=
++
++## Shared object suffix
++SO = so
++## Non-shared intermediate object suffix
++STATIC_O = ao
++
++## Compilation rules
++%.$(STATIC_O): $(srcdir)/%.c
++	$(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
++%.o: $(srcdir)/%.c
++	$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
++
++%.$(STATIC_O): $(srcdir)/%.cpp
++	$(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
++%.o: $(srcdir)/%.cpp
++	$(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
++
++
++## Dependency rules
++%.d: $(srcdir)/%.c
++	@echo "generating dependency information for $<"
++	@$(SHELL) -ec '$(GEN_DEPS.c) $< \
++		| sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \
++		[ -s $@ ] || rm -f $@'
++
++%.d: $(srcdir)/%.cpp
++	@echo "generating dependency information for $<"
++	@$(SHELL) -ec '$(GEN_DEPS.cc) $< \
++		| sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \
++		[ -s $@ ] || rm -f $@'
++
++## Versioned libraries rules
++
++%.$(SO).$(SO_TARGET_VERSION_MAJOR): %.$(SO).$(SO_TARGET_VERSION)
++	$(RM) $@ && ln -s ${<F} $@
++%.$(SO): %.$(SO).$(SO_TARGET_VERSION_MAJOR)
++	$(RM) $@ && ln -s ${*F}.$(SO).$(SO_TARGET_VERSION) $@
++
++##  Bind internal references
++
++# LDflags that pkgdata will use
++BIR_LDFLAGS= -Wl,-Bsymbolic
++
++# Dependencies [i.e. map files] for the final library
++BIR_DEPS=
++
++## End Linux-specific setup
++
+diff -urN icu-xetex.orig/configure icu-xetex/configure
+--- texlive-bin-2009.orig/libs/icu/icu-xetex.orig/configure	2008-03-19 15:11:43.000000000 +0100
++++ texlive-bin-2009/libs/icu/icu-xetex/configure	2009-12-12 21:48:01.000000000 +0100
+@@ -3935,6 +3935,7 @@
+ 		icu_cv_host_frag=mh-linux-va
+ 	fi ;;
+ *-*-linux*|*-pc-gnu) icu_cv_host_frag=mh-linux ;;
++*-*-gnu*) icu_cv_host_frag=mh-gnu ;;
+ *-*-cygwin|*-*-mingw32)
+ 	if test "$GCC" = yes; then
+ 		cat >conftest.$ac_ext <<_ACEOF
diff --git a/debian/patches/libpoppler-0.12 b/debian/patches/libpoppler-0.12
new file mode 100644
index 0000000..6c523a7
--- /dev/null
+++ b/debian/patches/libpoppler-0.12
@@ -0,0 +1,41 @@
+Fix FTBFS with poppler again, they will never be able to keep APIs
+
+Thanks to Ubuntu people for that patch
+---
+ texk/web2c/pdftexdir/pdftoepdf.cc |    8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+Index: texlive-bin-2009~svn15596/texk/web2c/pdftexdir/pdftoepdf.cc
+===================================================================
+--- texlive-bin-2009~svn15596.orig/texk/web2c/pdftexdir/pdftoepdf.cc	2009-10-18 10:21:47.000000000 +0900
++++ texlive-bin-2009~svn15596/texk/web2c/pdftexdir/pdftoepdf.cc	2009-10-18 10:22:28.000000000 +0900
+@@ -650,7 +650,7 @@
+     }
+     for (r = encodingList; r != 0; r = n) {
+         n = r->next;
+-        delete r->font;
++//        delete r->font;
+         delete r;
+     }
+ }
+@@ -690,6 +690,7 @@
+     Page *page;
+     int rotate;
+     PDFRectangle *pagebox;
++    int minor_pdf_version_found, major_pdf_version_found;
+     float pdf_version_found, pdf_version_wanted;
+     // initialize
+     if (!isInit) {
+@@ -705,8 +706,11 @@
+     // this works only for PDF 1.x -- but since any versions of PDF newer
+     // than 1.x will not be backwards compatible to PDF 1.x, pdfTeX will
+     // then have to changed drastically anyway.
+-    pdf_version_found = pdf_doc->doc->getPDFVersion();
++    minor_pdf_version_found = pdf_doc->doc->getPDFMinorVersion();
++    major_pdf_version_found = pdf_doc->doc->getPDFMajorVersion();
++    pdf_version_found = major_pdf_version_found + (minor_pdf_version_found * 0.1);
+     pdf_version_wanted = 1 + (minor_pdf_version_wanted * 0.1);
++
+     if (pdf_version_found > pdf_version_wanted) {
+         char msg[] =
+             "PDF inclusion: found PDF version <%.1f>, but at most version <%.1f> allowed";
diff --git a/debian/patches/partial_lfs_support.diff b/debian/patches/partial_lfs_support.diff
new file mode 100644
index 0000000..b6f0a92
--- /dev/null
+++ b/debian/patches/partial_lfs_support.diff
@@ -0,0 +1,12 @@
+diff -urN texlive-bin-2009.orig/Build texlive-bin-2009/Build
+--- texlive-bin-2009.orig/Build	2009-09-17 15:40:44.000000000 +0200
++++ texlive-bin-2009/Build	2011-03-28 19:40:09.000000000 +0200
+@@ -66,7 +66,7 @@
+ 
+ # longinteger and off_t declarations are still inconsistent, do not
+ # enable this unless you are testing.
+-: ${TL_CONF_LARGEFILE=--disable-largefile}
++# : ${TL_CONF_LARGEFILE=--disable-largefile}
+ 
+ # default to static linking.
+ : ${TL_CONF_SHARED=--disable-shared}
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..85195e4
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,42 @@
+12_fix_epstopdf_invocation
+12a_fix_thumbpdf_invocation
+12b_fix_a2ping_invocation
+#2011# not applicable # 12c_fix_pdfcrop_invocation
+12e_fix_vpe_invocation
+#2011# not applicable # 17_texdoc
+23_use_xdvi.bin
+### for backports with poppler << 0.5 (etch)
+###30_libpoppler_0.4.5
+### for libpoppler 0.5 (not used anymore)
+###30_libpoppler_0.5.4
+### for double new libpoppler >= 0.5.9 (lenny)
+###30_libpoppler_0.5.9
+# for unstable
+# 30_libpoppler_0.10
+41_maketexmf
+50_fmtutil_deb
+51_fmtutil_keep_failedlog
+# not ready, we do not ship feynmf by now
+# 52_feynmf-perl-sec-fix
+53_builtin-searchpath-fix
+55_texconfig_stuff
+#2011# TODO TODO TODO TODO TODO !!!!!! # 56_updmap_deb
+#2011# we also need to set -e or check return values in updmap!!!
+57_texconfig_papersizes_for_upstream
+58_texconfig_papersizes_use_ucf
+set-e-in-various-scripts
+60_unneeded_linking
+#2011# disabled - do we need to fix that???# libpoppler-0.12
+#2011# disabled not applicable, still necessary? # icu-xetex_hurd.diff
+#2011# upstream included # fix-mpost-segfault
+#2011# not applicable # detex-hurd.diff
+#2011# upstream # fmtutil-fix-infinite-loop_upstream
+#2011# upstream # upstream-web2c-tmpfilewithpid
+#2011# upstream # cve-2010-1440
+#cve-2010-0739.patch
+#2011# upstream # cve-2010-0827.patch
+#2011# upstream # upstream-tex-file_arg-passing-fix
+xdvik-22.84.16-open-mode.patch
+#partial_lfs_support.diff
+#2011# upstream # 73_tex_segfault
+#2011# not necessary anymore, different fix upstream # unstymie-xetex-with-zlib-1.2.6.patch
diff --git a/debian/patches/set-e-in-various-scripts b/debian/patches/set-e-in-various-scripts
new file mode 100644
index 0000000..14249f2
--- /dev/null
+++ b/debian/patches/set-e-in-various-scripts
@@ -0,0 +1,148 @@
+set -e in mktexlsr, updmap, fmtutil
+---
+ texk/tetex/fmtutil   |    7 +++++--
+ texk/tetex/texconfig |   41 ++++++++++++++++++++++-------------------
+ 2 files changed, 27 insertions(+), 21 deletions(-)
+
+Index: texlive-bin-2011.20120216/texk/tetex/fmtutil
+===================================================================
+--- texlive-bin-2011.20120216.orig/texk/tetex/fmtutil	2012-02-17 10:42:59.000000000 +0900
++++ texlive-bin-2011.20120216/texk/tetex/fmtutil	2012-02-17 10:49:15.999076162 +0900
+@@ -3,6 +3,9 @@
+ # Public domain.  Originally written by Thomas Esser.
+ # Run with --help for usage.
+ 
++set -e
++retval=0
++
+ # program history:
+ #   further changes in texk/tetex/ChangeLog.
+ #   2007-01-04  patch by JK to support $engine subdir (enabled by default)
+@@ -522,8 +525,8 @@
+   if test -n "$cfgmaint"; then
+     if test -z "$cfgparam"; then
+       setupTmpDir
+-      co=`tcfmgr --tmp $tmpdir --cmd co --file $cnf`
+-      test $? = 0 || cleanup 1
++      co=`tcfmgr --tmp $tmpdir --cmd co --file $cnf || retval=$?`
++      test $retval = 0 || cleanup 1
+       set x $co; shift
+       id=$1; cnf_file=$3; orig=$4
+       verboseMsg "$progname: initial config file is \`$orig'"
+Index: texlive-bin-2011.20120216/texk/tetex/texconfig
+===================================================================
+--- texlive-bin-2011.20120216.orig/texk/tetex/texconfig	2012-02-17 10:48:08.000000000 +0900
++++ texlive-bin-2011.20120216/texk/tetex/texconfig	2012-02-17 10:49:15.999076162 +0900
+@@ -1,4 +1,4 @@
+-#!/bin/sh
++#!/bin/sh -e
+ 
+ # TeXConfig version 3.0
+ # Originally written by Thomas Esser. Public domain.
+@@ -41,6 +41,9 @@
+ needsCleanup=false
+ lastUpdatedFile=
+ 
++# needed for set -e and replacing the various checks for $?
++retval=0
++
+ # 

+ ###############################################################################
+ # setupFMT(void) - find a suitable version of fmt / adjust
+@@ -374,8 +377,8 @@
+   fmgrConfigReplaceValue=$3
+ 
+   setupTmpDir
+-  co=`tcfmgr $moreArgs --tmp $tmpdir --cmd co --file $fmgrConfigReplaceFile`
+-  if test $? != 0; then
++  co=`tcfmgr $moreArgs --tmp $tmpdir --cmd co --file $fmgrConfigReplaceFile || retval=$?`
++  if test $retval != 0; then
+     echo "$progname: fmgrConfigReplace co failed for \`$fmgrConfigReplaceFile'" >&2
+     (exit 1); return 1
+   fi
+@@ -391,16 +394,16 @@
+     if ! $(diff $fmgrConfigReplaceCfgFile $fmgrConfigReplaceOrigFile >/dev/null); then
+       fmgrConfigReplaceChanged=true
+     fi
+-    ucf --debconf-ok $fmgrConfigReplaceCfgFile $fmgrConfigReplaceOrigFile
++    ucf --debconf-ok $fmgrConfigReplaceCfgFile $fmgrConfigReplaceOrigFile || retval=$?
+     # here is a bug: We should somehow check whether the file had been
+     # changed, in order to be able to recreate formats etc.
+-    if test $? != 0; then
++    if test $retval != 0; then
+       echo "$progname: fmgrConfigReplace failed to call ucf for \`$fmgrConfigReplaceOrigFile'" >&2
+       (exit 1); return 1
+     fi
+   else
+-    ci=`tcfmgr --tmp $tmpdir --cmd ci --id "$fmgrConfigReplaceID"`
+-    if test $? != 0; then
++    ci=`tcfmgr --tmp $tmpdir --cmd ci --id "$fmgrConfigReplaceID" || retval=$?`
++    if test $retval != 0; then
+       echo "$progname: fmgrConfigReplace ci failed for \`$fmgrConfigReplaceFile'" >&2
+       (exit 1); return 1
+     fi
+@@ -427,8 +430,8 @@
+   setupDvipsPaperDftPaper=$1
+ 
+   setupTmpDir
+-  co=`tcfmgr --tmp $tmpdir --cmd co --file $setupDvipsPaperFile`
+-  if test $? != 0; then
++  co=`tcfmgr --tmp $tmpdir --cmd co --file $setupDvipsPaperFile || retval=$?`
++  if test $retval != 0; then
+     echo "$progname: setupDvipsPaper co failed for \`$setupDvipsPaperFile'" >&2
+     (exit 1); return 1
+   fi
+@@ -450,8 +453,8 @@
+   # one change, there shouldn't be any need for prompting.  But since
+   # texconfig might be called by a maintainer script with debconf
+   # running, pass the option, if only to prevent it from nagging.
+-  ucf --debconf-ok $setupDvipsPaperCfgFile $setupDvipsPaperOrigFile
+-  if test $? != 0; then
++  ucf --debconf-ok $setupDvipsPaperCfgFile $setupDvipsPaperOrigFile || retval=$?
++  if test $retval != 0; then
+     echo "$progname: fmgrConfigReplace failed to call ucf for \`$fmgrConfigReplaceOrigFile'" >&2
+     (exit 1); return 1
+   fi
+@@ -987,16 +990,16 @@
+               case $pFile in
+                 "")
+                   setupTmpDir
+-                  tcfRet=`tcfmgr --emptyinfile --reldir dvips/config --cmd co --tmp $tmpdir --file "config.$printerName"`
+-                  if test $? != 0; then
++                  tcfRet=`tcfmgr --emptyinfile --reldir dvips/config --cmd co --tmp $tmpdir --file "config.$printerName" || retval=$?`
++                  if test $retval != 0; then
+                     echo "$progname: failed to add new configuration file \`config.$printerName'" >&2
+                     rc=1
+                   else
+                     set x $tcfRet; shift
+                     tcBatchDvipsAddID=$1; tcBatchDvipsAddFile=$3
+                     echo "% file config.$printerName; added by texconfig" > "$tcBatchDvipsAddFile"
+-                    tcfRet=`tcfmgr --tmp $tmpdir --id "$tcBatchDvipsAddID" --cmd ci`
+-                    if test $? != 0; then
++                    tcfRet=`tcfmgr --tmp $tmpdir --id "$tcBatchDvipsAddID" --cmd ci || retval=$?`
++                    if test $retval != 0; then
+                       echo "$progname: failed to add new configuration file \`config.$printerName'" >&2
+                       rc=1
+                     else
+@@ -1326,8 +1329,8 @@
+                 # use tcfmgr
+                 tcBatchHyphenFileBasename=`echo "$tcBatchHyphenFile" | sed 's at .*/@@'`
+                 setupTmpDir
+-                co=`tcfmgr --tmp $tmpdir --cmd co --file "$tcBatchHyphenFileBasename" --reldir "$relPart" --infile "$tcBatchHyphenFile"`
+-                if test $? != 0; then
++                co=`tcfmgr --tmp $tmpdir --cmd co --file "$tcBatchHyphenFileBasename" --reldir "$relPart" --infile "$tcBatchHyphenFile" || retval=$?`
++                if test $retval != 0; then
+                   echo "$progname: failed to check out file \`$tcBatchHyphenFile'" >&2
+                   rc=1
+                   return 1
+@@ -1348,8 +1351,8 @@
+                   lastUpdatedFile=$ci
+                   ;;
+                 *)
+-                  ci=`tcfmgr --tmp $tmpdir --cmd ci --id "$tcBatchHFID"`
+-                  if test $? != 0; then
++                  ci=`tcfmgr --tmp $tmpdir --cmd ci --id "$tcBatchHFID" || retval=$?`
++                  if test $retval != 0; then
+                     echo "$progname: failed to check in file \`$tcBatchHyphenFileBasename'" >&2
+                     rc=1
+                     return
diff --git a/debian/patches/unstymie-xetex-with-zlib-1.2.6.patch b/debian/patches/unstymie-xetex-with-zlib-1.2.6.patch
new file mode 100644
index 0000000..d368a74
--- /dev/null
+++ b/debian/patches/unstymie-xetex-with-zlib-1.2.6.patch
@@ -0,0 +1,19 @@
+zlib 1.2.6 changed the semantics of gzeof function which breaks xetex
+and probably other programs (good move for a minor version upgrade!)
+This patch was made by Dan Ports to fix xetex
+---
+ texk/web2c/xetexdir/xetex.ch |    1 -
+ 1 file changed, 1 deletion(-)
+
+Index: texlive-bin-2009/texk/web2c/xetexdir/xetex.ch
+===================================================================
+--- texlive-bin-2009.orig/texk/web2c/xetexdir/xetex.ch	2012-02-14 08:12:16.892244044 +0900
++++ texlive-bin-2009/texk/web2c/xetexdir/xetex.ch	2012-02-14 08:12:17.600244497 +0900
+@@ -6951,7 +6951,6 @@
+ @y
+ undump_int(x);
+ if (x<>69069) then goto bad_fmt;
+-if not w_eof(fmt_file) then goto bad_fmt
+ @z
+ 
+ @x
diff --git a/debian/patches/upstream-tex-file_arg-passing-fix b/debian/patches/upstream-tex-file_arg-passing-fix
new file mode 100644
index 0000000..14211b3
--- /dev/null
+++ b/debian/patches/upstream-tex-file_arg-passing-fix
@@ -0,0 +1,70 @@
+Fix for Debian bug 602566
+patch by Mathias Kende include upstream
+> The bug seems to come from libkpathsea5 and not from dvi2ps. It exists
+> on all platforms (at least also on AMD64) but does not trigger a
+> segfault. It comes from the kpse_set_suffixes function in the
+> libkpathsea compatibility API which calls the kpathsea_set_suffixes
+> function and passes to it its variable list of arguments. This operation
+> is invalid in C.
+---
+ texk/kpathsea/tex-file.c |   21 ++++++++++++++-------
+ 1 file changed, 14 insertions(+), 7 deletions(-)
+
+Index: texlive-bin-2009/texk/kpathsea/tex-file.c
+===================================================================
+--- texlive-bin-2009.orig/texk/kpathsea/tex-file.c	2010-11-10 10:56:14.000000000 +0900
++++ texlive-bin-2009/texk/kpathsea/tex-file.c	2010-11-10 10:56:28.000000000 +0900
+@@ -321,14 +321,13 @@
+ /* Some file types have more than one suffix, and sometimes it is
+    convenient to modify the list of searched suffixes.  */ 
+ 
+-void
+-kpathsea_set_suffixes (kpathsea kpse, kpse_file_format_type format,
+-  boolean alternate, ...)
++static void
++kpathsea_set_suffixes_va_list(kpathsea kpse, kpse_file_format_type format,
++  boolean alternate, va_list ap)
+ {
+   const_string **list;
+   const_string s;
+   int count = 0;
+-  va_list ap;
+ 
+   if (alternate) {
+       list = &(kpse->format_info[format].alt_suffix);
+@@ -336,16 +335,24 @@
+       list = &(kpse->format_info[format].suffix);
+   }
+ 
+-  va_start (ap, alternate);
+   while ((s = va_arg (ap, string)) != NULL) {
+     count++;
+     XRETALLOC (*list, count + 1, const_string);
+     (*list)[count - 1] = s;
+   }
+-  va_end (ap);
+   (*list)[count] = NULL;
+ }
+ 
++void
++kpathsea_set_suffixes (kpathsea kpse, kpse_file_format_type format,
++  boolean alternate, ...)
++{
++  va_list ap;
++  va_start (ap, alternate);
++  kpathsea_set_suffixes_va_list (kpse, format, alternate, ap);
++  va_end (ap);
++}
++
+ 
+ #if defined (KPSE_COMPAT_API)
+ void
+@@ -354,7 +361,7 @@
+ {
+   va_list ap;
+   va_start (ap, alternate);
+-  kpathsea_set_suffixes (kpse_def, format, alternate, ap);
++  kpathsea_set_suffixes_va_list (kpse_def, format, alternate, ap);
+   va_end (ap);
+ }
+ #endif
diff --git a/debian/patches/upstream-web2c-tmpfilewithpid b/debian/patches/upstream-web2c-tmpfilewithpid
new file mode 100644
index 0000000..4482cd3
--- /dev/null
+++ b/debian/patches/upstream-web2c-tmpfilewithpid
@@ -0,0 +1,33 @@
+See comments in the diff for explanations
+---
+ texk/web2c/lib/openclose.c |   15 +++++++++++----
+ 1 file changed, 11 insertions(+), 4 deletions(-)
+
+Index: texlive-bin-2009/texk/web2c/lib/openclose.c
+===================================================================
+--- texlive-bin-2009.orig/texk/web2c/lib/openclose.c	2010-03-30 22:15:52.000000000 +0900
++++ texlive-bin-2009/texk/web2c/lib/openclose.c	2010-03-30 22:17:20.000000000 +0900
+@@ -37,12 +37,19 @@
+ static void
+ recorder_start(void)
+ {
+-    /* Alas, while we might want to use mkstemp it is not portable.
+-       So we have to be content with using a default name... */
++    /* Alas, while we'd like to use mkstemp it is not portable,
++       and doing the autoconfiscation (and providing fallbacks) is more
++       than we want to cope with.  So we have to be content with using a
++       default name.  Throw in the pid so at least parallel builds might
++       work (Debian bug 575731).  */
+     string cwd;
+-    
+-    recorder_name = (string)xmalloc(strlen(kpse_program_name)+5);
++    pid_t pid = getpid();
++    char pid_str[MAX_INT_LENGTH];
++    sprintf (pid_str, "%ld", (long) pid);
++
++    recorder_name = (string)xmalloc(strlen(kpse_program_name) + strlen(pid_str)  + 5);
+     strcpy(recorder_name, kpse_program_name);
++    strcat(recorder_name, pid_str);
+     strcat(recorder_name, ".fls");
+     
+     /* If an output directory was specified, use it instead of cwd.  */
diff --git a/debian/patches/xdvik-22.84.16-open-mode.patch b/debian/patches/xdvik-22.84.16-open-mode.patch
new file mode 100644
index 0000000..a1d287f
--- /dev/null
+++ b/debian/patches/xdvik-22.84.16-open-mode.patch
@@ -0,0 +1,12 @@
+diff -pruN xdvik-22.84.14.orig/texk/xdvik/util.c xdvik-22.84.14/texk/xdvik/util.c
+--- texlive-bin-2009.orig/texk/xdvik/util.c	2009-09-02 21:30:39.812675433 +0200
++++ texlive-bin-2009/texk/xdvik/util.c	2008-05-03 21:45:10.000000000 +0200
+@@ -273,7 +273,7 @@ try_open_mode(const char *fname, int fla
+     int fd = open(fname, flags, mode);
+     if (fd < 0 && (errno == EMFILE || errno == ENFILE)) {
+ 	close_a_file();
+-	fd = open(fname, flags);
++	fd = open(fname, flags, mode);
+     }
+     return fd;
+ }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/texlive-bin.git



More information about the Reproducible-commits mailing list