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

commit 29d4630ba88ec637d44e37e5016519112a38ad25
Author: Nicolas Goaziou <m...@nicolasgoaziou.fr>
AuthorDate: Sun May 12 12:28:45 2024 +0200

    gnu: texlive-m-tx: Build executable.
    
    * gnu/packages/tex.scm (texlive-m-tx-bin): New variable.
    (texlive-m-tx)[arguments]<#:phases>: Include executables.
    [native-inputs]: Add TEXLIVE-M-TX-BIN.
    
    * gnu/packages/tex.scm (texlive-bin): Do not build m-tx.
    
    Change-Id: Ibc3689da654a752d68bf5f412f3bdba0d282baf1
---
 gnu/packages/tex.scm | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 59 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index 17f28ab9a4..dd2a92324b 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -770,6 +770,7 @@ and should be preferred to it whenever a package would 
otherwise depend on
                           "kpathsea"
                           "lacheck"
                           "lcdf-typetools"
+                          "m-tx"
                           "pmx"
                           "ps2eps"
                           "psutils"
@@ -20981,6 +20982,48 @@ LuaLaTeX.  It calls LilyPond to compile scores, then 
includes the produced
 files.")
     (license license:expat)))
 
+(define texlive-m-tx-bin
+  (package
+    (inherit texlive-bin)
+    (name "texlive-m-tx-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" '("m-tx"))
+            (delete-other-directories "texk" '())))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments texlive-bin)
+       ((#:configure-flags flags)
+        #~(cons* "--disable-all-pkgs"
+                 "--enable-m-tx"
+                 (delete "--disable-m-tx" #$flags)))
+       ((#:phases _)
+        #~(modify-phases %standard-phases
+            (replace 'check
+              (lambda* (#:key tests? #:allow-other-keys)
+                (when tests?
+                  (with-directory-excursion "utils/m-tx"
+                    (invoke "make" "check")))))
+            (replace 'install
+              (lambda _
+                (with-directory-excursion "utils/m-tx"
+                  (invoke "make" "install"))))))))
+    (native-inputs '())
+    (inputs '())))
+
 (define-public texlive-m-tx
   (package
     (name "texlive-m-tx")
@@ -20997,7 +21040,22 @@ files.")
               "1sakzv7r6mybx0k7k0fi1qb789nf7lvbl0ns8s0hhc9fz37b0br5")))
     (outputs '("out" "doc"))
     (build-system texlive-build-system)
-    (arguments (list #:link-scripts #~(list "m-tx.lua")))
+    (arguments
+     (list
+      #:link-scripts #~(list "m-tx.lua")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'link-scripts 'install-bin
+            (lambda* (#:key inputs native-inputs #:allow-other-keys)
+              (let ((source #$(this-package-native-input "texlive-m-tx-bin")))
+                (with-directory-excursion (string-append #$output "/bin")
+                  ;; Install non-scripts, already taken care of with
+                  ;; `link-scripts' phase.
+                  (for-each (lambda (f) (install-file f "."))
+                            (find-files (string-append source "/bin")
+                                        (lambda (_ s)
+                                          (eq? 'regular (stat:type 
s))))))))))))
+    (native-inputs (list texlive-m-tx-bin))
     (home-page "https://ctan.org/pkg/m-tx";)
     (synopsis "Preprocessor for @command{pmx}")
     (description

Reply via email to