Subject: [PATCH] gnu: Add tran.

From: "Artyom V. Poptsov" <[email-masked]>
Date: Fri, 8 Mar 2024 15:26:30 +0300

* gnu/packages/shellutils.scm (tran): New variable.

Change-Id: I861be63cf773dbc67d929c86f50c4d50bdb9b41e
---
 gnu/packages/shellutils.scm | 50 +++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/gnu/packages/shellutils.scm b/gnu/packages/shellutils.scm
index e58e9e61fc..1f32c4725b 100644
--- a/gnu/packages/shellutils.scm
+++ b/gnu/packages/shellutils.scm
@@ -55,6 +55,7 @@ (define-module (gnu packages shellutils)
   #:use-module (gnu packages golang-xyz)
   #:use-module (gnu packages libunistring)
   #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages perl)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
@@ -483,6 +484,55 @@ (define-public trash-cli
 are already there.")
     (license license:gpl2+)))
 
+(define-public tran
+  (let ((commit "039df9529d5dfb8283edfb3c8b3cc16c01f0bfce")
+        (revision "0"))
+    (package
+      (name "tran")
+      ;; The latest upstream version seems to be "v5".
+      (version (git-version "5.0.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/kilobyte/tran")
+               (commit commit)))
+         (file-name (string-append name "-" version "-checkout"))
+         (sha256
+          (base32 "1kzr3lfhi5f8wpwjzrzlwkxjv9rasdr9ndjdns9kd16vsh0gl2rd"))))
+      (build-system gnu-build-system)
+      (inputs (list perl))
+      (arguments
+       `(#:tests? #f ;no tests
+         #:phases (modify-phases %standard-phases
+                    (delete 'configure)
+                    (add-after 'unpack 'patch
+                      (lambda* (#:key outputs #:allow-other-keys)
+                        (let ((out (assoc-ref outputs "out")))
+                          (substitute* "tran"
+                            (("my \\$DATA=\"data\"")
+                             (format #f "my $DATA=\"~a/share/tran/data\"" out))))))
+                    (replace 'build
+                      (lambda* (#:key outputs #:allow-other-keys)
+                        (invoke "make" "all")))
+                    (delete 'strip)
+                    (replace 'install
+                      (lambda* (#:key outputs #:allow-other-keys)
+                        (let ((out (assoc-ref outputs "out")))
+                          (install-file "tran"
+                                        (string-append out "/bin/"))
+                          (install-file "tran.1"
+                                        (string-append out "/share/man/man1/"))
+                          (copy-recursively "data"
+                                            (string-append out
+                                             "/share/tran/data/"))))))))
+      (home-page "https://github.com/kilobyte/tran")
+      (synopsis "Transcription between character scripts")
+      (description
+       "This tool can transliterate/transcribe text both ways between the Latin script
+and other languages.")
+      (license license:expat))))
+
 (define-public direnv
   (package
     (name "direnv")

base-commit: 7f2f1bcddae64c48f793cde15c21617fa706c157
-- 
2.41.0