On Mon, Nov 30, 2015 at 02:07:00PM +0100, Ludovic Courtès wrote:
> It ‘TEXMF’ really a search path, or is it rather a variable that should
> point to a single directory?

It is a variable that works like a search path, but with a special syntax:
/gnu/store/gb4y83bvcpkvdmz0dvi9rp507kbdbr5x-texlive-texmf-2015/share/texmf-dist/web2c/texmf.cnf
contains a line
TEXMF = 
{$TEXMFCONFIG,$TEXMFVAR,$TEXMFHOME,!!$TEXMFSYSCONFIG,!!$TEXMFSYSVAR,!!$TEXMFLOCAL,!!$TEXMFDIST}

The context binary itself is the following shell script:
#!/gnu/store/ibpm6n6706yimzr3967krkxi2ibxq5yh-bash-4.3.39/bin/bash
export 
TEXMFCNF="/gnu/store/gb4y83bvcpkvdmz0dvi9rp507kbdbr5x-texlive-texmf-2015/share/texmf-dist/web2c"
exec -a "$0" 
"/gnu/store/i11ykp24wbgq2lfz7gcz2v0f5h3sg7dg-texlive-bin-2015/share/texmf-dist/scripts/context/stubs/unix/context"
 "$@"

The variable TEXMFCNF gives the directory where texmf.cnf is to be found;
this configuration file contains the definition of TEXMF (composed of the
other variables). So one would expect the wrapper to be already in place,
provided by texlive.

The call in the last line is to the following shell script:
#!/gnu/store/311nvir0pz1mhf0mgsmfrw00qfj7yq0j-bash-4.3.39/bin/sh
mtxrun --script context "$@"

"mtxrun" is the following shell script:
#!/gnu/store/ibpm6n6706yimzr3967krkxi2ibxq5yh-bash-4.3.39/bin/bash
export 
TEXMFCNF="/gnu/store/gb4y83bvcpkvdmz0dvi9rp507kbdbr5x-texlive-texmf-2015/share/texmf-dist/web2c"
exec -a "$0" 
"/gnu/store/i11ykp24wbgq2lfz7gcz2v0f5h3sg7dg-texlive-bin-2015/bin/mtxrun" "$@"

Again, this is a wrapper setting TEXMFCNF.
The mtxrun binary is a lua script.

The following lines in the script could be of interest:
resolvers.criticalvars=allocate { 
"SELFAUTOLOC","SELFAUTODIR","SELFAUTOPARENT","TEXMFCNF","TEXMF","TEXOS" }
resolvers.luacnfname="texmfcnf.lua"

I suppose that the normal behaviour will then be to look for the file
texmfcnf.lua in the directory given by TEXMFCNF, set by the wrapper scripts.
This file seems to be a lua script that is equivalent to texmf.cnf.
We modify texmf.cnf to point to the correct directories, using a single
substitute:
              (substitute* texmfcnf
                (("TEXMFROOT = \\$SELFAUTOPARENT")
                (string-append "TEXMFROOT = " share)))
which results in the line
TEXMFROOT = /gnu/store/gb4y83bvcpkvdmz0dvi9rp507kbdbr5x-texlive-texmf-2015/share
All further variables depend on TEXMFROOT.

So we should probably also modify texmfcnf.lua in a similar way.
Unfortunately, it contains a lot of selfautoparent and selfautodir;
we should replace them all at the same time.

I can propose a patch later.

Andreas


Reply via email to