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

commit 3597a67ce9ec67108caaffc8c34d0ce80c04cfcd
Author: Nicolas Goaziou <m...@nicolasgoaziou.fr>
AuthorDate: Sun May 12 17:03:34 2024 +0200

    gnu: texlive-ptex: Build executables.
    
    * gnu/packages/tex.scm (texlive-ptex-bin): New variable.
    (texlive-ptex)[arguments]<#:phases>: Include executables.
    [native-inputs]: Add TEXLIVE-PTEX-BIN.
    
    Change-Id: I1148ddf3752800c64384250df5142136af440161
---
 gnu/packages/tex.scm | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index caab4b1974..178f39ca59 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -36771,6 +36771,54 @@ not overly complex, so that users should find it easy 
to adapt the macros to
 their specific needs.")
     (license license:lppl)))
 
+(define texlive-ptex-bin
+  (package
+    (inherit texlive-bin)
+    (name "texlive-ptex-bin")
+    (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" '("makejvf" "mendexk"))))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments texlive-bin)
+       ((#:configure-flags flags)
+        #~(cons* "--disable-all-pkgs"
+                 "--enable-makejvf"
+                 "--enable-mendexk"
+                 (delete "--disable-makejvf"
+                         (delete "--disable-mendexk" #$flags))))
+       ((#:phases _)
+        #~(modify-phases %standard-phases
+            (replace 'check
+              (lambda* (#:key tests? #:allow-other-keys)
+                (when tests?
+                  (with-directory-excursion "texk/makejvf"
+                    (invoke "make" "check"))
+                  (with-directory-excursion "texk/mendexk"
+                    (invoke "make" "check")))))
+            (replace 'install
+              (lambda _
+                (with-directory-excursion "texk/makejvf"
+                  (invoke "make" "install"))
+                (with-directory-excursion "texk/mendexk"
+                  (invoke "make" "install"))))))))
+    (native-inputs (list pkg-config texlive-libkpathsea texlive-libptexenc))
+    (inputs '())))
+
 (define-public texlive-ptex
   (package
     (name "texlive-ptex")
@@ -36795,7 +36843,20 @@ their specific needs.")
               "1dk8rvadr1q00bjizj567lzjp5l47pr7miyk0ghkajbiiwbqi0kn")))
     (outputs '("out" "doc"))
     (build-system texlive-build-system)
-    (arguments (list #:create-formats #~(list "eptex" "ptex")))
+    (arguments
+     (list #:create-formats #~(list "eptex" "ptex")
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'install 'install-bin
+                 (lambda _
+                   (let ((source
+                          #$(this-package-native-input "texlive-ptex-bin")))
+                     (copy-recursively (string-append source "/bin")
+                                       (string-append #$output "/bin"))))))))
+    ;; XXX: TEXLIVE-PTEX-BIN only provides a subset of the expected binaries.
+    ;; Other ones are already obtained through the "web2c" module, when
+    ;; building TEXLIVE-BIN.
+    (native-inputs (list texlive-ptex-bin))
     (propagated-inputs
      (list texlive-cm
            texlive-etex

Reply via email to