guix: Restore profile hook for TeX Live font maps.
Long ago we had a profile hook, called “texlive-configuration”, which would
operate on the texlive-* packages that have actually been installed in the
profile, build a union directory, and then install a texmf.cnf file that
declared the prefix of the TeX Live tree to be the union directory. It then
generated font maps based on the fonts that had actually been installed.
This approach had multiple disadvantages, the worst of which was that you
could only really have one TeX Live tree. Commit
04a0b1e09a
addressed this, where texmf.cnf was
modified *once* and for all in texlive-bin to reference the GUIX_TEXMF
variable to determine the root of the tree. This made much of
“texlive-configuration” obsolete, because we didn’t need to have any union
directories at all, because we had no need for a customized per-profile
variant of texmf.cnf.
Unfortunately, with the loss of the profile hook we would no longer build font
maps. This patch resurrects the profile hook: we’re again generating font
maps (such as pdftex.map) based on the contents of the profile.
* gnu/packages/tex.scm (texlive-default-updmap.cfg): New variable.
* guix/profiles.scm (texlive-configuration): Rename this...
(texlive-font-maps): ...to this; update to run updmap-sys on the contents of
the profile to generate only font maps.
(%default-profile-hooks): Add texlive-font-maps.
* guix/status.scm (hook-message): Rename unused texlive-configuration to
texlive-font-maps.
master
parent
55e871844c
commit
805af862c6
|
@ -4422,6 +4422,18 @@ It includes little more than the required set of LaTeX packages.")
|
||||||
'()
|
'()
|
||||||
default-packages)))))
|
default-packages)))))
|
||||||
|
|
||||||
|
(define-public texlive-default-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
|
||||||
|
"0zhpyld702im6352fwp41f2hgfkpj2b4j1kfsjqbkijlcmvb6w2c"))))
|
||||||
|
|
||||||
;;; TODO: Add a TeX Live profile hook computing fonts maps (and others?)
|
;;; TODO: Add a TeX Live profile hook computing fonts maps (and others?)
|
||||||
;;; configuration from the packages in the profile, similar to what's done
|
;;; configuration from the packages in the profile, similar to what's done
|
||||||
;;; below.
|
;;; below.
|
||||||
|
|
|
@ -1738,8 +1738,8 @@ MANIFEST contains the \"man-db\" package. Otherwise, return #f."
|
||||||
(manual-database manifest)
|
(manual-database manifest)
|
||||||
(return #f))))
|
(return #f))))
|
||||||
|
|
||||||
(define (texlive-configuration manifest)
|
(define (texlive-font-maps manifest)
|
||||||
"Return a derivation that builds a TeXlive configuration for the entries in
|
"Return a derivation that builds the TeX Live font maps for the entries in
|
||||||
MANIFEST."
|
MANIFEST."
|
||||||
(define entry->texlive-input
|
(define entry->texlive-input
|
||||||
(match-lambda
|
(match-lambda
|
||||||
|
@ -1768,72 +1768,56 @@ MANIFEST."
|
||||||
;; Build a modifiable union of all texlive inputs. We do this so
|
;; Build a modifiable union of all texlive inputs. We do this so
|
||||||
;; that TeX live can resolve the parent and grandparent directories
|
;; that TeX live can resolve the parent and grandparent directories
|
||||||
;; correctly. There might be a more elegant way to accomplish this.
|
;; correctly. There might be a more elegant way to accomplish this.
|
||||||
(union-build #$output
|
(union-build "/tmp/texlive"
|
||||||
'#$(append-map entry->texlive-input
|
'#$(append-map entry->texlive-input
|
||||||
(manifest-entries manifest))
|
(manifest-entries manifest))
|
||||||
#:create-all-directories? #t
|
#:create-all-directories? #t
|
||||||
#:log-port (%make-void-port "w"))
|
#:log-port (%make-void-port "w"))
|
||||||
(let ((texmf.cnf (string-append
|
|
||||||
#$output
|
|
||||||
"/share/texmf-dist/web2c/texmf.cnf")))
|
|
||||||
(when (file-exists? texmf.cnf)
|
|
||||||
(substitute* texmf.cnf
|
|
||||||
(("^TEXMFROOT = .*")
|
|
||||||
(string-append "TEXMFROOT = " #$output "/share\n"))
|
|
||||||
(("^TEXMF = .*")
|
|
||||||
"TEXMF = $TEXMFROOT/share/texmf-dist\n"))
|
|
||||||
|
|
||||||
;; XXX: This is annoying, but it's necessary because texlive-bin
|
;; XXX: This is annoying, but it's necessary because texlive-bin
|
||||||
;; does not provide wrapped executables.
|
;; does not provide wrapped executables.
|
||||||
(setenv "PATH"
|
(setenv "PATH"
|
||||||
(string-append #$(file-append coreutils "/bin")
|
(string-append #$(file-append coreutils "/bin")
|
||||||
":"
|
":"
|
||||||
#$(file-append sed "/bin")))
|
#$(file-append sed "/bin")))
|
||||||
(setenv "PERL5LIB" #$(file-append texlive-bin "/share/tlpkg"))
|
(setenv "PERL5LIB" #$(file-append texlive-bin "/share/tlpkg"))
|
||||||
(setenv "TEXMF" (string-append #$output "/share/texmf-dist"))
|
(setenv "GUIX_TEXMF" "/tmp/texlive/share/texmf-dist")
|
||||||
|
|
||||||
;; Remove invalid maps from config file.
|
;; Remove invalid maps from config file.
|
||||||
(let* ((web2c (string-append #$output "/share/texmf-config/web2c/"))
|
(let* ((web2c (string-append #$output "/share/texmf-dist/web2c/"))
|
||||||
(maproot (string-append #$output "/share/texmf-dist/fonts/map/"))
|
(maproot (string-append #$output "/share/texmf-dist/fonts/map/"))
|
||||||
(updmap.cfg (string-append web2c "updmap.cfg")))
|
(updmap.cfg (string-append web2c "updmap.cfg")))
|
||||||
(mkdir-p web2c)
|
(mkdir-p web2c)
|
||||||
|
(copy-file #$updmap.cfg updmap.cfg)
|
||||||
|
(make-file-writable updmap.cfg)
|
||||||
|
(let* ((port (open-pipe* OPEN_WRITE
|
||||||
|
#$(file-append texlive-bin "/bin/updmap-sys")
|
||||||
|
"--syncwithtrees"
|
||||||
|
"--nohash"
|
||||||
|
"--force"
|
||||||
|
(string-append "--cnffile=" updmap.cfg))))
|
||||||
|
(display "Y\n" port)
|
||||||
|
(when (not (zero? (status:exit-val (close-pipe port))))
|
||||||
|
(error "failed to filter updmap.cfg")))
|
||||||
|
|
||||||
;; Some profiles may already have this file, which prevents us
|
;; Generate font maps.
|
||||||
;; from copying it. Since we need to generate it from scratch
|
(invoke #$(file-append texlive-bin "/bin/updmap-sys")
|
||||||
;; anyway, we delete it here.
|
(string-append "--cnffile=" updmap.cfg)
|
||||||
(when (file-exists? updmap.cfg)
|
(string-append "--dvipdfmxoutputdir="
|
||||||
(delete-file updmap.cfg))
|
maproot "dvipdfmx/updmap")
|
||||||
(copy-file #$updmap.cfg updmap.cfg)
|
(string-append "--dvipsoutputdir="
|
||||||
(make-file-writable updmap.cfg)
|
maproot "dvips/updmap")
|
||||||
(let* ((port (open-pipe* OPEN_WRITE
|
(string-append "--pdftexoutputdir="
|
||||||
#$(file-append texlive-bin "/bin/updmap-sys")
|
maproot "pdftex/updmap"))))))
|
||||||
"--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)))
|
|
||||||
|
|
||||||
(mlet %store-monad ((texlive-base (manifest-lookup-package manifest "texlive-base")))
|
(mlet %store-monad ((texlive-base (manifest-lookup-package manifest "texlive-base")))
|
||||||
(if texlive-base
|
(if texlive-base
|
||||||
(gexp->derivation "texlive-configuration" build
|
(gexp->derivation "texlive-font-maps" build
|
||||||
#:substitutable? #f
|
#:substitutable? #f
|
||||||
#:local-build? #t
|
#:local-build? #t
|
||||||
#:properties
|
#:properties
|
||||||
`((type . profile-hook)
|
`((type . profile-hook)
|
||||||
(hook . texlive-configuration)))
|
(hook . texlive-font-maps)))
|
||||||
(return #f))))
|
(return #f))))
|
||||||
|
|
||||||
(define %default-profile-hooks
|
(define %default-profile-hooks
|
||||||
|
@ -1849,6 +1833,7 @@ MANIFEST."
|
||||||
glib-schemas
|
glib-schemas
|
||||||
gtk-icon-themes
|
gtk-icon-themes
|
||||||
gtk-im-modules
|
gtk-im-modules
|
||||||
|
texlive-font-maps
|
||||||
xdg-desktop-database
|
xdg-desktop-database
|
||||||
xdg-mime-database))
|
xdg-mime-database))
|
||||||
|
|
||||||
|
|
|
@ -395,8 +395,8 @@ the current build phase."
|
||||||
(G_ "building XDG MIME database..."))
|
(G_ "building XDG MIME database..."))
|
||||||
('fonts-dir
|
('fonts-dir
|
||||||
(G_ "building fonts directory..."))
|
(G_ "building fonts directory..."))
|
||||||
('texlive-configuration
|
('texlive-font-maps
|
||||||
(G_ "building TeX Live configuration..."))
|
(G_ "building TeX Live font maps..."))
|
||||||
('manual-database
|
('manual-database
|
||||||
(G_ "building database for manual pages..."))
|
(G_ "building database for manual pages..."))
|
||||||
('package-cache ;package cache generated by 'guix pull'
|
('package-cache ;package cache generated by 'guix pull'
|
||||||
|
|
Reference in New Issue