guix-commits
[Top][All Lists]
Advanced

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

02/12: gnu: Add texlive-latex-luatex.


From: guix-commits
Subject: 02/12: gnu: Add texlive-latex-luatex.
Date: Sun, 5 Dec 2021 17:55:37 -0500 (EST)

civodul pushed a commit to branch core-updates-frozen
in repository guix.

commit a9d426c492e7834bf658ab598fea3be32608839d
Author: Thiago Jung Bauermann <bauermann@kolabnow.com>
AuthorDate: Fri Dec 3 23:16:11 2021 -0300

    gnu: Add texlive-latex-luatex.
    
    When TeX Live was updated to version 2021 the ‘lualatex’ format started
    being generated with the LuaHBTeX engine, but the ‘lualatex’ command still
    uses the LuaTeX engine. This causes the command to fail:
    
      user@popigai:~$ lualatex hello.tex
      This is LuaTeX, Version 1.13.0 (TeX Live 2021/GNU Guix)
      restricted system commands enabled.
    
      ---! lualatex.fmt was written by luahbtex
      (Fatal format file error; I'm stymied)user@popigai:~$
    
    The correct way to fix this problem would be either to change texlive-bin
    to make ‘lualatex’ use the LuaHBTeX engine, or to change texlive-latex-base
    to generate ‘lualatex.fmt’ with LuaTeX. Both options would rebuild large
    parts of the world.
    
    Ricardo Wurmus suggested creating a new package to provide ‘lualatex.fmt’
    for LuaTeX as a workaround. This is what this package does.
    
    Fixes https://issues.guix.gnu.org/51252.
    
    * gnu/packages/tex.scm (texlive-latex-luatex): New variable.
    
    Signed-off-by: Ludovic Courtès <ludo@gnu.org>
---
 gnu/packages/tex.scm | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)

diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index 910be21..256fe7d 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -3746,6 +3746,71 @@ loading fonts by their proper names instead of file 
names.")
 
 (define-deprecated-package texlive-luatex-luaotfload texlive-luaotfload)
 
+;; FIXME: This package is a temporary workaround to provide ‘lualatex.fmt’ for
+;; the LuaTeX engine. It is needed because it was discovered too late in the
+;; core-updates-frozen cycle that texlive-latex-base only provides it for
+;; LuaHBTeX. See https://issues.guix.gnu.org/51252.
+(define-public texlive-latex-luatex
+  (package
+    (name "texlive-latex-luatex")
+    (version (number->string %texlive-revision))
+    (source #f)
+    (build-system gnu-build-system)
+    (arguments
+     `(#:modules ((guix build gnu-build-system)
+                  (guix build utils)
+                  (ice-9 rdelim)
+                  (ice-9 string-fun))
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'unpack)
+         (delete 'bootstrap)
+         (delete 'configure)
+         (delete 'check)
+         (replace 'build
+           (lambda* (#:key inputs #:allow-other-keys)
+             (mkdir "web2c")
+             (let ((fmtutil.cnf-in (open-file
+                                    (string-append
+                                     (assoc-ref inputs "texlive-kpathsea")
+                                     "/share/texmf-dist/web2c/fmtutil.cnf")
+                                    "r"))
+                   (fmtutil.cnf-out (open-file "web2c/fmtutil.cnf" "w")))
+
+               ;; Copy ‘lualatex’ format lines to the new fmtutil.cnf, changing
+               ;; the engine from ‘luahbtex’ to ‘luatex’.
+               (do ((line "" (read-line fmtutil.cnf-in 'concat)))
+                   ((eof-object? line))
+                 (when (string-prefix? "lualatex" line)
+                   (display (string-replace-substring line "luahbtex" "luatex")
+                            fmtutil.cnf-out)))
+               (close-port fmtutil.cnf-out)
+               (close-port fmtutil.cnf-in)
+
+               (invoke "fmtutil" "--sys" "--all" "--fmtdir=web2c"
+                       "--cnffile=web2c/fmtutil.cnf")
+
+               ;; Don't risk this file interfering with anything else.
+               (delete-file "web2c/fmtutil.cnf"))))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((web2c (string-append %output "/share/texmf-dist/web2c")))
+               (mkdir-p web2c)
+               (copy-recursively "web2c" web2c)))))))
+    (native-inputs
+     `(("texlive-bin" ,texlive-bin)
+       ("texlive-babel" ,texlive-babel)
+       ("texlive-cm" ,texlive-cm)
+       ("texlive-fonts-latex" ,texlive-fonts-latex)
+       ("texlive-kpathsea" ,texlive-kpathsea)
+       ("texlive-latex-base" ,texlive-latex-base)
+       ("texlive-lm" ,texlive-lm)
+       ("texlive-tex-ini-files" ,texlive-tex-ini-files)))
+    (home-page (package-home-page texlive-latex-base))
+    (synopsis "LuaLaTeX format files for LuaTeX")
+    (description "This package is necessary to use LaTeX with the LuaTeX 
engine.")
+    (license (package-license texlive-latex-base))))
+
 (define-public texlive-latex-amsmath
   (package
     (name "texlive-latex-amsmath")



reply via email to

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