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

commit 794353cab900b1ce4fef6a9501a522b96ca33abb
Author: Nicolas Goaziou <[email protected]>
AuthorDate: Sun May 12 19:21:47 2024 +0200

    gnu: texlive-detex: Build executable.
    
    * gnu/packages/tex.scm (texlive-detex): Inherit from TEXLIVE-BIN.
    [source]: Build from a trimmed TEXLIVE-SOURCE.
    [arguments]: Build `detex' as a single package.
    
    Change-Id: I167228ce2984d65c17f47ac86951d2bde60e26af
---
 gnu/packages/tex.scm | 47 ++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 38 insertions(+), 9 deletions(-)

diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index 601d1d0626..0adca1ef95 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -34211,16 +34211,45 @@ within the document, or in the document's private 
package file.")
 
 (define-public texlive-detex
   (package
+    (inherit texlive-bin)
     (name "texlive-detex")
-    (version (number->string %texlive-revision))
-    (source (texlive-origin
-             name version
-             (list "doc/man/man1/detex.1"
-                   "doc/man/man1/detex.man1.pdf")
-             (base32
-              "08d017wn7a67pmp9b5yhnfg1x2q6f48qaa5ma4bplz9a782icwjy")))
-    (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 keep)
+                   (with-directory-excursion root
+                     (for-each
+                      delete-file-recursively
+                      (scandir
+                       "."
+                       (lambda (file)
+                         (and (not (member file (append keep '("." ".."))))
+                              (eq? 'directory (stat:type (stat file)))))))))))
+            (delete-other-directories "libs" '())
+            (delete-other-directories "utils" '())
+            (delete-other-directories "texk" '("detex"))))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments texlive-bin)
+       ((#:configure-flags flags)
+        #~(cons* "--disable-all-pkgs"
+                 "--enable-detex"
+                 (delete "--disable-detex" #$flags)))
+       ((#:phases _)
+        #~(modify-phases %standard-phases
+            (replace 'check
+              (lambda* (#:key tests? #:allow-other-keys)
+                (when tests?
+                  (with-directory-excursion "texk/detex"
+                    (invoke "make" "check")))))
+            (replace 'install
+              (lambda _
+                (with-directory-excursion "texk/detex"
+                  (invoke "make" "install"))))))))
+    (inputs '())
     (home-page "https://ctan.org/pkg/detex";)
     (synopsis "Strip TeX from a source file")
     (description

Reply via email to