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

commit cc7c5483d286d19e142d2d717447a438ee0aa227
Author: Nicolas Goaziou <m...@nicolasgoaziou.fr>
AuthorDate: Sun May 12 15:11:29 2024 +0200

    gnu: texlive-tex4ht: Build executables.
    
    * gnu/packages/tex.scm (texlive-tex4ht-bin): New variable.
    (texlive-tex4ht)[arguments]<#:phases>: Include executables.
    [native-inputs]: Add TEXLIVE-TEX4HT-BIN.
    
    Change-Id: I9f991d081a0580bc2fa45c5be49d1ae9801d356f
---
 gnu/packages/tex.scm | 77 ++++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 65 insertions(+), 12 deletions(-)

diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index 291fe88f38..72186ccf71 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -43426,6 +43426,47 @@ package written by Bill Mitchell, which is intended to 
print a term calendar
 for use in planning a class.")
     (license license:lppl1.3c)))
 
+(define texlive-tex4ht-bin
+  (package
+    (inherit texlive-bin)
+    (name "texlive-tex4ht-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" '("tex4htk"))))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments texlive-bin)
+       ((#:configure-flags flags)
+        #~(cons* "--disable-all-pkgs"
+                 "--enable-tex4htk"
+                 (delete "--disable-tex4htk" #$flags)))
+       ((#:phases _)
+        #~(modify-phases %standard-phases
+            (replace 'check
+              (lambda* (#:key tests? #:allow-other-keys)
+                (when tests?
+                  (with-directory-excursion "texk/tex4htk"
+                    (invoke "make" "check")))))
+            (replace 'install
+              (lambda _
+                (with-directory-excursion "texk/tex4htk"
+                  (invoke "make" "install"))))))))
+    (inputs '())))
+
 (define-public texlive-tex4ht
   (package
     (name "texlive-tex4ht")
@@ -43442,18 +43483,30 @@ for use in planning a class.")
     (outputs '("out" "doc"))
     (build-system texlive-build-system)
     (arguments
-     (list #:link-scripts
-           #~(list "ht.sh"
-                   "htcontext.sh"
-                   "htlatex.sh"
-                   "htmex.sh"
-                   "httex.sh"
-                   "httexi.sh"
-                   "htxelatex.sh"
-                   "htxetex.sh"
-                   "mk4ht.pl"
-                   "xhlatex.sh")))
-    (inputs (list perl))
+     (list
+      #:link-scripts #~(list "ht.sh"
+                             "htcontext.sh"
+                             "htlatex.sh"
+                             "htmex.sh"
+                             "httex.sh"
+                             "httexi.sh"
+                             "htxelatex.sh"
+                             "htxetex.sh"
+                             "mk4ht.pl"
+                             "xhlatex.sh")
+      #: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-tex4ht-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-tex4ht-bin))
     (home-page "https://ctan.org/pkg/tex4ht";)
     (synopsis "Convert (La)TeX to HTML/XML")
     (description

Reply via email to