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

commit be6b4c059b5fd62ddd2e61fe22f4f6a8e2346012
Author: Nicolas Goaziou <m...@nicolasgoaziou.fr>
AuthorDate: Sat May 11 12:14:32 2024 +0200

    gnu: texlive-xindy: Refactor package.
    
    * gnu/packages/tex.scm (texlive-xindy): Inherit from TEXLIVE-BIN.
    [source]: Use a trimmed TEXLIVE-SOURCE.
    [outputs]: Keep a single output.
    [arguments]: Inherit from TEXLIVE-BIN.
    
    Change-Id: Ifdf1a4cc65d503d550faf94651e506538266f390
---
 gnu/packages/tex.scm | 52 +++++++++++++++++++++++++++++++++-------------------
 1 file changed, 33 insertions(+), 19 deletions(-)

diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index 13b87c52fe..418d7cc862 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -71033,31 +71033,45 @@ handle complex tests.")
     ;; Texmf tree in TeX Live is incomplete, as it doesn't include
     ;; "xindy.mem", so it is not possible to use `texlive-origin'.  This file
     ;; isn't build by default by `texlive-bin' either.  Build it specially
-    ;; from `texlive-bin' source instead.
-    (inherit texlive-libkpathsea)
+    ;; from TEXLIVE-SOURCE instead.
+    (inherit texlive-bin)
     (name "texlive-xindy")
-    (version (number->string %texlive-revision))
-    (outputs '("out" "doc"))
-    (build-system gnu-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/" '("xindy"))
+            (delete-other-directories "texk/" '())))))
     (arguments
-     (substitute-keyword-arguments (package-arguments texlive-libkpathsea)
-       ((#:out-of-source? _ #t) #t)
+     (substitute-keyword-arguments (package-arguments texlive-bin)
        ((#:configure-flags flags)
-        #~(cons "--enable-xindy" (delete "--enable-kpathsea" #$flags)))
+        #~(cons* "--disable-all-pkgs"
+                 "--enable-xindy"
+                 (delete "--disable-xindy" #$flags)))
        ((#:phases _)
         #~(modify-phases %standard-phases
-            (replace 'install
+            ;; Building documentation require to generate font metrics, but
+            ;; HOME and therefore TEXMFVAR are unavailable.  Use a local
+            ;; TEXMFVAR instead.
+            (add-before 'build 'set-texmfvar
+              (lambda _
+                (setenv "TEXMFVAR" (string-append (getcwd) "/texmf-var"))))
+            ;; XXX: Install process does not create this directory.
+            (add-before 'install 'create-missing-directory
               (lambda _
-                (with-directory-excursion "utils/xindy/"
-                  (invoke "make")
-                  (mkdir-p (string-append #$output "/bin"))
-                  (invoke "make" "install")
-                  (let ((out (string-append #$output "/share"))
-                        (doc (string-append #$output:doc "/share/texmf-dist")))
-                    (mkdir-p doc)
-                    (with-directory-excursion doc
-                      (rename-file (string-append out "/texmf-dist/doc") "doc")
-                      (rename-file (string-append out "/man") "doc/man"))))))
+                (mkdir-p (string-append #$output "/bin"))))
             (add-after 'install 'patch-clisp-location
               (lambda* (#:key inputs #:allow-other-keys)
                 ;; The scripts are encoded in ISO-8859-1 (or iso-latin-1).

Reply via email to