profiles: texlive-configuration: Refresh font maps.

* guix/profiles.scm (texlive-configuration): Run updmap to generate font maps
necessary for pdflatex and other tools.
This commit is contained in:
Ricardo Wurmus 2021-05-03 15:34:46 +02:00
parent eb930bedf4
commit a6b8794c69
No known key found for this signature in database
GPG key ID: 197A5888235FACAC

View file

@ -4,7 +4,7 @@
;;; Copyright © 2014, 2016 Alex Kost <alezost@gmail.com>
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
;;; Copyright © 2016, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2016, 2018, 2019, 2021 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com>
;;; Copyright © 2017 Huang Ying <huang.ying.caritas@gmail.com>
;;; Copyright © 2017 Maxim Cournoyer <maxim.cournoyer@gmail.com>
@ -1667,12 +1667,22 @@ (define entry->texlive-input
(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 @@ (define build
(("^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