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

commit 59217db12c9669aac2e90d6ed24bc0af1876da71
Author: Nicolas Goaziou <m...@nicolasgoaziou.fr>
AuthorDate: Sat May 11 15:26:11 2024 +0200

    gnu: texlive-afm2pl: Build executables.
    
    * gnu/packages/tex.scm (texlive-afm2pl): Inherit from TEXLIVE-BIN.
    [source]: Build from a trimmed TEXLIVE-SOURCE.
    [arguments]: Build `afm2pl' as a single package.
    
    * gnu/packages/tex.scm (texlive-bin): Do not build afm2pl.
    
    Change-Id: I75b309cbf67e0a0f2635c93fea65f103086ff5fe
---
 gnu/packages/tex.scm | 70 +++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 58 insertions(+), 12 deletions(-)

diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index a099021bea..2541215359 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -699,7 +699,8 @@ and should be preferred to it whenever a package would 
otherwise depend on
                        '())
                 ;; Disable tools built in other packages.
                 #$@(map (lambda (p) (string-append "--disable-" p))
-                        '("axodraw2"
+                        '("afm2pl"
+                          "axodraw2"
                           "chktex"
                           "cjkutils"
                           "dvipng"
@@ -1805,18 +1806,63 @@ the TeX Gyre bundle do not need this support.")
 
 (define-public texlive-afm2pl
   (package
+    (inherit texlive-bin)
     (name "texlive-afm2pl")
-    (version (number->string %texlive-revision))
-    (source (texlive-origin
-             name version
-             (list "doc/man/man1/afm2pl.1"
-                   "doc/man/man1/afm2pl.man1.pdf"
-                   "fonts/enc/dvips/afm2pl/"
-                   "fonts/lig/afm2pl/" "tex/fontinst/afm2pl/")
-             (base32
-              "19llzzr4kmmyf7l18ngx1rhaqaqvgm3md924m4dxcv7nmrvga2b2")))
-    (outputs '("out" "doc"))
-    (build-system texlive-build-system)
+    (source
+     (origin
+       (inherit texlive-source)
+       (modules '((guix build utils)
+                  (ice-9 ftw)))
+       (snippet
+        #~(let ((delete-other-directories
+                 (lambda (root dirs)
+                   (with-directory-excursion root
+                     (for-each
+                      delete-file-recursively
+                      (scandir "."
+                               (lambda (file)
+                                 (and (not (member file (append '("." "..") 
dirs)))
+                                      (eq? 'directory (stat:type (stat 
file)))))))))))
+            (delete-other-directories "libs" '())
+            (delete-other-directories "utils" '())
+            (delete-other-directories "texk" '("afm2pl"))))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments texlive-bin)
+       ((#:configure-flags flags)
+        #~(cons* "--disable-all-pkgs"
+                 "--enable-afm2pl"
+                 (delete "--disable-afm2pl" #$flags)))
+       ((#:phases _)
+        #~(modify-phases %standard-phases
+            (replace 'check
+              (lambda* (#:key tests? #:allow-other-keys)
+                (when tests?
+                  (with-directory-excursion "texk/afm2pl"
+                    (invoke "make" "check")))))
+            (replace 'install
+              (lambda* (#:key inputs native-inputs #:allow-other-keys)
+                (with-directory-excursion "texk/afm2pl"
+                  (invoke "make" "install"))
+                (let* ((texmf (string-append #$output "/share/texmf-dist"))
+                       (fonts (string-append texmf "/fonts"))
+                       (tex (string-append texmf "/tex"))
+                       (source
+                        ((compose dirname dirname dirname dirname)
+                         (search-input-file (or native-inputs inputs)
+                                            "tex/fontinst/afm2pl/README"))))
+                  (mkdir-p fonts)
+                  (copy-recursively (string-append source "/fonts") fonts)
+                  (mkdir-p tex)
+                  (copy-recursively (string-append source "/tex") tex))))))))
+    (native-inputs
+     (list pkg-config texlive-libkpathsea
+           (texlive-origin
+            name (package-version texlive-bin)
+            (list "fonts/enc/dvips/afm2pl/"
+                  "fonts/lig/afm2pl/" "tex/fontinst/afm2pl/")
+            (base32
+             "1nbb9lcxqxj2aary7a65fai3hgj4nwzm690iy0xv62v580krdbck"))))
+    (inputs '())
     (home-page "https://ctan.org/pkg/afm2pl";)
     (synopsis "Convert AFM to TeX property list (@file{.pl}) metrics")
     (description

Reply via email to