#! /bin/sh /usr/share/dpatch/dpatch-run
## 53_builtin-searchpath-fix.dpatch
##
## DP: adjust built-in search paths for kpathsea library to Debian standard

@DPATCH@
 texk/kpathsea/texmf.cnf |   38 +++++++++++++++-----------------------
 1 file changed, 15 insertions(+), 23 deletions(-)

Index: texlive-bin-2012.20120530/texk/kpathsea/texmf.cnf
===================================================================
--- texlive-bin-2012.20120530.orig/texk/kpathsea/texmf.cnf	2012-05-13 08:34:52.951624000 +0900
+++ texlive-bin-2012.20120530/texk/kpathsea/texmf.cnf	2012-05-30 09:57:42.685015402 +0900
@@ -55,19 +55,22 @@
 
 % The tree containing runtime files related to the specific
 % distribution and version.
-TEXMFMAIN = $TEXMFROOT/texmf
+TEXMFMAIN = /usr/share/texlive/texmf
 
 % The main tree of packages, distribution-agnostic:
-TEXMFDIST = $TEXMFROOT/texmf-dist
+TEXMFDIST = /usr/share/texlive/texmf-dist
+
+% The Debian search tree
+TEXMFDEBIAN = /usr/share/texmf
 
 % 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
@@ -76,10 +79,10 @@
 TEXMFHOME = ~/texmf
 
 % TEXMFVAR, where texconfig/updmap/fmtutil store cached runtime data.
-TEXMFVAR = ~/.texlive2012/texmf-var
+TEXMFVAR = ~/.texmf-var
 
 % TEXMFCONFIG, where texconfig/updmap/fmtutil store configuration data.
-TEXMFCONFIG = ~/.texlive2012/texmf-config
+TEXMFCONFIG = ~/.texmf-config
 
 % List all the texmf trees.
 %
@@ -94,7 +97,7 @@
 % versions should take precedence over those -- although it is generally
 % a source of confusion to have different versions of a package
 % installed, whatever the trees, so try to avoid it.
-TEXMF = {$TEXMFCONFIG,$TEXMFVAR,$TEXMFHOME,!!$TEXMFSYSCONFIG,!!$TEXMFSYSVAR,!!$TEXMFMAIN,!!$TEXMFLOCAL,!!$TEXMFDIST}
+TEXMF = {$TEXMFCONFIG,$TEXMFVAR,$TEXMFHOME,!!$TEXMFSYSCONFIG,!!$TEXMFSYSVAR,!!$TEXMFDEBIAN,!!$TEXMFMAIN,!!$TEXMFLOCAL,!!$TEXMFDIST}
 
 % Where to look for ls-R files.  There need not be an ls-R in the
 % directories in this path, but if there is one, Kpathsea will use it.
@@ -102,18 +105,18 @@
 % does not create ls-R files in the non-!! elements -- because if an
 % ls-R is present, it will be used, and the disk will not be searched.
 % This is arguably a bug in kpathsea.
-TEXMFDBS = {!!$TEXMFSYSCONFIG,!!$TEXMFSYSVAR,!!$TEXMFMAIN,!!$TEXMFLOCAL,!!$TEXMFDIST}
+TEXMFDBS = {!!$TEXMFSYSCONFIG,!!$TEXMFSYSVAR,!!$TEXMFDEBIAN,!!$TEXMFMAIN,!!$TEXMFLOCAL,!!$TEXMFDIST}
 
 % The system trees.  These are the trees that are shared by all users.
 % If a tree appears in this list, the mktex* scripts will use
 % VARTEXFONTS for generated files, if the original tree isn't writable;
 % otherwise the current working directory is used.
-SYSTEXMF = $TEXMFSYSVAR;$TEXMFMAIN;$TEXMFLOCAL;$TEXMFDIST
+SYSTEXMF = $TEXMFSYSVAR;$TEXMFDEBIAN;$TEXMFMAIN;$TEXMFLOCAL;$TEXMFDIST
 
 % 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
@@ -481,18 +484,7 @@
 % explicitly list every directory.  Arguably more understandable this
 % way anyway.
 %
-TEXMFCNF = {\
-$SELFAUTOLOC,\
-$SELFAUTOLOC/share/texmf-local/web2c,$SELFAUTOLOC/share/texmf/web2c,\
-$SELFAUTOLOC/texmf-local/web2c,$SELFAUTOLOC/texmf/web2c,\
-$SELFAUTODIR,\
-$SELFAUTODIR/share/texmf-local/web2c,$SELFAUTODIR/share/texmf/web2c,\
-$SELFAUTODIR/texmf-local/web2c,$SELFAUTODIR/texmf/web2c,\
-$SELFAUTOPARENT/../texmf-local/web2c,\
-$SELFAUTOPARENT,\
-$SELFAUTOPARENT/share/texmf-local/web2c,$SELFAUTOPARENT/share/texmf/web2c,\
-$SELFAUTOPARENT/texmf-local/web2c,$SELFAUTOPARENT/texmf/web2c\
-}
+TEXMFCNF = /etc/texmf/web2c;/usr/share/texlive/texmf/web2c;/usr/share/texlive/texmf-dist/web2c;/usr/local/share/texmf/web2c
 %
 % For reference, here is the old brace-using definition:
 %TEXMFCNF = {$SELFAUTOLOC,$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}
