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

From: 宋文武 <[email-masked]>
Date: Wed, 06 Oct 2021 18:47:51 +0800

qblade <[email-masked]> writes:

> 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.

Hello, I see that while the environment variable EKHO_DATA_PATH is
working fine, hard-coded it may be better.  Also there is a
`-DEKHO_DATA_PATH='"$(datadir)/ekho-data"'` in its Makefile.am, which
should work out-of-the-box without any flags, envs or patching, but it
doesn't...  I'll raise an issue on ekho later for this.

In the meanwhile, we can use this, which is a little better than
patching:
diff --git a/gnu/packages/speech.scm b/gnu/packages/speech.scm
index cbc46b32b4..10a4f3fa76 100644
--- a/gnu/packages/speech.scm
+++ b/gnu/packages/speech.scm
@@ -579,10 +579,12 @@ 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
+     '(#:configure-flags
+       (let* ((datadir (string-append (assoc-ref %outputs "out") "/share"))
+              (ekhodatadir (string-append datadir "/ekho-data")))
+         (list (simple-format #f "CXXFLAGS=-DEKHO_DATA_PATH='\"~a\"'"
+                              ekhodatadir)))))
     (home-page "https://eguidedog.net/ekho.php")
     (synopsis "Chinese text-to-speech software")
     (description

What do you think?  Thanks!