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
This commit is contained in:
Nicolas Goaziou 2024-06-12 21:15:44 +02:00 committed by Ludovic Courtès
parent a1daaaf30b
commit b385b88638
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -1211,8 +1211,12 @@ (define-public texlive-scheme-tetex
;; 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))
@ -1227,9 +1231,18 @@ (define-public texlive-updmap.cfg
(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"
@ -1244,8 +1257,8 @@ (define-public texlive-updmap.cfg
(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.