summaryrefslogtreecommitdiff
path: root/guix/profiles.scm
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2021-05-03 15:34:46 +0200
committerRicardo Wurmus <rekado@elephly.net>2021-05-03 15:36:14 +0200
commita6b8794c69446730b5f12eb8eefc5ef3b99c97dc (patch)
tree009a603e5c6f2b7c271cf37ed344da5b1dd856ec /guix/profiles.scm
parenteb930bedf42ab6629b3340a93331753da50e8fcb (diff)
downloadguix-patches-a6b8794c69446730b5f12eb8eefc5ef3b99c97dc.tar
guix-patches-a6b8794c69446730b5f12eb8eefc5ef3b99c97dc.tar.gz
profiles: texlive-configuration: Refresh font maps.
* guix/profiles.scm (texlive-configuration): Run updmap to generate font maps necessary for pdflatex and other tools.
Diffstat (limited to 'guix/profiles.scm')
-rw-r--r--guix/profiles.scm51
1 files changed, 48 insertions, 3 deletions
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 <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 @@ 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