Merge pull request #37068 from oxij/pkgs/speech
pkgs: some speech-related things
This commit is contained in:
commit
38c3df5396
8 changed files with 52 additions and 158 deletions
|
@ -1,22 +0,0 @@
|
|||
Fix buffer overflow
|
||||
|
||||
--- eflite-0.4.1.orig/es.c
|
||||
+++ eflite-0.4.1/es.c
|
||||
@@ -329,7 +329,7 @@
|
||||
char *p;
|
||||
|
||||
p = getenv("HOME");
|
||||
- sprintf(buf, "%s/.es.conf", p);
|
||||
+ snprintf(buf, sizeof(buf), "%s/.es.conf", p);
|
||||
fp = fopen(buf, "r");
|
||||
if (!fp) fp = fopen("/etc/es.conf", "r");
|
||||
if (!fp) return 1;
|
||||
@@ -438,7 +438,7 @@
|
||||
char logname[200];
|
||||
|
||||
if ((flags & 0xffff) > DEBUG) return;
|
||||
- sprintf(logname, "%s/es.log", getenv("HOME"));
|
||||
+ snprintf(logname, sizeof(logname), "%s/es.log", getenv("HOME"));
|
||||
va_start(arg, text);
|
||||
vsnprintf(buf, 200, text, arg);
|
||||
va_end(arg);
|
|
@ -1,98 +0,0 @@
|
|||
--- eflite-0.4.1.orig/fs.c
|
||||
+++ eflite-0.4.1/fs.c
|
||||
@@ -9,7 +9,7 @@
|
||||
* GNU General Public License, as published by the Free Software
|
||||
* Foundation. Please see the file COPYING for details.
|
||||
*
|
||||
- * $Id: fs.c,v 1.19 2007/01/18 23:58:42 mgorse Exp $
|
||||
+ * $Id: fs.c,v 1.22 2008/03/05 15:21:43 mgorse Exp $
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
@@ -505,19 +505,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
-
|
||||
-
|
||||
-static void play_audio_close(void *cancel)
|
||||
-{
|
||||
- if (audiodev)
|
||||
- {
|
||||
- audio_drain(audiodev);
|
||||
- close_audiodev();
|
||||
- // usleep(5000);
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-
|
||||
static inline void determine_playlen(int speed, cst_wave *wptr, int type, int *pl, int *s)
|
||||
{
|
||||
int playlen, skip;
|
||||
@@ -573,12 +560,12 @@
|
||||
type = ac[ac_head].type;
|
||||
WAVE_UNLOCK;
|
||||
pthread_testcancel();
|
||||
- pthread_cleanup_push(play_audio_close, NULL);
|
||||
-
|
||||
+
|
||||
es_log(2, "Opening audio device.");
|
||||
/* We abuse the wave mutex here to avoid being canceled
|
||||
* while the audio device is being openned */
|
||||
WAVE_LOCK;
|
||||
+ assert(audiodev == NULL);
|
||||
audiodev = audio_open(wptr->sample_rate, wptr->num_channels, CST_AUDIO_LINEAR16);
|
||||
WAVE_UNLOCK;
|
||||
if (audiodev == NULL)
|
||||
@@ -606,8 +593,8 @@
|
||||
#ifdef DEBUG
|
||||
start_time = get_ticks_count();
|
||||
#endif
|
||||
- pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
|
||||
audio_write(audiodev, wptr->samples + skip, playlen * 2);
|
||||
+ pthread_testcancel();
|
||||
es_log(2, "Write took %.2f seconds.", get_ticks_count() - start_time);
|
||||
}
|
||||
es_log(2, "play: syncing.");
|
||||
@@ -617,16 +604,16 @@
|
||||
audio_flush(audiodev);
|
||||
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
|
||||
es_log(2, "Flush took %.2f seconds.", get_ticks_count() - start_time);
|
||||
- es_log(2, "play: Closing audio device");
|
||||
- close_audiodev();
|
||||
- pthread_cleanup_pop(0);
|
||||
- pthread_testcancel();
|
||||
- TEXT_LOCK;
|
||||
+ pthread_testcancel();
|
||||
+
|
||||
+ TEXT_LOCK;
|
||||
time_left -= ((float)playlen) / wptr->sample_rate;
|
||||
pthread_cond_signal(&text_condition);
|
||||
TEXT_UNLOCK;
|
||||
|
||||
WAVE_LOCK;
|
||||
+ es_log(2, "play: Closing audio device");
|
||||
+ close_audiodev();
|
||||
ac_destroy(&ac[ac_head]);
|
||||
ac_head++;
|
||||
if (ac_head == ac_tail)
|
||||
@@ -894,6 +881,7 @@
|
||||
WAVE_LOCK_NI;
|
||||
pthread_cond_signal(&wave_condition); // necessary because we inhibit cancellation while waiting
|
||||
pthread_cancel(wave_thread);
|
||||
+ if (audiodev != NULL) audio_drain(audiodev);
|
||||
WAVE_UNLOCK_NI;
|
||||
}
|
||||
|
||||
@@ -917,7 +905,10 @@
|
||||
}
|
||||
|
||||
/* At this point, no thread is running */
|
||||
-
|
||||
+
|
||||
+ // Make sure audio device is closed
|
||||
+ close_audiodev();
|
||||
+
|
||||
/* Free any wave data */
|
||||
es_log(2, "s_clear: freeing wave data: %d", ac_tail);
|
||||
for (i = 0; i < ac_tail; i++)
|
|
@ -1,21 +1,40 @@
|
|||
{stdenv,fetchurl,flite,alsaLib,debug ? false}:
|
||||
{ stdenv, fetchurl, fetchpatch, flite, alsaLib, debug ? false }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "eflite-${version}";
|
||||
version = "0.4.1";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://sourceforge.net/projects/eflite/files/eflite/${version}/${name}.tar.gz";
|
||||
sha256 = "088p9w816s02s64grfs28gai3lnibzdjb9d1jwxzr8smbs2qbbci";
|
||||
};
|
||||
|
||||
buildInputs = [ flite alsaLib ];
|
||||
configureFlags = "flite_dir=${flite} --with-audio=alsa --with-vox=cmu_us_kal16";
|
||||
|
||||
configureFlags = [
|
||||
"flite_dir=${flite}"
|
||||
"--with-audio=alsa"
|
||||
"--with-vox=cmu_us_kal16"
|
||||
];
|
||||
|
||||
patches = [
|
||||
./buf-overflow.patch
|
||||
./cvs-update.patch
|
||||
./link.patch
|
||||
(fetchpatch {
|
||||
url = "https://sources.debian.org/data/main/e/eflite/0.4.1-8/debian/patches/cvs-update";
|
||||
sha256 = "0r631vzmky7b7qyhm152557y4fr0xqrpi3y4w66fcn6p4rj03j05";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://sources.debian.org/data/main/e/eflite/0.4.1-8/debian/patches/buf-overflow";
|
||||
sha256 = "071qk133kb7n7bq6kxgh3p9bba6hcl1ixsn4lx8vp8klijgrvkmx";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://sources.debian.org/data/main/e/eflite/0.4.1-8/debian/patches/link";
|
||||
sha256 = "0p833dp4pdsya72bwh3syvkq85927pm6snxvx13lvcppisbhj0fc";
|
||||
})
|
||||
./format.patch
|
||||
]; # Patches are taken from debian.
|
||||
];
|
||||
|
||||
CFLAGS = stdenv.lib.optionalString debug " -DDEBUG=2";
|
||||
|
||||
meta = {
|
||||
homepage = http://eflite.sourceforge.net;
|
||||
description = "EFlite is a speech server for screen readers";
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
--- eflite-0.4.1/Makefile.in 2007-01-19 01:01:09.000000000 +0100
|
||||
+++ eflite-0.4.1-new/Makefile.in 2017-03-01 23:25:34.223615492 +0100
|
||||
@@ -34,7 +34,7 @@
|
||||
$(CC) $(LDFLAGS) -o $@ $^ -lm $(LIBS) $(FLITE_LIBS) $(AUDIOLIBS)
|
||||
|
||||
fs.o: fs.c
|
||||
- $(CC) $(CFLAGS) @AUDIODEFS@ -I. -I$(flite_include_dir) -DREGISTER_VOX=register_$(subst cmu_us_kal16,cmu_us_kal,$(FL_VOX)) -DSTANDALONE -DEFLITE -c -o $@ $<
|
||||
+ $(CC) $(CFLAGS) @AUDIODEFS@ -I. -I$(flite_include_dir) -DREGISTER_VOX=register_$(FL_VOX) -DSTANDALONE -DEFLITE -c -o $@ $<
|
||||
|
||||
tone.o: tone.c
|
||||
$(CC) $(CFLAGS) -I$(flite_include_dir) -DEFLITE -c -o $@ $<
|
|
@ -1,16 +1,21 @@
|
|||
{ stdenv, fetchurl }:
|
||||
{ stdenv, fetchFromGitHub, alsaLib }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "flite-2.0.0";
|
||||
name = "flite-2.1.0";
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://www.festvox.org/flite/packed/flite-2.0/${name}-release.tar.bz2";
|
||||
sha256 = "04g4r83jh4cl0irc8bg7njngcah7749956v9s6sh552kzmh3i337";
|
||||
src = fetchFromGitHub {
|
||||
owner = "festvox";
|
||||
repo = "flite";
|
||||
rev = "d673f65b2c4a8cd3da7447079309a6dc4bcf1a5e";
|
||||
sha256 = "1kx43jvdln370590gfjhxxz3chxfi6kq18504wmdpljib2l0grjq";
|
||||
};
|
||||
|
||||
patches = [ ./fix-rpath.patch ];
|
||||
buildInputs = [ alsaLib ];
|
||||
|
||||
configureFlags = [ "--enable-shared" ];
|
||||
configureFlags = [
|
||||
"--enable-shared"
|
||||
"--with-audio=alsa"
|
||||
];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
--- a/main/Makefile
|
||||
+++ b/main/Makefile
|
||||
@@ -81 +80,1 @@ ifdef SHFLAGS
|
||||
-flite_LIBS_flags += -Wl,-rpath $(LIBDIR)
|
||||
+flite_LIBS_flags += -Wl,-rpath,$(INSTALLLIBDIR)
|
|
@ -1,12 +1,12 @@
|
|||
{ stdenv, fetchurl, gawk, alsaLib, ncurses }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "speech_tools-${version}";
|
||||
version = "2.1";
|
||||
name = "speech_tools-${version}.0";
|
||||
version = "2.5";
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://www.festvox.org/packed/festival/${version}/${name}-release.tar.gz";
|
||||
sha256 = "1s9bkfgdgyas8v2cr7x3dg0ck1xf9mn1q6a73gwy524sjb6nfqgz";
|
||||
sha256 = "1k2xh13miyv48gh06rgsq2vj25xwj7z6vwq9ilsn8i7ig3nrgzg4";
|
||||
};
|
||||
|
||||
buildInputs = [ alsaLib ncurses ];
|
||||
|
@ -14,6 +14,10 @@ stdenv.mkDerivation rec {
|
|||
preConfigure = ''
|
||||
sed -e s@/usr/bin/@@g -i $( grep -rl '/usr/bin/' . )
|
||||
sed -re 's@/bin/(rm|printf|uname)@\1@g' -i $( grep -rl '/bin/' . )
|
||||
|
||||
# c99 makes isnan valid for float and double
|
||||
substituteInPlace include/EST_math.h \
|
||||
--replace '__isnanf(X)' 'isnan(X)'
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
|
@ -26,16 +30,17 @@ stdenv.mkDerivation rec {
|
|||
done
|
||||
'';
|
||||
|
||||
doCheck = true;
|
||||
|
||||
checkTarget = "test";
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
broken = true;
|
||||
description = "Text-to-speech engine";
|
||||
maintainers = with maintainers;
|
||||
[
|
||||
raskin
|
||||
];
|
||||
maintainers = with maintainers; [ raskin ];
|
||||
platforms = platforms.linux;
|
||||
license = licenses.free;
|
||||
};
|
||||
|
||||
passthru = {
|
||||
updateInfo = {
|
||||
downloadPage = "http://www.festvox.org/packed/festival/";
|
||||
|
|
|
@ -11372,7 +11372,8 @@ with pkgs;
|
|||
|
||||
speechd = callPackage ../development/libraries/speechd { };
|
||||
|
||||
speech_tools = callPackage ../development/libraries/speech-tools {};
|
||||
speech-tools = callPackage ../development/libraries/speech-tools {};
|
||||
speech_tools = speech-tools;
|
||||
|
||||
speex = callPackage ../development/libraries/speex {
|
||||
fftw = fftwFloat;
|
||||
|
|
Loading…
Reference in a new issue