$NetBSD$

Set paths to texmf trees for pkgsrc.

--- texmf.cnf.orig	2011-06-18 22:10:46.000000000 +0000
+++ texmf.cnf
@@ -49,7 +49,7 @@
 % (http://tug.org/tds), or files may not be found.
 %
 % Redistributors will probably want $SELFAUTODIR/share, i.e., /usr/share.
-TEXMFROOT = $SELFAUTOPARENT
+TEXMFROOT = $SELFAUTODIR/share
 
 % The tree containing runtime files related to the specific
 % distribution and version.
@@ -59,13 +59,13 @@ TEXMFMAIN = $TEXMFROOT/texmf
 TEXMFDIST = $TEXMFROOT/texmf-dist
 
 % Local additions to the distribution trees.
-TEXMFLOCAL = $TEXMFROOT/../texmf-local
+TEXMFLOCAL = @TEXMFLOCAL@
 
 % TEXMFSYSVAR, where *-sys store cached runtime data.
-TEXMFSYSVAR = $TEXMFROOT/texmf-var
+TEXMFSYSVAR = @VARBASE@/lib/texmf
 
 % TEXMFSYSCONFIG, where *-sys store configuration data.
-TEXMFSYSCONFIG = $TEXMFROOT/texmf-config
+TEXMFSYSCONFIG = @PKG_SYSCONFDIR@
 
 % 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 @@ SYSTEXMF = $TEXMFSYSVAR;$TEXMFMAIN;$TEXM
 % 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 = $TEXMFSYSVAR/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
@@ -303,6 +303,10 @@ BSTINPUTS = .;$TEXMF/bibtex/{bst,csf}//
 MLBIBINPUTS = .;$TEXMF/bibtex/bib/{mlbib,}//
 MLBSTINPUTS = .;$TEXMF/bibtex/{mlbst,bst}//
 
+% .ris and .bltxml bibliography formats.
+RISINPUTS = .;$TEXMF/bibtex/ris//
+BLTXMLINPUTS = .;$TEXMF/bibtex/bltxml//
+
 % MFT style files.
 MFTINPUTS = .;$TEXMF/mft//
 
@@ -368,11 +372,13 @@ MPSUPPORT = .;$TEXMF/metapost/support
 MIMELIBDIR = $TEXMFROOT/etc
 MAILCAPLIBDIR = $TEXMFROOT/etc
 
-% Default settings for fontconfig library, used by Windows versions of
-% xetex/xdvipdfmx.  On Unixish systems, fontconfig ignores this.
-FONTCONFIG_FILE=fonts.conf
-FONTCONFIG_PATH=$TEXMFSYSVAR/fonts/conf
-FC_CACHEDIR=$TEXMFSYSVAR/fonts/cache
+% Default settings for the fontconfig library as used by the Windows
+% versions of xetex/xdvipdfmx.  On Unixish systems, fontconfig ignores
+% this.  ConTeXT MkIV (all platforms) also use these values.
+% 
+FONTCONFIG_FILE = fonts.conf
+FONTCONFIG_PATH = $TEXMFSYSVAR/fonts/conf
+FC_CACHEDIR = $TEXMFSYSVAR/fonts/cache
 
 % TeX documentation and source files, for use with texdoc and kpsewhich.
 TEXDOCS = $TEXMF/doc//
@@ -407,10 +413,19 @@ TW_INIPATH = $TW_LIBPATH
 % would allow command execution.
 DVIPDFMXINPUTS = $TEXMF/dvipdfmx
 
-% Find scripts that are distributed/installed in the texmf tree.
-
 % Lua needs to look in TEXINPUTS for lua scripts distributed with packages.
-LUAINPUTS = .;$TEXMF/scripts/{$progname,$engine,}/{lua,}//;$TEXINPUTS
+% 
+% But we can't simply use $TEXINPUTS, since then if TEXINPUTS is set in
+% the environment with a colon, say, TEXINPUTS=/some/dir:, the intended
+% default expansion of TEXINPUTS will not happen and .lua files under
+% the /tex/ will not be found.
+% 
+% So, duplicate the TEXINPUTS.*lualatex values as LUAINPUTS.*lualatex.
+% The default LUAINPUTS sufficess for luatex and dviluatex.
+%
+LUAINPUTS.lualatex = .;$TEXMF/scripts/{$progname,$engine,}/{lua,}//;$TEXMF/tex/{lualatex,latex,luatex,generic,}//
+LUAINPUTS.dvilualatex = .;$TEXMF/scripts/{$progname,$engine,}/{lua,}//;$TEXMF/tex/{lualatex,latex,luatex,generic,}//
+LUAINPUTS = .;$TEXMF/scripts/{$progname,$engine,}/{lua,}//;$TEXMF/tex/{luatex,plain,generic,}//
 
 % Lua needs to look for binary lua libraries distributed with packages.
 CLUAINPUTS = .;$SELFAUTOLOC/lib/{$progname,$engine,}/lua//
@@ -442,7 +457,7 @@ RUBYINPUTS   = .;$TEXMF/scripts/{$progna
 % 
 % For security reasons, it is better not to include . in this path.
 %
-TEXMFCNF = {$SELFAUTOLOC,$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}
+TEXMFCNF = @PKG_SYSCONFDIR@
 
 % kpathsea 3.5.3 and later sets these at runtime. To avoid empty
 % expansions from binaries linked against an earlier version of the
