gnu: texlive-union: Build font maps.

* gnu/packages/tex.scm (texlive-union)[arguments]: Execute updmap to generate
missing font maps.
[native-inputs]: Add coreutils, sed, and updmap.cfg.
This commit is contained in:
Ricardo Wurmus 2019-07-05 17:48:45 +02:00
parent c42db89ff9
commit 1a64a7b314
No known key found for this signature in database
GPG Key ID: 197A5888235FACAC
1 changed files with 34 additions and 4 deletions

View File

@ -2387,16 +2387,18 @@ standard LaTeX packages."
#:builder #:builder
(begin (begin
(use-modules (ice-9 match) (use-modules (ice-9 match)
(ice-9 popen)
(srfi srfi-26) (srfi srfi-26)
(guix build union) (guix build union)
(guix build utils) (guix build utils)
(guix build texlive-build-system)) (guix build texlive-build-system))
(let* ((out (assoc-ref %outputs "out")) (let* ((out (assoc-ref %outputs "out"))
(texmf.cnf (string-append out "/share/texmf-dist/web2c/texmf.cnf"))) (texmf.cnf (string-append out "/share/texmf-dist/web2c/texmf.cnf")))
;; Build a modifiable union of all inputs (but exclude bash) ;; Build a modifiable union of all inputs (but exclude bash and
;; the updmap.cfg file)
(match (filter (match-lambda (match (filter (match-lambda
((name . _) ((name . _)
(not (string=? "bash" name)))) (not (member name '("bash" "updmap.cfg")))))
%build-inputs) %build-inputs)
(((names . directories) ...) (((names . directories) ...)
(union-build (assoc-ref %outputs "out") (union-build (assoc-ref %outputs "out")
@ -2413,19 +2415,47 @@ standard LaTeX packages."
(string-append "TEXMFROOT = " out "/share\n")) (string-append "TEXMFROOT = " out "/share\n"))
(("^TEXMF = .*") (("^TEXMF = .*")
"TEXMF = $TEXMFROOT/share/texmf-dist\n")) "TEXMF = $TEXMFROOT/share/texmf-dist\n"))
(setenv "PATH" (string-append (assoc-ref %build-inputs "bash") (setenv "PATH" (string-append
"/bin")) (assoc-ref %build-inputs "bash") "/bin:"
(assoc-ref %build-inputs "coreutils") "/bin:"
(string-append out "/bin")))
(for-each (for-each
(cut wrap-program <> (cut wrap-program <>
`("TEXMFCNF" ":" suffix (,(dirname texmf.cnf))) `("TEXMFCNF" ":" suffix (,(dirname texmf.cnf)))
`("TEXMF" ":" suffix (,(string-append out "/share/texmf-dist")))) `("TEXMF" ":" suffix (,(string-append out "/share/texmf-dist"))))
(find-files (string-append out "/bin") ".*")) (find-files (string-append out "/bin") ".*"))
;; Remove invalid maps from config file.
(let ((port (open-pipe* OPEN_WRITE "updmap-sys"
"--syncwithtrees"
"--nohash"
(assoc-ref %build-inputs "updmap.cfg"))))
(display "Y\n" port)
(when (not (zero? (status:exit-val (close-pipe port))))
(error "failed to filter updmap.cfg")))
;; Generate maps.
(invoke "updmap-sys" "--force"
(string-append out "/share/texmf-config/web2c/updmap.cfg"))
#t)))) #t))))
(inputs (inputs
`(("bash" ,bash) `(("bash" ,bash)
,@(map (lambda (package) ,@(map (lambda (package)
(list (package-name package) package)) (list (package-name package) package))
(append default-packages packages)))) (append default-packages packages))))
(native-inputs
`(("coreutils" ,coreutils)
("sed" ,sed)
("updmap.cfg"
,(origin
(method url-fetch)
(uri (string-append "https://tug.org/svn/texlive/tags/"
%texlive-tag "/Master/texmf-dist/web2c/updmap.cfg"
"?revision=" (number->string %texlive-revision)))
(file-name (string-append "updmap.cfg-"
(number->string %texlive-revision)))
(sha256
(base32
"06mwpy5i218g5k3sf4gba0fmxgas82hkzx9fhwn67z5ik37d8apq"))))))
(home-page (package-home-page texlive-bin)) (home-page (package-home-page texlive-bin))
(synopsis "Union of TeX Live packages") (synopsis "Union of TeX Live packages")
(description "This package provides a subset of the TeX Live (description "This package provides a subset of the TeX Live