[tex-k] pointing kpathsea to the correct texmf tree

Oleg Parashchenko olpa at xmlhack.ru
Tue Apr 27 12:50:06 CEST 2010


Hello all,

thanks for helping! Summary:

texmf.cnf defines search paths in terms of SELFAUTO* variables (at least,
in vanilla TeXLive and MacTeX 2009). Therefore, kpathsea looks for files
relative to the location of the calling program.

Therefore, to find the files, the calling program should be located in
the right place or all the AUTO-based search paths should be redefined.
For me, the following wrapper implements the second idea:

----- textool.sh: begin
#!/bin/bash

for i in         \
  TEXMFMAIN      \
  TEXMFDIST      \
  TEXMFLOCAL     \
  TEXMFSYSVAR    \
  TEXMFSYSCONFIG \
  TEXMFCNF       
do
  export $i=`kpsewhich -expand-var "$"$i` 
done

"$@"
----- textool.sh: end

Running kpsewhich in a wrong location doesn't work:

$ ./kpsewhich psfonts.map
warning: kpathsea: configuration file texmf.cnf not found in
these directories: ...
$ export export TEXMFCNF='{/usr/local/texlive/2009/.....
$ ./kpsewhich psfonts.map
$

But the wrapper helps:

$ textool.sh ./kpsewhich psfonts.map
/usr/local/texlive/2009/texmf-var/fonts/map/dvips/updmap/psfonts.map
$ textool.sh ./a.out 
psfonts.map=/usr/local/texlive/2009/....../psfonts.map
$


On Tue, 20 Apr 2010 13:14:29 +0200
Oleg Parashchenko <olpa at xmlhack.ru> wrote:

> Hello,
> 
> I'm trying to use kpathsea as a separate library. I've got it from
> subversion, succesfully compiled it and created a test program:
> 
> -----
> #include <stdio.h>
> #include <kpathsea/kpathsea.h>
> int main(int argc, char **argv) {
>   kpathsea kpse = kpathsea_new();
>   kpathsea_set_program_name(kpse, argv[0], NULL);
>   char *fname = kpathsea_find_file(kpse, "psfonts.map", kps
> e_fontmap_format, 1);
>   printf("psfonts.map=%s\n", fname);
>   kpathsea_finish(kpse);
>   exit(0);
> }
> -----
> 
> Now I'm trying to ask program/kpathsea to search in MacTeX texmf tree:
> 
> $ kpsexpand '$TEXMFCNF'
> {/usr/local/texlive/2009/bin/universal-darwin,/usr/local/te
> xlive/2009/bin,/usr/local/texlive/2009}{,{/share,}/texmf{-l
> ocal,}/web2c}
> $ export TEXMFCNF='{/usr/local/texlive/2009/bin/universal-d
> arwin,/usr/local/texlive/2009/bin,/usr/local/texlive/2009}{
> ,{/share,}/texmf{-local,}/web2c}'
> $ kpsewhich psfonts.map
> /usr/local/texlive/2009/texmf-var/fo nts/map/dvips/updmap/p
> sfonts.map
> $ ./a.out
> psfonts.map=(null)
> 
> So, kpsewhich still finds psfonts.map, but my program doesn't. Using
> KPATHSEA_DEBUG I find that before searching for the file, the set of
> paths doesn't include "/usr/local/texlive/...." anymore:
> 
> kdebug:  = .:/Users/olpa/.texlive2009/texmf-config/fonts/map
> /a.out//:/Users/olpa/.texlive2009/texmf-var/fonts/map/a.out/
> /:/Users/olpa/Library/texmf/fonts/map/a.out//:!!/Users/texmf
> -config/fonts/map/a.out//:!!/Users/texmf-var/fonts/map/a.out
> //:!!/Users/texmf/fonts/map/a.out//:!!/Users/../texmf-local/
> fonts/map/a.out//:!!/Users/texmf-dist/fonts/map/a.out//:/Use
> rs/olpa/.texlive2009/texmf-config/fonts/map/pdftex//:/Users/
> olpa/.texlive2009/texmf-var/fonts/map/pdftex//:/Users/olpa/L
> ibrary/texmf/fonts/map/pdftex//:!!/Users/texmf-config/fonts/
> map/pdftex//:!!/Users/texmf-var/fonts/map/pdftex//:!!/Users/
> texmf/fonts/map/pdftex//:!!/Users/../texmf-local/fonts/map/p
> dftex//:!!/Users/texmf-dist/fonts/map/pdftex//:/Users/olpa/.
> texlive2009/texmf-config/fonts/map/dvips//:/Users/olpa/.texl
> ive2009/texmf-var/fonts/map/dvips//:/Users/olpa/Library/texm
> f/fonts/map/dvips//:!!/Users/texmf-config/fonts/map/dvips//:
> !!/Users/texmf-var/fonts/map/dvips//:!!/Users/texmf/fonts/ma
> p/dvips//:!!/Users/../texmf-local/fonts/map/dvips//:!!/Users
> /texmf-dist/fonts/map/dvips//:/Users/olpa/.texlive2009/texmf
> -config/fonts/map///:/Users/olpa/.texlive2009/texmf-var/font
> s/map///:/Users/olpa/Library/texmf/fonts/map///:!!/Users/tex
> mf-config/fonts/map///:!!/Users/texmf-var/fonts/map///:!!/Us
> ers/texmf/fonts/map///:!!/Users/../texmf-local/fonts/map///:
> !!/Users/texmf-dist/fonts/map///
> 
> The question is: what is required to make test.c working?
> 
> Thanks!
> 
> 
> -- 
> Oleg Parashchenko  olpa@ http://uucode.com/
> http://uucode.com/blog/  XML, TeX, Python, Mac, Chess
> 
> 


-- 
Oleg Parashchenko  olpa@ http://uucode.com/
http://uucode.com/blog/  XML, TeX, Python, Mac, Chess



More information about the tex-k mailing list