ekho use new method to fix datadir

  • Open
  • quality assurance status badge
Details
2 participants
  • ???
  • qblade
Owner
unassigned
Submitted by
qblade
Severity
normal
Q
Q
qblade wrote on 24 Mar 2021 02:07
(name . Guix-patches)(address . guix-patches@gnu.org)
oiDwRbkRiKQ62jNg6L9bQ-JVrYEjcXQncETHW8QqGtQDEveqc1C7qihSwBJ-tTtsZ3iAC3cDwvsBRvF-c_n99-LgwStcoFOFPaz513RFQ-s=@protonmail.com
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 <qblade@protonmail.com>
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(-)

Toggle diff (31 lines)
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
?
(name . qblade)(address . qblade@protonmail.com)(address . 47355@debbugs.gnu.org)
TYCP286MB18974DED26CB6C4B9301C183A3B09@TYCP286MB1897.JPNP286.PROD.OUTLOOK.COM
qblade <qblade@protonmail.com> writes:

Toggle quote (4 lines)
> 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:
Toggle diff (21 lines)
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!
?