summary refs log tree commit diff
path: root/gnu/packages/tex.scm
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2021-01-05 22:15:09 -0500
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2021-01-14 09:02:12 -0500
commit92fd8975a1c0b680f8ee1477b8f3b132cf3870dc (patch)
tree78289894ba948f6c5156abbca9a2b863bd067504 /gnu/packages/tex.scm
parent9e78ea79f81d9eec0fab9cbe204899e384973649 (diff)
downloadguix-92fd8975a1c0b680f8ee1477b8f3b132cf3870dc.tar.gz
gnu: texlive-bin: Patch shell commands in scripts.
* gnu/packages/tex.scm (texlive-bin)[phases]{patch-scripts}: New phase.
Diffstat (limited to 'gnu/packages/tex.scm')
-rw-r--r--gnu/packages/tex.scm24
1 files changed, 24 insertions, 0 deletions
diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index 4a4184c338..67fec8b474 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -406,6 +406,30 @@ files from LOCATIONS with expected checksum HASH.  CODE is not currently in use.
              (with-directory-excursion "texlive-scripts"
                (apply (assoc-ref %standard-phases 'unpack)
                       (list #:source (assoc-ref inputs "texlive-scripts"))))))
+         (add-after 'unpack-texlive-scripts 'patch-scripts
+           (lambda _
+             (let* ((scripts (append (find-files "texk/kpathsea" "^mktex")
+                                     (find-files "texlive-scripts" "\\.sh$")))
+                    (commands '("awk" "basename" "cat" "grep" "mkdir" "rm"
+                                "sed" "sort" "uname"))
+                    (command-regexp (format #f "\\b(~a)\\b"
+                                            (string-join commands "|")))
+                    (iso-8859-1-encoded-scripts
+                     '("texlive-scripts/source/rubibtex.sh"
+                       "texlive-scripts/source/rumakeindex.sh")))
+
+               (define (substitute-commands scripts)
+                 (substitute* scripts
+                   ((command-regexp dummy command)
+                    (which command))))
+
+               (substitute-commands (lset-difference string= scripts
+                                                     iso-8859-1-encoded-scripts))
+
+               (with-fluids ((%default-port-encoding "ISO-8859-1"))
+                 (substitute-commands iso-8859-1-encoded-scripts))
+
+               #t)))
          (add-after 'install 'postint
            (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
              (let* ((out (assoc-ref outputs "out"))