From a6b8794c69446730b5f12eb8eefc5ef3b99c97dc Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Mon, 3 May 2021 15:34:46 +0200 Subject: profiles: texlive-configuration: Refresh font maps. * guix/profiles.scm (texlive-configuration): Run updmap to generate font maps necessary for pdflatex and other tools. --- guix/profiles.scm | 51 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-) (limited to 'guix/profiles.scm') diff --git a/guix/profiles.scm b/guix/profiles.scm index 26fe266a61..c1c6281eb0 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -4,7 +4,7 @@ ;;; Copyright © 2014, 2016 Alex Kost ;;; Copyright © 2015 Mark H Weaver ;;; Copyright © 2015 Sou Bunnbu -;;; Copyright © 2016, 2018, 2019 Ricardo Wurmus +;;; Copyright © 2016, 2018, 2019, 2021 Ricardo Wurmus ;;; Copyright © 2016 Chris Marusich ;;; Copyright © 2017 Huang Ying ;;; Copyright © 2017 Maxim Cournoyer @@ -1667,12 +1667,22 @@ MANIFEST." (cons (gexp-input thing output) (append-map entry->texlive-input deps)) '())))) + (define texlive-bin + (module-ref (resolve-interface '(gnu packages tex)) 'texlive-bin)) + (define coreutils + (module-ref (resolve-interface '(gnu packages base)) 'coreutils)) + (define sed + (module-ref (resolve-interface '(gnu packages base)) 'sed)) + (define updmap.cfg + (module-ref (resolve-interface '(gnu packages tex)) + 'texlive-default-updmap.cfg)) (define build (with-imported-modules '((guix build utils) (guix build union)) #~(begin (use-modules (guix build utils) - (guix build union)) + (guix build union) + (ice-9 popen)) ;; Build a modifiable union of all texlive inputs. We do this so ;; that TeX live can resolve the parent and grandparent directories @@ -1690,7 +1700,42 @@ MANIFEST." (("^TEXMFROOT = .*") (string-append "TEXMFROOT = " #$output "/share\n")) (("^TEXMF = .*") - "TEXMF = $TEXMFROOT/share/texmf-dist\n")))) + "TEXMF = $TEXMFROOT/share/texmf-dist\n")) + + ;; XXX: This is annoying, but it's necessary because texlive-bin + ;; does not provide wrapped executables. + (setenv "PATH" + (string-append #$(file-append coreutils "/bin") + ":" + #$(file-append sed "/bin"))) + (setenv "PERL5LIB" #$(file-append texlive-bin "/share/tlpkg")) + (setenv "TEXMF" (string-append #$output "/share/texmf-dist")) + + ;; Remove invalid maps from config file. + (let ((web2c (string-append #$output "/share/texmf-config/web2c/")) + (maproot (string-append #$output "/share/texmf-dist/fonts/map/"))) + (mkdir-p web2c) + (copy-file #$updmap.cfg (string-append web2c "updmap.cfg")) + (make-file-writable (string-append web2c "updmap.cfg")) + (let* ((port (open-pipe* OPEN_WRITE + #$(file-append texlive-bin "/bin/updmap-sys") + "--syncwithtrees" + "--nohash" + "--force" + (string-append "--cnffile=" web2c "updmap.cfg")))) + (display "Y\n" port) + (when (not (zero? (status:exit-val (close-pipe port)))) + (error "failed to filter updmap.cfg"))) + + ;; Generate font maps. + (invoke #$(file-append texlive-bin "/bin/updmap-sys") + (string-append "--cnffile=" web2c "updmap.cfg") + (string-append "--dvipdfmxoutputdir=" + maproot "updmap/dvipdfmx/") + (string-append "--dvipsoutputdir=" + maproot "updmap/dvips/") + (string-append "--pdftexoutputdir=" + maproot "updmap/pdftex/"))))) #t))) (with-monad %store-monad -- cgit v1.2.3