guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

07/07: profiles: texlive-configuration: Refresh font maps.


From: guix-commits
Subject: 07/07: profiles: texlive-configuration: Refresh font maps.
Date: Mon, 3 May 2021 09:38:15 -0400 (EDT)

rekado pushed a commit to branch master
in repository guix.

commit a6b8794c69446730b5f12eb8eefc5ef3b99c97dc
Author: Ricardo Wurmus <rekado@elephly.net>
AuthorDate: Mon May 3 15:34:46 2021 +0200

    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(-)

diff --git a/guix/profiles.scm b/guix/profiles.scm
index 26fe266..c1c6281 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]