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

commit 659a77bf125a65be22e7feaa2d2d4324ac871645
Author: Nicolas Goaziou <m...@nicolasgoaziou.fr>
AuthorDate: Mon May 27 23:53:04 2024 +0200

    gnu: Add texlive-bibtex8-bin.
    
    * gnu/packages/tex.scm (texlive-bibtex8-bin): New variable.
    (texlive-bibtex8)[propagated-inputs]: Add TEXLIVE-BIBTEX8-BIN.
    
    Change-Id: I64ef0f00cbec29e6abd4e3f2e2c96bbfb8db10e2
---
 gnu/packages/tex.scm | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)

diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index ee8fdf48df..22c07c3748 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -33704,6 +33704,7 @@ Japanese, for XeLaTeX.")
               "1ywv5rdk08dnrqr09pnjzff37x2c9m5i1wjzfsjnvm068is58c7s")))
     (outputs '("out" "doc"))
     (build-system texlive-build-system)
+    (propagated-inputs (list texlive-bibtex8-bin))
     (home-page "https://ctan.org/pkg/bibtex8";)
     (synopsis "BibTeX variant supporting 8-bit encodings")
     (description
@@ -33713,6 +33714,78 @@ capacity and 8-bit support extensions.  National 
character set and sorting
 order are controlled by an external configuration file.")
     (license license:gpl3+)))
 
+(define-public texlive-bibtex8-bin
+  (package
+    (inherit texlive-bin)
+    (name "texlive-bibtex8-bin")
+    (source
+     (origin
+       (inherit texlive-source)
+       (modules '((guix build utils)
+                  (ice-9 ftw)))
+       (snippet
+        #~(let ((delete-other-directories
+                 (lambda (root dirs with-files?)
+                   (with-directory-excursion root
+                     (for-each
+                      delete-file-recursively
+                      (scandir
+                       "."
+                       (lambda (file)
+                         (and (not (member file (append '("." "..") dirs)))
+                              (or with-files?
+                                  (eq? 'directory (stat:type (stat 
file))))))))))))
+            (delete-other-directories "libs" '() #f)
+            (delete-other-directories "utils" '() #f)
+            ;; Tests require "texmf.cnf" to be present in the tree.  Also test
+            ;; data is spread across multiple directories, which need to be
+            ;; preserved.
+            (delete-other-directories "texk" '("bibtex-x" "kpathsea" "tests" 
"web2c") #f)
+            (delete-other-directories "texk/web2c" '("tests") #t)
+            (with-directory-excursion "texk/kpathsea"
+              (for-each
+               delete-file-recursively
+               (scandir "." (lambda (f)
+                              (not (member f '("." ".." "texmf.cnf")))))))))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments texlive-bin)
+       ((#:configure-flags flags)
+        #~(cons* "--enable-bibtex-x"
+                 "--enable-bibtex8"
+                 "--disable-bibtexu"
+                 (delete "--enable-web2c" #$flags)))
+       ((#:phases phases)
+        #~(modify-phases #$phases
+            (add-after 'unpack 'locate-libkpathsea
+              (lambda _
+                (let ((kpathsea #$(this-package-input "texlive-libkpathsea")))
+                  (substitute* "texk/bibtex-x/Makefile.in"
+                    (("(KPATHSEA_LIBS =).*" _ lead)
+                     (format #f "~a \"-L~a/lib -lkpathsea\"\n" lead 
kpathsea))))))
+            (add-after 'unpack 'skip-bibtexu-test
+              ;; This package does not build "bibtexu" binary; the test below
+              ;; is therefore bound to fail.  Skip that part.
+              (lambda _
+                (substitute* "texk/bibtex-x/tests/bibtex8u-mem.test"
+                  (("\\./bibtexu .*") "exit 0\n"))))
+            (replace 'check
+              (lambda* (#:key tests? #:allow-other-keys)
+                (when tests?
+                  (with-directory-excursion "texk/bibtex-x"
+                    (invoke "make" "check")))))
+            (replace 'install
+              (lambda _
+                (with-directory-excursion "texk/bibtex-x"
+                  (invoke "make" "install"))))))))
+    (native-inputs (list pkg-config))
+    (inputs (list texlive-libkpathsea))
+    (propagated-inputs '())
+    (home-page (package-home-page texlive-bibtex8))
+    (synopsis "Binary for @code{texlive-bibtex8}")
+    (description
+     "This package provides the binary for @code{texlive-bibtex8}.")
+    (license (package-license texlive-bibtex8))))
+
 (define-public texlive-bibtexu
   (package
     (name "texlive-bibtexu")

Reply via email to