diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm index 70af0ee83f..104fa11493 100644 --- a/gnu/packages/tex.scm +++ b/gnu/packages/tex.scm @@ -15,7 +15,7 @@ ;;; Copyright © 2020 Vincent Legoll ;;; Copyright © 2020, 2021 Paul Garlick ;;; Copyright © 2021, 2022 Maxim Cournoyer -;;; Copyright © 2021-2023 Nicolas Goaziou +;;; Copyright © 2021-2024 Nicolas Goaziou ;;; Copyright © 2021 Leo Le Bouter ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2021 Ivan Gankevich @@ -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") diff --git a/guix/build/texlive-build-system.scm b/guix/build/texlive-build-system.scm index a9fe9c80cc..4a1afc709b 100644 --- a/guix/build/texlive-build-system.scm +++ b/guix/build/texlive-build-system.scm @@ -2,7 +2,7 @@ ;;; Copyright © 2017 Ricardo Wurmus ;;; Copyright © 2021 Maxim Cournoyer ;;; Copyright © 2021 Thiago Jung Bauermann -;;; Copyright © 2023 Nicolas Goaziou +;;; Copyright © 2023, 2024 Nicolas Goaziou ;;; ;;; 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)