Subject: [bug#47355] ekho use new method to fix datadir

From: qblade <[email-masked]>
Date: Wed, 24 Mar 2021 01:07:18 +0000

I discussed with the developers of this project. It is not recommended to use environment variables to specify the datadir, so I switched to hard-coded paths.

From cd6371f4a903a2eda0824f31cbccb1da757ebe34 Mon Sep 17 00:00:00 2001
From: qblade <[email-masked]>
Date: Tue, 23 Mar 2021 13:03:54 +0000
Subject: [PATCH] gnu: ekho: use new method to fix datadir

* gnu/packages/speech.scm (ekho): use new method to fix datadir
---
 gnu/packages/speech.scm | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/speech.scm b/gnu/packages/speech.scm
index 687a3c10cf..cd0e3f80e2 100644
--- a/gnu/packages/speech.scm
+++ b/gnu/packages/speech.scm
@@ -576,10 +576,20 @@ control.")
        ("libsndfile" ,libsndfile)
        ("pulseaudio" ,pulseaudio)))
     (build-system gnu-build-system)
-    (native-search-paths
-     (list (search-path-specification
-            (variable "EKHO_DATA_PATH")
-            (files '("share/ekho-data")))))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'configure 'fix-datadir
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let*
+                 ((datadir
+                   (string-append
+                    (assoc-ref outputs "out") "/share/ekho-data")))
+               (substitute* "src/ekho_dict.cpp"
+                 (("/usr/local/share/ekho-data")
+                  datadir)
+                 (("/usr/share/ekho-data")
+                  datadir))))))))
     (home-page "https://eguidedog.net/ekho.php")
     (synopsis "Chinese text-to-speech software")
     (description
-- 
2.30.2