git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #37068 from oxij/pkgs/speech

pkgs: some speech-related things

commit38c3df5396686301995b3f3926aaa6f642af793b authorJörg Thalheim <Mic92@users.noreply.github.com> dateSun 18 Mar 2018, 11:34 (9 years ago) parent6fc9ee8e6ff717
8 files changed+52−158
pkgs/applications/audio/eflite/buf-overflow.patch−22 pkgs/applications/audio/eflite/cvs-update.patch−98 pkgs/applications/audio/eflite/default.nix+25−6 pkgs/applications/audio/eflite/link.patch−11 pkgs/development/libraries/flite/default.nix+12−7 pkgs/development/libraries/flite/fix-rpath.patch−5 pkgs/development/libraries/speech-tools/default.nix+13−8 pkgs/top-level/all-packages.nix+2−1
pkgs/applications/audio/eflite/buf-overflow.patchdeleted−22
@@ -1,22 +0,0 @@
1−Fix buffer overflow
2−
3−--- eflite-0.4.1.orig/es.c
4−+++ eflite-0.4.1/es.c
5−@@ -329,7 +329,7 @@
6− char *p;
7−
8− p = getenv("HOME");
9−- sprintf(buf, "%s/.es.conf", p);
10−+ snprintf(buf, sizeof(buf), "%s/.es.conf", p);
11− fp = fopen(buf, "r");
12− if (!fp) fp = fopen("/etc/es.conf", "r");
13− if (!fp) return 1;
14−@@ -438,7 +438,7 @@
15− char logname[200];
16−
17− if ((flags & 0xffff) > DEBUG) return;
18−- sprintf(logname, "%s/es.log", getenv("HOME"));
19−+ snprintf(logname, sizeof(logname), "%s/es.log", getenv("HOME"));
20− va_start(arg, text);
21− vsnprintf(buf, 200, text, arg);
22− va_end(arg);
pkgs/applications/audio/eflite/cvs-update.patchdeleted−98
@@ -1,98 +0,0 @@
1−--- eflite-0.4.1.orig/fs.c
2−+++ eflite-0.4.1/fs.c
3−@@ -9,7 +9,7 @@
4− * GNU General Public License, as published by the Free Software
5− * Foundation. Please see the file COPYING for details.
6− *
7−- * $Id: fs.c,v 1.19 2007/01/18 23:58:42 mgorse Exp $
8−+ * $Id: fs.c,v 1.22 2008/03/05 15:21:43 mgorse Exp $
9− *
10− * Notes:
11− *
12−@@ -505,19 +505,6 @@
13− }
14− }
15−
16−-
17−-
18−-static void play_audio_close(void *cancel)
19−-{
20−- if (audiodev)
21−- {
22−- audio_drain(audiodev);
23−- close_audiodev();
24−- // usleep(5000);
25−- }
26−-}
27−-
28−-
29− static inline void determine_playlen(int speed, cst_wave *wptr, int type, int *pl, int *s)
30− {
31− int playlen, skip;
32−@@ -573,12 +560,12 @@
33− type = ac[ac_head].type;
34− WAVE_UNLOCK;
35− pthread_testcancel();
36−- pthread_cleanup_push(play_audio_close, NULL);
37−-
38−+
39− es_log(2, "Opening audio device.");
40− /* We abuse the wave mutex here to avoid being canceled
41− * while the audio device is being openned */
42− WAVE_LOCK;
43−+ assert(audiodev == NULL);
44− audiodev = audio_open(wptr->sample_rate, wptr->num_channels, CST_AUDIO_LINEAR16);
45− WAVE_UNLOCK;
46− if (audiodev == NULL)
47−@@ -606,8 +593,8 @@
48− #ifdef DEBUG
49− start_time = get_ticks_count();
50− #endif
51−- pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
52− audio_write(audiodev, wptr->samples + skip, playlen * 2);
53−+ pthread_testcancel();
54− es_log(2, "Write took %.2f seconds.", get_ticks_count() - start_time);
55− }
56− es_log(2, "play: syncing.");
57−@@ -617,16 +604,16 @@
58− audio_flush(audiodev);
59− pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
60− es_log(2, "Flush took %.2f seconds.", get_ticks_count() - start_time);
61−- es_log(2, "play: Closing audio device");
62−- close_audiodev();
63−- pthread_cleanup_pop(0);
64−- pthread_testcancel();
65−- TEXT_LOCK;
66−+ pthread_testcancel();
67−+
68−+ TEXT_LOCK;
69− time_left -= ((float)playlen) / wptr->sample_rate;
70− pthread_cond_signal(&text_condition);
71− TEXT_UNLOCK;
72−
73− WAVE_LOCK;
74−+ es_log(2, "play: Closing audio device");
75−+ close_audiodev();
76− ac_destroy(&ac[ac_head]);
77− ac_head++;
78− if (ac_head == ac_tail)
79−@@ -894,6 +881,7 @@
80− WAVE_LOCK_NI;
81− pthread_cond_signal(&wave_condition); // necessary because we inhibit cancellation while waiting
82− pthread_cancel(wave_thread);
83−+ if (audiodev != NULL) audio_drain(audiodev);
84− WAVE_UNLOCK_NI;
85− }
86−
87−@@ -917,7 +905,10 @@
88− }
89−
90− /* At this point, no thread is running */
91−-
92−+
93−+ // Make sure audio device is closed
94−+ close_audiodev();
95−+
96− /* Free any wave data */
97− es_log(2, "s_clear: freeing wave data: %d", ac_tail);
98− for (i = 0; i < ac_tail; i++)
pkgs/applications/audio/eflite/default.nix+25−6
@@ -1,21 +1,40 @@
1−{stdenv,fetchurl,flite,alsaLib,debug ? false}:
1+{ stdenv, fetchurl, fetchpatch, flite, alsaLib, debug ? false }:
22
33stdenv.mkDerivation rec {
44 name = "eflite-${version}";
55 version = "0.4.1";
6+
67 src = fetchurl {
78 url = "https://sourceforge.net/projects/eflite/files/eflite/${version}/${name}.tar.gz";
89 sha256 = "088p9w816s02s64grfs28gai3lnibzdjb9d1jwxzr8smbs2qbbci";
910 };
11+
1012 buildInputs = [ flite alsaLib ];
11− configureFlags = "flite_dir=${flite} --with-audio=alsa --with-vox=cmu_us_kal16";
13+
14+ configureFlags = [
15+ "flite_dir=${flite}"
16+ "--with-audio=alsa"
17+ "--with-vox=cmu_us_kal16"
18+ ];
19+
1220 patches = [
13− ./buf-overflow.patch
14− ./cvs-update.patch
15− ./link.patch
21+ (fetchpatch {
22+ url = "https://sources.debian.org/data/main/e/eflite/0.4.1-8/debian/patches/cvs-update";
23+ sha256 = "0r631vzmky7b7qyhm152557y4fr0xqrpi3y4w66fcn6p4rj03j05";
24+ })
25+ (fetchpatch {
26+ url = "https://sources.debian.org/data/main/e/eflite/0.4.1-8/debian/patches/buf-overflow";
27+ sha256 = "071qk133kb7n7bq6kxgh3p9bba6hcl1ixsn4lx8vp8klijgrvkmx";
28+ })
29+ (fetchpatch {
30+ url = "https://sources.debian.org/data/main/e/eflite/0.4.1-8/debian/patches/link";
31+ sha256 = "0p833dp4pdsya72bwh3syvkq85927pm6snxvx13lvcppisbhj0fc";
32+ })
1633 ./format.patch
17− ]; # Patches are taken from debian.
34+ ];
35+
1836 CFLAGS = stdenv.lib.optionalString debug " -DDEBUG=2";
37+
1938 meta = {
2039 homepage = http://eflite.sourceforge.net;
2140 description = "EFlite is a speech server for screen readers";
pkgs/applications/audio/eflite/link.patchdeleted−11
@@ -1,11 +0,0 @@
1−--- eflite-0.4.1/Makefile.in 2007-01-19 01:01:09.000000000 +0100
2−+++ eflite-0.4.1-new/Makefile.in 2017-03-01 23:25:34.223615492 +0100
3−@@ -34,7 +34,7 @@
4− $(CC) $(LDFLAGS) -o $@ $^ -lm $(LIBS) $(FLITE_LIBS) $(AUDIOLIBS)
5−
6− fs.o: fs.c
7−- $(CC) $(CFLAGS) @AUDIODEFS@ -I. -I$(flite_include_dir) -DREGISTER_VOX=register_$(subst cmu_us_kal16,cmu_us_kal,$(FL_VOX)) -DSTANDALONE -DEFLITE -c -o $@ $<
8−+ $(CC) $(CFLAGS) @AUDIODEFS@ -I. -I$(flite_include_dir) -DREGISTER_VOX=register_$(FL_VOX) -DSTANDALONE -DEFLITE -c -o $@ $<
9−
10− tone.o: tone.c
11− $(CC) $(CFLAGS) -I$(flite_include_dir) -DEFLITE -c -o $@ $<
pkgs/development/libraries/flite/default.nix+12−7
@@ -1,16 +1,21 @@
1−{ stdenv, fetchurl }:
1+{ stdenv, fetchFromGitHub, alsaLib }:
22
33stdenv.mkDerivation rec {
4− name = "flite-2.0.0";
4+ name = "flite-2.1.0";
55
6− src = fetchurl {
7− url = "http://www.festvox.org/flite/packed/flite-2.0/${name}-release.tar.bz2";
8− sha256 = "04g4r83jh4cl0irc8bg7njngcah7749956v9s6sh552kzmh3i337";
6+ src = fetchFromGitHub {
7+ owner = "festvox";
8+ repo = "flite";
9+ rev = "d673f65b2c4a8cd3da7447079309a6dc4bcf1a5e";
10+ sha256 = "1kx43jvdln370590gfjhxxz3chxfi6kq18504wmdpljib2l0grjq";
911 };
1012
11− patches = [ ./fix-rpath.patch ];
13+ buildInputs = [ alsaLib ];
1214
13− configureFlags = [ "--enable-shared" ];
15+ configureFlags = [
16+ "--enable-shared"
17+ "--with-audio=alsa"
18+ ];
1419
1520 enableParallelBuilding = true;
1621
pkgs/development/libraries/flite/fix-rpath.patchdeleted−5
@@ -1,5 +0,0 @@
1−--- a/main/Makefile
2−+++ b/main/Makefile
3−@@ -81 +80,1 @@ ifdef SHFLAGS
4−-flite_LIBS_flags += -Wl,-rpath $(LIBDIR)
5−+flite_LIBS_flags += -Wl,-rpath,$(INSTALLLIBDIR)
pkgs/development/libraries/speech-tools/default.nix+13−8
@@ -1,12 +1,12 @@
11{ stdenv, fetchurl, gawk, alsaLib, ncurses }:
22
33stdenv.mkDerivation rec {
4− name = "speech_tools-${version}";
5− version = "2.1";
4+ name = "speech_tools-${version}.0";
5+ version = "2.5";
66
77 src = fetchurl {
88 url = "http://www.festvox.org/packed/festival/${version}/${name}-release.tar.gz";
9− sha256 = "1s9bkfgdgyas8v2cr7x3dg0ck1xf9mn1q6a73gwy524sjb6nfqgz";
9+ sha256 = "1k2xh13miyv48gh06rgsq2vj25xwj7z6vwq9ilsn8i7ig3nrgzg4";
1010 };
1111
1212 buildInputs = [ alsaLib ncurses ];
@@ -14,6 +14,10 @@ stdenv.mkDerivation rec {
1414 preConfigure = ''
1515 sed -e s@/usr/bin/@@g -i $( grep -rl '/usr/bin/' . )
1616 sed -re 's@/bin/(rm|printf|uname)@\1@g' -i $( grep -rl '/bin/' . )
17+
18+ # c99 makes isnan valid for float and double
19+ substituteInPlace include/EST_math.h \
20+ --replace '__isnanf(X)' 'isnan(X)'
1721 '';
1822
1923 installPhase = ''
@@ -26,16 +30,17 @@ stdenv.mkDerivation rec {
2630 done
2731 '';
2832
33+ doCheck = true;
34+
35+ checkTarget = "test";
36+
2937 meta = with stdenv.lib; {
30− broken = true;
3138 description = "Text-to-speech engine";
32− maintainers = with maintainers;
33− [
34− raskin
35− ];
39+ maintainers = with maintainers; [ raskin ];
3640 platforms = platforms.linux;
3741 license = licenses.free;
3842 };
43+
3944 passthru = {
4045 updateInfo = {
4146 downloadPage = "http://www.festvox.org/packed/festival/";
pkgs/top-level/all-packages.nix+2−1
@@ -11372,7 +11372,8 @@ with pkgs;
1137211372
1137311373 speechd = callPackage ../development/libraries/speechd { };
1137411374
11375− speech_tools = callPackage ../development/libraries/speech-tools {};
11375+ speech-tools = callPackage ../development/libraries/speech-tools {};
11376+ speech_tools = speech-tools;
1137611377
1137711378 speex = callPackage ../development/libraries/speex {
1137811379 fftw = fftwFloat;