ngz pushed a commit to branch tex-team
in repository guix.

commit 31a7adc3b55e7950e6e606c280542cb825f03f30
Author: Nicolas Goaziou <m...@nicolasgoaziou.fr>
AuthorDate: Fri May 10 22:49:51 2024 +0200

    gnu: texlive-libkpathsea: Set sane values in "texmf.cnf".
    
    * gnu/packages/tex.scm (texlive-libkpathsea)[arguments]<#:phases>: Configure
    environment variables relative to the TeX Live environment according to our
    needs.  In particular, TEXMFDBS should point to the right places, and not
    bogus ones, which impede document compilation speed.
    
    Change-Id: Ia8c2c645dc0d0f0cc2b26dd1e9bad2ffdb4a56f9
---
 gnu/packages/tex.scm | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index 361d2f3468..0cb4ec65d4 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -215,21 +215,28 @@
             ;; environment variable defined via a search path below.
             ;;
             ;; This phase must happen before the `configure' phase, because
-            ;; the value of the TEXMFCNF variable (modified along with the
-            ;; SELFAUTOLOC reference below) is used at compile time to
+            ;; the value of the TEXMFCNF variable is used at compile time to
             ;; generate "paths.h" file.
             (lambda _
               (substitute* "texk/kpathsea/texmf.cnf"
-                (("^TEXMFROOT = .*")
-                 "TEXMFROOT = {$GUIX_TEXMF}/..\n")
-                (("^TEXMF = .*")
-                 "TEXMF = {$GUIX_TEXMF}\n")
-                (("\\$SELFAUTOLOC(/share/texmf-dist/web2c)" _ suffix)
-                 (string-append #$output suffix))
+                (("^TEXMFROOT = .*") "TEXMFROOT = {$GUIX_TEXMF}/..\n")
+                (("^TEXMFDIST = .*") "TEXMFDIST = {$GUIX_TEXMF}\n")
+                ;; "ls-R" files are to be expected only in the TEXMFDIST
+                ;; directories.  However, those are not always present, e.g.,
+                ;; when building a package with `texlive-build-system' or when
+                ;; generating a profile.  Since both situations need to be
+                ;; handled, drop the "!!" prefix in front of TEXMFDIST.
+                (("!!\\$TEXMFDIST") "$TEXMFDIST")
+                (("^TEXMFDBS = .*") "TEXMFDBS = {$TEXMFDIST}\n")
                 ;; Ignore system-wide cache.  Use local one, by default
                 ;; "$HOME/.texliveYYYY/texmf-var/".
-                (("^TEXMFCACHE = .*")
-                 "TEXMFCACHE = $TEXMFVAR\n")
+                (("^TEXMFCACHE = .*") "TEXMFCACHE = $TEXMFVAR\n")
+                ;; Set TEXMFCNF.  Since earlier values of variables have
+                ;; precedence over later ones, instead the appropriate value
+                ;; above the lengthy one.
+                (("^TEXMFCNF = " lead)
+                 (string-append
+                  "TEXMFCNF = " #$output "/share/texmf-dist/web2c\n" lead))
                 ;; Don't truncate lines.
                 (("^error_line = .*$") "error_line = 254\n")
                 (("^half_error_line = .*$") "half_error_line = 238\n")

Reply via email to