From 9a9f1a5aab5e9b82ed75f821cf740c8dbbd0a820 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Date: Tue, 28 May 2024 00:49:34 +0200
Subject: gnu: Add texlive-gsftopk-bin.

* gnu/packages/tex.scm (texlive-gsftopk-bin): New variable.
(texlive-gsftopk)[propagated-inputs]: Add TEXLIVE-GSFTOPK-BIN.

Change-Id: I91c459392b4fb4b433b4abd47d09170e3927fefc
---
 gnu/packages/tex.scm | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

(limited to 'gnu')

diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index 7b91e9c53f..968c0d9319 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -47722,6 +47722,7 @@ (define-public texlive-gsftopk
               "1qlac704qbm7kq762z0b887wfncprpcm8zj2lb4nag0wzdrrjdq5")))
     (outputs '("out" "doc"))
     (build-system texlive-build-system)
+    (propagated-inputs (list texlive-gsftopk-bin))
     (home-page "https://ctan.org/pkg/gsftopk")
     (synopsis "Convert Ghostscript fonts to PK files")
     (description
@@ -47731,6 +47732,52 @@ (define-public texlive-gsftopk
 dealing with Type 1 fonts, direct.")
     (license license:gpl3+)))
 
+(define-public texlive-gsftopk-bin
+  (package
+    (inherit texlive-bin)
+    (name "texlive-gsftopk-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" '("gsftopk"))))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments texlive-bin)
+       ((#:configure-flags flags)
+        #~(cons "--enable-gsftopk" (delete "--enable-web2c" #$flags)))
+       ((#:phases phases)
+        #~(modify-phases #$phases
+            (replace 'check
+              (lambda* (#:key tests? #:allow-other-keys)
+                (when tests?
+                  (with-directory-excursion "texk/gsftopk"
+                    (invoke "make" "check")))))
+            (replace 'install
+              (lambda _
+                (with-directory-excursion "texk/gsftopk"
+                  (invoke "make" "install"))))))))
+    (native-inputs (list pkg-config))
+    (inputs (list texlive-libkpathsea))
+    (propagated-inputs '())
+    (home-page (package-home-page texlive-gsftopk))
+    (synopsis "Binary for @code{texlive-gsftopk}")
+    (description
+     "This package provides the binary for @code{texlive-gsftopk}.")
+    (license (package-license texlive-gsftopk))))
+
 (define-public texlive-hycolor
   (package
     (name "texlive-hycolor")
-- 
cgit v1.2.3