nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 fetchpatch,
6 ncurses,
7 alsa-lib,
8}:
9
10stdenv.mkDerivation (finalAttrs: {
11 pname = "speech_tools";
12 version = "2.5.0";
13
14 src = fetchurl {
15 url = "http://www.festvox.org/packed/festival/${lib.versions.majorMinor finalAttrs.version}/speech_tools-${finalAttrs.version}-release.tar.gz";
16 sha256 = "1k2xh13miyv48gh06rgsq2vj25xwj7z6vwq9ilsn8i7ig3nrgzg4";
17 };
18
19 patches = [
20 # Fix build on Apple Silicon. Remove in the next release.
21 (fetchpatch {
22 url = "https://github.com/festvox/speech_tools/commit/06141f69d21bf507a9becb5405265dc362edb0df.patch";
23 hash = "sha256-tRestCBuRhak+2ccsB6mvDxGm/TIYX4eZ3oppCOEP9s=";
24 })
25 ];
26
27 buildInputs = [
28 ncurses
29 ]
30 ++ lib.optionals stdenv.hostPlatform.isLinux [
31 alsa-lib
32 ];
33
34 makeFlags = [
35 "CC=${stdenv.cc.targetPrefix}cc"
36 "CXX=${stdenv.cc.targetPrefix}c++"
37 ];
38
39 # Workaround build failure on -fno-common toolchains:
40 # ld: libestools.a(editline.o):(.bss+0x28): multiple definition of
41 # `editline_history_file'; libestools.a(siodeditline.o):(.data.rel.local+0x8): first defined here
42 env.NIX_CFLAGS_COMPILE = "-fcommon";
43
44 preConfigure = ''
45 sed -e s@/usr/bin/@@g -i $( grep -rl '/usr/bin/' . )
46 sed -re 's@/bin/(rm|printf|uname)@\1@g' -i $( grep -rl '/bin/' . )
47
48 # c99 makes isnan valid for float and double
49 substituteInPlace include/EST_math.h \
50 --replace '__isnanf(X)' 'isnan(X)'
51 '';
52
53 installPhase = ''
54 mkdir -p "$out"/{bin,lib}
55 for d in bin lib; do
56 for i in ./$d/*; do
57 test "$(basename "$i")" = "Makefile" ||
58 cp -r "$(readlink -f $i)" "$out/$d"
59 done
60 done
61 '';
62
63 doCheck = true;
64
65 checkTarget = "test";
66
67 meta = {
68 description = "Text-to-speech engine";
69 maintainers = with lib.maintainers; [ raskin ];
70 platforms = lib.platforms.unix;
71 license = lib.licenses.free;
72 };
73
74 passthru = {
75 updateInfo = {
76 downloadPage = "http://www.festvox.org/packed/festival/";
77 };
78 };
79})