Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 20.03 120 lines 3.0 kB view raw
1{ stdenv 2, substituteAll 3, pkgconfig 4, fetchurl 5, python3Packages 6, gettext 7, itstool 8, libtool 9, texinfo 10, utillinux 11, autoreconfHook 12, glib 13, dotconf 14, libsndfile 15, withLibao ? true, libao 16, withPulse ? false, libpulseaudio 17, withAlsa ? false, alsaLib 18, withOss ? false 19, withFlite ? true, flite 20# , withFestival ? false, festival-freebsoft-utils 21, withEspeak ? true, espeak, sonic, pcaudiolib 22, withPico ? true, svox 23# , withIvona ? false, libdumbtts 24}: 25 26let 27 inherit (stdenv.lib) optional optionals; 28 inherit (python3Packages) python pyxdg wrapPython; 29 30 # speechd hard-codes espeak, even when built without support for it. 31 selectedDefaultModule = 32 if withEspeak then 33 "espeak-ng" 34 else if withPico then 35 "pico" 36 else if withFlite then 37 "flite" 38 else 39 throw "You need to enable at least one output module."; 40in stdenv.mkDerivation rec { 41 pname = "speech-dispatcher"; 42 version = "0.9.1"; 43 44 src = fetchurl { 45 url = "https://github.com/brailcom/speechd/releases/download/${version}/${pname}-${version}.tar.gz"; 46 hash = "sha256:16bg52hnkrsrs7kgbzanb34b9zb6fqxwj0a9bmsxmj1skkil1h1p"; 47 }; 48 49 patches = [ 50 (substituteAll { 51 src = ./fix-paths.patch; 52 inherit utillinux; 53 }) 54 ]; 55 56 nativeBuildInputs = [ 57 pkgconfig 58 autoreconfHook 59 gettext 60 libtool 61 itstool 62 texinfo 63 wrapPython 64 ]; 65 66 buildInputs = [ 67 glib 68 dotconf 69 libsndfile 70 libao 71 libpulseaudio 72 alsaLib 73 python 74 ] ++ optionals withEspeak [ 75 espeak 76 sonic 77 pcaudiolib 78 ] ++ optional withFlite flite 79 ++ optional withPico svox 80 # TODO: add flint/festival support with festival-freebsoft-utils package 81 # ++ optional withFestival festival-freebsoft-utils 82 # TODO: add Ivona support with libdumbtts package 83 # ++ optional withIvona libdumbtts 84 ; 85 86 pythonPath = [ pyxdg ]; 87 88 configureFlags = [ 89 # Audio method falls back from left to right. 90 "--with-default-audio-method=\"libao,pulse,alsa,oss\"" 91 "--with-systemdsystemunitdir=${placeholder ''out''}/lib/systemd/system" 92 ] ++ optional withPulse "--with-pulse" 93 ++ optional withAlsa "--with-alsa" 94 ++ optional withLibao "--with-libao" 95 ++ optional withOss "--with-oss" 96 ++ optional withEspeak "--with-espeak-ng" 97 ++ optional withPico "--with-pico" 98 # ++ optional withFestival "--with-flint" 99 # ++ optional withIvona "--with-ivona" 100 ; 101 102 postPatch = '' 103 substituteInPlace config/speechd.conf --replace "DefaultModule espeak" "DefaultModule ${selectedDefaultModule}" 104 substituteInPlace src/modules/pico.c --replace "/usr/share/pico/lang" "${svox}/share/pico/lang" 105 ''; 106 107 postInstall = '' 108 wrapPythonPrograms 109 ''; 110 111 enableParallelBuilding = true; 112 113 meta = with stdenv.lib; { 114 description = "Common interface to speech synthesis"; 115 homepage = "https://devel.freebsoft.org/speechd"; 116 license = licenses.gpl2Plus; 117 maintainers = with maintainers; [ berce ]; 118 platforms = platforms.linux; 119 }; 120}