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

commit 11891842a875fe32378dcba37c615b5495149502
Author: Nicolas Goaziou <m...@nicolasgoaziou.fr>
AuthorDate: Wed Jun 12 21:15:44 2024 +0200

    gnu: texlive-updmap.cfg: Fix font file creation in $HOME.
    
    * gnu/packages/tex.scm (texlive-updmap.cfg): Clarify usage.  Prevent mktex
    scripts from creating files in TEXMFVAR by including a "mktex.cnf" that
    overrides the one from TEXLIVE-KPATHSEA.
    
    Change-Id: I8025582e8ecdd4f57fb8f266d987e6bc1e755e93
---
 gnu/packages/tex.scm | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index e2b8a1abb2..a48ca3966d 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -1210,8 +1210,12 @@ teTeX distribution that was maintained by Thomas Esser.")
 ;; inputs.
 (define-public texlive-updmap.cfg
   (lambda* (#:optional (packages '()))
-    "Return a 'texlive-updmap.cfg' package which contains the fonts map
-configuration of a base set of packages plus PACKAGES."
+    "Return a 'texlive-updmap.cfg' package which contains the fonts map and
+mktex scripts configuration, along with a base set of packages plus additional
+PACKAGES.
+
+This function is meant to be used in packages as a native input, to build
+documentation in the TeX format."
     (let ((default-packages (list texlive-scheme-basic)))
       (package
         (version (number->string %texlive-revision))
@@ -1226,9 +1230,18 @@ configuration of a base set of packages plus PACKAGES."
                       (ice-9 textual-ports))
           #:install-plan
           #~'(("texmf-dist/web2c/updmap.cfg" "share/texmf-config/web2c/")
-              ("texmf-dist/web2c/map" "share/texmf-dist/fonts/map"))
+              ("texmf-dist/web2c/mktex.cnf"  "share/texmf-config/web2c/")
+              ("texmf-dist/web2c/map"        "share/texmf-dist/fonts/map"))
           #:phases
           #~(modify-phases %standard-phases
+              (add-after 'unpack 'generate-mktex.cnf
+                ;; When building a package, mktex programs try to create files
+                ;; in TEXMFVAR, which is unavailable.  Force creating those
+                ;; files in the working directory instead.
+                (lambda _
+                  (with-directory-excursion "texmf-dist/web2c"
+                    (with-output-to-file "mktex.cnf"
+                      (lambda _ (display ": ${MT_DESTROOT=''}"))))))
               (add-before 'install 'regenerate-updmap.cfg
                 (lambda _
                   (with-directory-excursion "texmf-dist/web2c"
@@ -1243,8 +1256,8 @@ configuration of a base set of packages plus PACKAGES."
                       (when (not (zero? (status:exit-val (close-pipe port))))
                         (error "failed to filter updmap.cfg")))
 
-                    ;; Set TEXMFSYSVAR to a sane and writable value; updmap 
fails
-                    ;; if it cannot create its log file there.
+                    ;; Set TEXMFSYSVAR to a sane and writable value; updmap
+                    ;; fails if it cannot create its log file.
                     (setenv "TEXMFSYSVAR" (getcwd))
 
                     ;; Generate maps.

Reply via email to