git.iko.soy/typeable/nixpkgs
on master help sign in
eflite: cleanup expression, switch to fetchpatching from debian
commit77864f7346bbf105eed29d59fd3c1e3c00e8a4a3 authorSLNOS <anonymous@wired> dateThu 1 Mar 2018, 00:00 (9 years ago) parent507d96d
4 files changed+25−137
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/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 $@ $<