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

commit 424de1d65f56b84a0dde629b79ff30ea65ca0b13
Author: Nicolas Goaziou <m...@nicolasgoaziou.fr>
AuthorDate: Sat May 11 16:44:53 2024 +0200

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

diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index c7c2ddf167..fc0b3e3c57 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -711,6 +711,7 @@ and should be preferred to it whenever a package would 
otherwise depend on
                           "kpathsea"
                           "lacheck"
                           "lcdf-typetools"
+                          "ps2eps"
                           "psutils"
                           "t1utils"
                           "upmendex"
@@ -42018,32 +42019,52 @@ and glued together.  This will lead to a physical 
product box.")
 
 (define-public texlive-ps2eps
   (package
+    (inherit texlive-bin)
     (name "texlive-ps2eps")
-    (version (number->string %texlive-revision))
-    (source (texlive-origin
-             name version
-             (list "doc/man/man1/bbox.1"
-                   "doc/man/man1/bbox.man1.pdf"
-                   "doc/man/man1/ps2eps.1"
-                   "doc/man/man1/ps2eps.man1.pdf"
-                   "scripts/ps2eps/")
-             (base32
-              "1anrvgs0hd3790dwpxqal0c2drjmvh93vnyqap40rvp8axwi0a6n")))
-    (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" '("ps2eps"))
+            (delete-other-directories "texk" '())))))
     (arguments
-     (list #:link-scripts #~(list "ps2eps.pl")
-           #:phases
-           #~(modify-phases %standard-phases
-               (add-after 'unpack 'configure-ghostscript-executable
-                 ;; ps2eps.pl uses the "gswin32c" ghostscript executable on
-                 ;; Windows, and the "gs" ghostscript executable on Unix.  It
-                 ;; detects Unix by checking for the existence of the
-                 ;; "/usr/bin" directory.  Since Guix System does not have
-                 ;; "/usr/bin", it is also detected as Windows.
-                 (lambda _
-                   (substitute* "scripts/ps2eps/ps2eps.pl"
-                     (("gswin32c") "gs")))))))
+     (substitute-keyword-arguments (package-arguments texlive-bin)
+       ((#:configure-flags flags)
+        #~(cons* "--disable-all-pkgs"
+                 "--enable-ps2eps"
+                 (delete "--disable-ps2eps" #$flags)))
+       ((#:phases _)
+        #~(modify-phases %standard-phases
+            (add-after 'unpack 'configure-ghostscript-executable
+              ;; ps2eps.pl uses the "gswin32c" ghostscript executable on
+              ;; Windows, and the "gs" ghostscript executable on Unix.  It
+              ;; detects Unix by checking for the existence of the "/usr/bin"
+              ;; directory.  Since Guix System does not have "/usr/bin", it is
+              ;; also detected as a Windows system :(.
+              (lambda _
+                (substitute* "utils/ps2eps/ps2eps-src/bin/ps2eps.pl"
+                  (("gswin32c") "gs"))))
+            (replace 'check
+              (lambda* (#:key tests? #:allow-other-keys)
+                (when tests?
+                  (with-directory-excursion "utils/ps2eps"
+                    (invoke "make" "check")))))
+            (replace 'install
+              (lambda _
+                (with-directory-excursion "utils/ps2eps"
+                  (invoke "make" "install"))))))))
     (inputs (list perl))
     (home-page "https://ctan.org/pkg/ps2eps";)
     (synopsis "Produce Encapsulated PostScript from PostScript")

Reply via email to