eflite: init at 0.4.1

fixes #23336

authored by Ji-Haeng Huh and committed by Jörg Thalheim 85d0348e bcef9f83

+177
+1
lib/maintainers.nix
··· 223 223 jgeerds = "Jascha Geerds <jascha@jgeerds.name>"; 224 224 jgertm = "Tim Jaeger <jger.tm@gmail.com>"; 225 225 jgillich = "Jakob Gillich <jakob@gillich.me>"; 226 + jhhuh = "Ji-Haeng Huh <jhhuh.note@gmail.com>"; 226 227 jirkamarsik = "Jirka Marsik <jiri.marsik89@gmail.com>"; 227 228 joachifm = "Joachim Fasting <joachifm@fastmail.fm>"; 228 229 joamaki = "Jussi Maki <joamaki@gmail.com>";
+22
pkgs/applications/audio/eflite/buf-overflow.patch
··· 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);
+98
pkgs/applications/audio/eflite/cvs-update.patch
··· 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++)
+32
pkgs/applications/audio/eflite/default.nix
··· 1 + {stdenv,fetchurl,flite,alsaLib,debug ? false}: 2 + 3 + stdenv.mkDerivation rec { 4 + name = "eflite-${version}"; 5 + version = "0.4.1"; 6 + src = fetchurl { 7 + url = "https://sourceforge.net/projects/eflite/files/eflite/${version}/${name}.tar.gz"; 8 + sha256 = "088p9w816s02s64grfs28gai3lnibzdjb9d1jwxzr8smbs2qbbci"; 9 + }; 10 + buildInputs = [ flite alsaLib ]; 11 + configureFlags = "flite_dir=${flite} --with-audio=alsa --with-vox=cmu_us_kal16"; 12 + patches = [ 13 + ./buf-overflow.patch 14 + ./cvs-update.patch 15 + ./link.patch 16 + ./format.patch 17 + ]; # Patches are taken from debian. 18 + CFLAGS = stdenv.lib.optionalString debug " -DDEBUG=2"; 19 + meta = { 20 + homepage = http://eflite.sourceforge.net; 21 + description = "EFlite is a speech server for screen readers"; 22 + longDescription = '' 23 + EFlite is a speech server for Emacspeak and other screen 24 + readers that allows them to interface with Festival Lite, 25 + a free text-to-speech engine developed at the CMU Speech 26 + Center as an off-shoot of Festival. 27 + ''; 28 + license = stdenv.lib.licenses.gpl2; 29 + platforms = stdenv.lib.platforms.linux; 30 + maintainers = with stdenv.lib.maintainers; [ jhhuh ]; 31 + }; 32 + }
+11
pkgs/applications/audio/eflite/format.patch
··· 1 + --- eflite-0.4.1.orig/es.c 2017-03-02 14:38:36.009731423 +0100 2 + +++ eflite-0.4.1/es.c 2017-03-02 14:39:06.285894934 +0100 3 + @@ -449,7 +449,7 @@ 4 + fclose(fp); 5 + if (flags & LOG_STDERR) 6 + { 7 + - fprintf(stderr, buf); 8 + + fprintf(stderr, "%s", buf); 9 + fprintf(stderr, "\n"); 10 + } 11 + #endif
+11
pkgs/applications/audio/eflite/link.patch
··· 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 $@ $<
+2
pkgs/top-level/all-packages.nix
··· 1573 1573 1574 1574 edk2 = callPackage ../development/compilers/edk2 { }; 1575 1575 1576 + eflite = callPackage ../applications/audio/eflite {}; 1577 + 1576 1578 eid-mw = callPackage ../tools/security/eid-mw { }; 1577 1579 1578 1580 eid-viewer = callPackage ../tools/security/eid-viewer { };