1{ lib, stdenv, fetchurl, alsa-lib, ncurses }:
2
3stdenv.mkDerivation rec {
4 pname = "speech_tools";
5 version = "2.5.0";
6
7 src = fetchurl {
8 url = "http://www.festvox.org/packed/festival/${lib.versions.majorMinor version}/speech_tools-${version}-release.tar.gz";
9 sha256 = "1k2xh13miyv48gh06rgsq2vj25xwj7z6vwq9ilsn8i7ig3nrgzg4";
10 };
11
12 buildInputs = [ alsa-lib ncurses ];
13
14 # Workaround build failure on -fno-common toolchains:
15 # ld: libestools.a(editline.o):(.bss+0x28): multiple definition of
16 # `editline_history_file'; libestools.a(siodeditline.o):(.data.rel.local+0x8): first defined here
17 env.NIX_CFLAGS_COMPILE = "-fcommon";
18
19 preConfigure = ''
20 sed -e s@/usr/bin/@@g -i $( grep -rl '/usr/bin/' . )
21 sed -re 's@/bin/(rm|printf|uname)@\1@g' -i $( grep -rl '/bin/' . )
22
23 # c99 makes isnan valid for float and double
24 substituteInPlace include/EST_math.h \
25 --replace '__isnanf(X)' 'isnan(X)'
26 '';
27
28 installPhase = ''
29 mkdir -p "$out"/{bin,lib}
30 for d in bin lib; do
31 for i in ./$d/*; do
32 test "$(basename "$i")" = "Makefile" ||
33 cp -r "$(readlink -f $i)" "$out/$d"
34 done
35 done
36 '';
37
38 doCheck = true;
39
40 checkTarget = "test";
41
42 meta = with lib; {
43 description = "Text-to-speech engine";
44 maintainers = with maintainers; [ raskin ];
45 platforms = platforms.linux;
46 license = licenses.free;
47 };
48
49 passthru = {
50 updateInfo = {
51 downloadPage = "http://www.festvox.org/packed/festival/";
52 };
53 };
54}