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

commit 7becb1de7ccd49530572248beba5bcf969ee964b
Author: Nicolas Goaziou <m...@nicolasgoaziou.fr>
AuthorDate: Sat May 11 10:13:34 2024 +0200

    gnu: texlive-upmendex: Build executables.
    
    * gnu/packages/tex.scm (texlive-upmendex)[source]: Build from 
TEXLIVE-SOURCE.
    [outputs]: Only provide "out".
    [arguments]: Build `upmendex' as a single package.
    [native-inputs]: Add PKG-CONFIG, and documentation.
    [inputs]: Add ICU4C.
    
    * gnu/packages/tex.scm (texlive-bin): Do not provide related binaries.
    
    Change-Id: Ifc19df9e24a5eb07f5b9f26d77072fab3a78b21c
---
 gnu/packages/tex.scm | 70 +++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 59 insertions(+), 11 deletions(-)

diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index d6a5198418..13b87c52fe 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -701,7 +701,8 @@ and should be preferred to it whenever a package would 
otherwise depend on
                 "--disable-chktex"
                 "--disable-dvisvgm"
                 "--disable-kpathsea"
-                "--disable-psutils"))
+                "--disable-psutils"
+                "--disable-upmendex"))
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'locate-external-kpathsea
@@ -45028,17 +45029,64 @@ chosen and developed with an emphasis on drawing 
graphs in economics.")
 
 (define-public texlive-upmendex
   (package
+    (inherit texlive-bin)
     (name "texlive-upmendex")
-    (version (number->string %texlive-revision))
-    (source (texlive-origin
-             name version
-             (list "doc/man/man1/upmendex.1"
-                   "doc/man/man1/upmendex.man1.pdf"
-                   "doc/support/upmendex/")
-             (base32
-              "0mj8nmqr3z7b802kvjmnkckq89l694an7s639yghf3b9b5v7xihx")))
-    (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/" '())
+            (delete-other-directories "texk/" '("upmendex"))))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments texlive-bin)
+       ((#:configure-flags flags)
+        #~(cons* "--disable-all-pkgs"
+                 "--enable-upmendex"
+                 "--with-system-icu"
+                 (delete "--disable-upmendex" #$flags)))
+       ((#:phases _)
+        #~(modify-phases %standard-phases
+            (replace 'check
+              (lambda* (#:key tests? #:allow-other-keys)
+                (when tests?
+                  (with-directory-excursion "texk/upmendex"
+                    (invoke "make" "check")))))
+            (replace 'install
+              (lambda* (#:key inputs native-inputs #:allow-other-keys)
+                (with-directory-excursion "texk/upmendex"
+                  (invoke "make" "install"))
+                (let ((doc
+                       ((compose dirname dirname dirname) ;get to "doc/"
+                        (search-input-file (or native-inputs inputs)
+                                           "doc/man/man1/upmendex.1"))))
+                  (mkdir-p doc)
+                  (copy-recursively (string-append doc "/support")
+                                    (string-append #$output 
"/share/texmf-dist/doc"))
+                  (copy-recursively (string-append doc "/man")
+                                    (string-append #$output 
"/share/man")))))))))
+    (native-inputs
+     (list pkg-config
+           ;; Since TEXLIVE-SOURCE does not provide doc files, grab them from
+           ;; TeX Live repository.
+           (texlive-origin
+            name (package-version texlive-bin)
+            (list "doc/man/man1/upmendex.1"
+                  "doc/support/upmendex/")
+            (base32
+             "0ipd6q6c9bmbf280h02apl826dji1r0p18870sm2cnkrwm7zr4kz"))))
+    (inputs (list icu4c))
     (home-page "https://ctan.org/pkg/upmendex";)
     (synopsis "Multilingual index processor")
     (description

Reply via email to