gnu: texlive-libkpathsea: Fix TEXMFCACHE location.

* gnu/packages/tex.scm (texlive-libkpathsea)[arguments]<#:phases>: Set
TEXMFCACHE in "texmf.cnf" to "$HOME/.texliveYYYY/texmf-var/" instead of
"{$GUIX_TEXMF}", which creates a "{" directory in the current working
directory.
* guix/build/texlive-build-system.scm (set-texmfvar): New function.
(%standard-phases): Add SET-TEXMFVAR phase.

Change-Id: Idff2fd5279e12d35683c863528aac3b5efa9b22b
This commit is contained in:
Nicolas Goaziou 2024-05-08 14:42:36 +02:00 committed by Ludovic Courtès
parent 2205468108
commit 2402df01a6
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 13 additions and 2 deletions

View file

@ -15,7 +15,7 @@
;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
;;; Copyright © 2020, 2021 Paul Garlick <pgarlick@tourbillion-technology.com>
;;; Copyright © 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021-2023 Nicolas Goaziou <mail@nicolasgoaziou.fr>
;;; Copyright © 2021-2024 Nicolas Goaziou <mail@nicolasgoaziou.fr>
;;; Copyright © 2021 Leo Le Bouter <lle-bout@zaclys.net>
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
@ -224,6 +224,10 @@ (define-public texlive-libkpathsea
"TEXMF = {$GUIX_TEXMF}\n")
(("\\$SELFAUTOLOC(/share/texmf-dist/web2c)" _ suffix)
(string-append #$output suffix))
;; Ignore system-wide cache. Use local one, by default
;; "$HOME/.texliveYYYY/texmf-var/".
(("^TEXMFCACHE = .*")
"TEXMFCACHE = $TEXMFVAR\n")
;; Don't truncate lines.
(("^error_line = .*$") "error_line = 254\n")
(("^half_error_line = .*$") "half_error_line = 238\n")

View file

@ -2,7 +2,7 @@
;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Thiago Jung Bauermann <bauermann@kolabnow.com>
;;; Copyright © 2023 Nicolas Goaziou <mail@nicolasgoaziou.fr>
;;; Copyright © 2023, 2024 Nicolas Goaziou <mail@nicolasgoaziou.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@ -91,6 +91,12 @@ (define* (patch-shell-scripts #:rest _)
((command-regexp _ command)
(which command))))))
(define* (set-texmfvar #:rest _)
"Set TEXMFVAR to a writable location."
;; Default value is relative to $HOME, which is not set during build. This
;; location is used for generating font metrics or building documentation.
(setenv "TEXMFVAR" (string-append (getcwd) "/texmf-var")))
(define* (delete-drv-files #:rest _)
"Delete pre-generated \".drv\" files in order to prevent build failures."
(when (file-exists? "source")
@ -289,6 +295,7 @@ (define %standard-phases
(delete 'bootstrap)
(delete 'configure)
(add-after 'unpack 'patch-shell-scripts patch-shell-scripts)
(add-before 'build 'set-texmfvar set-texmfvar)
(add-before 'build 'delete-drv-files delete-drv-files)
(add-after 'delete-drv-files 'generate-font-metrics generate-font-metrics)
(replace 'build build)