nixpkgs/pkgs/development/libraries/speechd/default.nix

82 lines
2.6 KiB
Nix
Raw Normal View History

2017-12-20 23:52:42 +01:00
{ stdenv, pkgconfig, fetchurl, python3Packages
, intltool, itstool, libtool, texinfo, autoreconfHook
, glib, dotconf, libsndfile
, withLibao ? true, libao
, withPulse ? false, libpulseaudio
, withAlsa ? false, alsaLib
, withOss ? false
, withFlite ? true, flite
# , withFestival ? false, festival-freebsoft-utils
, withEspeak ? true, espeak, sonic, pcaudiolib
, withPico ? true, svox
2017-12-20 23:52:42 +01:00
# , withIvona ? false, libdumbtts
}:
2017-12-20 23:52:42 +01:00
let
inherit (stdenv.lib) optional optionals;
inherit (python3Packages) python pyxdg wrapPython;
# speechd hard-codes espeak, even when built without support for it.
selectedDefaultModule =
if withEspeak then
"espeak-ng"
else if withPico then
"pico"
else if withFlite then
"flite"
else
throw "You need to enable at least one output module.";
in stdenv.mkDerivation rec {
pname = "speech-dispatcher";
2017-12-20 23:52:42 +01:00
version = "0.8.8";
src = fetchurl {
url = "http://www.freebsoft.org/pub/projects/speechd/${pname}-${version}.tar.gz";
2017-12-20 23:52:42 +01:00
sha256 = "1wvck00w9ixildaq6hlhnf6wa576y02ac96lp6932h3k1n08jaiw";
};
2017-12-20 23:52:42 +01:00
nativeBuildInputs = [ pkgconfig autoreconfHook intltool libtool itstool texinfo wrapPython ];
buildInputs = [ glib dotconf libsndfile libao libpulseaudio alsaLib python ]
++ optionals withEspeak [ espeak sonic pcaudiolib ]
++ optional withFlite flite
++ optional withPico svox
# TODO: add flint/festival support with festival-freebsoft-utils package
# ++ optional withFestival festival-freebsoft-utils
# TODO: add Ivona support with libdumbtts package
# ++ optional withIvona libdumbtts
;
2017-12-20 23:52:42 +01:00
pythonPath = [ pyxdg ];
2015-12-23 02:59:47 +01:00
2017-12-20 23:52:42 +01:00
configureFlags = [
# Audio method falls back from left to right.
"--with-default-audio-method=\"libao,pulse,alsa,oss\""
] ++ optional withPulse "--with-pulse"
++ optional withAlsa "--with-alsa"
++ optional withLibao "--with-libao"
++ optional withOss "--with-oss"
++ optional withEspeak "--with-espeak-ng"
++ optional withPico "--with-pico"
# ++ optional withFestival "--with-flint"
# ++ optional withIvona "--with-ivona"
;
2017-12-20 23:52:42 +01:00
postPatch = ''
substituteInPlace config/speechd.conf --replace "DefaultModule espeak" "DefaultModule ${selectedDefaultModule}"
substituteInPlace src/modules/pico.c --replace "/usr/share/pico/lang" "${svox}/share/pico/lang"
'';
postInstall = ''
wrapPythonPrograms
'';
meta = with stdenv.lib; {
description = "Common interface to speech synthesis";
2017-12-20 23:52:42 +01:00
homepage = https://devel.freebsoft.org/speechd;
license = licenses.gpl2Plus;
2017-12-20 23:52:42 +01:00
maintainers = with maintainers; [ berce ];
platforms = platforms.linux;
};
}