guix-commits
[Top][All Lists]
Advanced

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

332/418: gnu: texlive-etex: Refresh package definition.


From: guix-commits
Subject: 332/418: gnu: texlive-etex: Refresh package definition.
Date: Mon, 29 May 2023 17:39:36 -0400 (EDT)

ngz pushed a commit to branch tex-team-next
in repository guix.

commit b2cb4858588205598ac57c243bf923e2c18b1414
Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
AuthorDate: Tue May 16 23:53:29 2023 +0200

    gnu: texlive-etex: Refresh package definition.
    
    * gnu/packages/tex.scm (texlive-etex): Remove SIMPLE-TEXLIVE-PACKAGE
    call.
    [native-inputs]: Remove TEXLIVE-BIN.
---
 gnu/packages/tex.scm | 126 +++++++++++++++++++++++++++++++--------------------
 1 file changed, 77 insertions(+), 49 deletions(-)

diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index 3aaca0f6af..48324f46b9 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -1832,60 +1832,88 @@ output encodings, and features generation of clean 
UTF-8 patterns.")
 ;; This provides etex.src which is needed to build various formats, including
 ;; luatex.fmt and pdflatex.fmt
 (define-public texlive-etex
-  (let ((template (simple-texlive-package
-                   "texlive-etex"
-                   (list "/doc/etex/base/"
-                         "/doc/man/man1/etex.1"
-                         "/doc/man/man1/etex.man1.pdf"
-                         "/tex/plain/etex/"
-                         "/fonts/source/public/etex/")
-                   (base32
-                    "1qv6vxm5a8pw38gas3i69ivmsn79zj2yq5n5vdmh0rzic5hw2hmc")
-                   #:trivial? #t)))
-    (package
-      (inherit template)
-      (arguments
-       (substitute-keyword-arguments (package-arguments template)
-         ((#:phases phases)
-          `(modify-phases ,phases
-             ;; Build tfm font.
-             (replace 'build
-               (lambda* (#:key inputs #:allow-other-keys)
-                 (let ((mf (assoc-ref inputs "texlive-metafont")))
-                   ;; Tell mf where to find mf.base
-                   (setenv "MFBASES" (string-append mf 
"/share/texmf-dist/web2c"))
-                   ;; Tell mf where to look for source files
+  (package
+    (name "texlive-etex")
+    (version (number->string %texlive-revision))
+    (source (texlive-origin
+             name version
+             (list "doc/etex/base/"
+                   "doc/man/man1/etex.1"
+                   "doc/man/man1/etex.man1.pdf"
+                   "fonts/source/public/etex/"
+                   "fonts/tfm/public/etex/"
+                   "tex/plain/etex/")
+             (base32
+              "17pvh7i9zw8qa5hr53kci7di64fqzx4j35gsn28s36b74x6xj4bc")))
+    (outputs '("out" "doc"))
+    (build-system texlive-build-system)
+    (arguments
+     (list
+      #:texlive-latex-base #f
+      #:modules
+      '((guix build texlive-build-system)
+        (guix build utils)
+        (srfi srfi-1)
+        (srfi srfi-26))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-before 'install 'generate-fonts-metrics
+            (lambda _
+              (let ((cm #$(this-package-native-input "texlive-cm"))
+                    (metafont #$(this-package-native-input "texlive-metafont"))
+                    (fonts-directories
+                     (delete-duplicates
+                      (map (lambda (f)
+                             (string-drop (dirname f) (string-length "./")))
+                           (find-files "." "[0-9]+\\.mf$"))))
+                    (root (getcwd)))
+                (mkdir-p "build")
+                ;; Tell mf where to find mf.base.
+                (setenv "MFBASES"
+                        (string-append metafont "/share/texmf-dist/web2c/"))
+                (for-each
+                 (lambda (directory)
+                   ;; Tell mf where to look for source files.
                    (setenv "MFINPUTS"
-                           (string-append (getcwd)
-                                          "/fonts/source/public/etex/:"
-                                          mf "/share/texmf-dist/metafont/base:"
-                                          (assoc-ref inputs "texlive-cm")
-                                          
"/share/texmf-dist/fonts/source/public/cm")))
-                 (invoke "mf" "-progname=mf"
-                         (string-append "\\"
-                                        "mode:=ljfour; "
-                                        "mag:=1; "
-                                        "scrollmode; "
-                                        "input xbmc10"))
-                 #t))
-             (add-after 'install 'install-font
-               (lambda* (#:key outputs #:allow-other-keys)
-                 (install-file
-                  "xbmc10.tfm"
-                  (string-append (assoc-ref outputs "out")
-                                 "/share/texmf-dist/fonts/tfm/public/etex/"))
-                 #t))))))
-      (native-inputs
-       (list texlive-bin texlive-metafont texlive-cm))
-      (home-page "https://www.ctan.org/pkg/etex";)
-      (synopsis "Extended version of TeX")
-      (description
-       "This package provides an extended version of TeX (which is capable of
+                           (string-append
+                            (getcwd) "/" directory ":"
+                            metafont "/share/texmf-dist/metafont/base/:"
+                            cm "/share/texmf-dist/fonts/source/public/cm/"))
+                   ;; Build font metrics (tfm).
+                   (with-directory-excursion directory
+                     (for-each (lambda (font)
+                                 (format #t "building font ~a\n" font)
+                                 (invoke "mf" "-progname=mf"
+                                         (string-append "-output-directory="
+                                                        root "/build")
+                                         (string-append "\\"
+                                                        "mode:=ljfour; "
+                                                        "mag:=1; "
+                                                        "batchmode; "
+                                                        "input "
+                                                        (basename font 
".mf"))))
+                               (find-files "." "[0-9]+\\.mf$")))
+                   ;; Install font metrics at the appropriate location.
+                   (let ((destination
+                          ;; fonts/source/xxx/yyy/... -> fonts/tfm/xxx/yyy/...
+                          (string-append "fonts/tfm"
+                                         (string-drop
+                                          directory
+                                          (string-length "fonts/source")))))
+                     (format #t "moving font metrics in ~a\n" destination)
+                     (for-each (cut install-file <> destination)
+                               (find-files "build/" "\\.tfm$"))))
+                 fonts-directories)))))))
+    (native-inputs (list texlive-cm texlive-metafont))
+    (home-page "https://www.ctan.org/pkg/etex";)
+    (synopsis "Extended version of TeX")
+    (description
+     "This package provides an extended version of TeX (which is capable of
 running as if it were TeX unmodified).  E-TeX has been specified by the LaTeX
 team as the engine for the development of LaTeX2e; as a result, LaTeX
 programmers may assume e-TeX functionality.  The pdftex engine directly
 incorporates the e-TeX extensions.")
-      (license license:knuth))))
+    (license license:knuth)))
 
 (define-public texlive-plain
   (package



reply via email to

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