2020-01-30 18:02:04 +00:00
|
|
|
{ stdenv
|
2020-01-30 18:12:36 +00:00
|
|
|
, substituteAll
|
2020-01-30 18:02:04 +00:00
|
|
|
, pkgconfig
|
|
|
|
, fetchurl
|
|
|
|
, python3Packages
|
2020-01-30 18:12:36 +00:00
|
|
|
, gettext
|
2020-01-30 18:02:04 +00:00
|
|
|
, itstool
|
|
|
|
, libtool
|
|
|
|
, texinfo
|
2020-11-24 15:29:28 +00:00
|
|
|
, util-linux
|
2020-01-30 18:02:04 +00:00
|
|
|
, autoreconfHook
|
|
|
|
, glib
|
|
|
|
, dotconf
|
|
|
|
, libsndfile
|
2017-12-20 22:52:42 +00:00
|
|
|
, withLibao ? true, libao
|
|
|
|
, withPulse ? false, libpulseaudio
|
|
|
|
, withAlsa ? false, alsaLib
|
|
|
|
, withOss ? false
|
|
|
|
, withFlite ? true, flite
|
|
|
|
# , withFestival ? false, festival-freebsoft-utils
|
|
|
|
, withEspeak ? true, espeak, sonic, pcaudiolib
|
2016-04-22 19:02:52 +01:00
|
|
|
, withPico ? true, svox
|
2017-12-20 22:52:42 +00:00
|
|
|
# , withIvona ? false, libdumbtts
|
2016-04-22 19:02:52 +01:00
|
|
|
}:
|
2011-02-10 19:23:27 +00:00
|
|
|
|
2017-12-20 22:52:42 +00: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 {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "speech-dispatcher";
|
2020-08-29 16:42:38 +01:00
|
|
|
version = "0.10.1";
|
2011-02-10 19:23:27 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2020-01-30 18:12:36 +00:00
|
|
|
url = "https://github.com/brailcom/speechd/releases/download/${version}/${pname}-${version}.tar.gz";
|
2020-08-29 16:42:38 +01:00
|
|
|
sha256 = "0j2lfzkmbsxrrgjw6arzvnfd4jn5pxab28xsk2djssr2ydb9x309";
|
2011-02-10 19:23:27 +00:00
|
|
|
};
|
|
|
|
|
2020-01-30 18:12:36 +00:00
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./fix-paths.patch;
|
2020-11-24 15:29:28 +00:00
|
|
|
utillinux = util-linux;
|
2020-01-30 18:12:36 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-01-30 18:02:04 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkgconfig
|
|
|
|
autoreconfHook
|
2020-01-30 18:12:36 +00:00
|
|
|
gettext
|
2020-01-30 18:02:04 +00:00
|
|
|
libtool
|
|
|
|
itstool
|
|
|
|
texinfo
|
|
|
|
wrapPython
|
|
|
|
];
|
2017-12-20 22:52:42 +00:00
|
|
|
|
2020-01-30 18:02:04 +00:00
|
|
|
buildInputs = [
|
|
|
|
glib
|
|
|
|
dotconf
|
|
|
|
libsndfile
|
|
|
|
libao
|
|
|
|
libpulseaudio
|
|
|
|
alsaLib
|
|
|
|
python
|
|
|
|
] ++ optionals withEspeak [
|
|
|
|
espeak
|
|
|
|
sonic
|
|
|
|
pcaudiolib
|
|
|
|
] ++ optional withFlite flite
|
2017-12-20 22:52:42 +00:00
|
|
|
++ 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
|
|
|
|
;
|
2011-02-10 19:23:27 +00:00
|
|
|
|
2017-12-20 22:52:42 +00:00
|
|
|
pythonPath = [ pyxdg ];
|
2015-12-23 01:59:47 +00:00
|
|
|
|
2017-12-20 22:52:42 +00:00
|
|
|
configureFlags = [
|
|
|
|
# Audio method falls back from left to right.
|
|
|
|
"--with-default-audio-method=\"libao,pulse,alsa,oss\""
|
2020-01-30 18:12:36 +00:00
|
|
|
"--with-systemdsystemunitdir=${placeholder ''out''}/lib/systemd/system"
|
2017-12-20 22:52:42 +00:00
|
|
|
] ++ 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"
|
|
|
|
;
|
2016-04-22 19:02:52 +01:00
|
|
|
|
2017-12-20 22:52:42 +00: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"
|
2016-04-22 19:02:52 +01:00
|
|
|
'';
|
2011-02-10 19:23:27 +00:00
|
|
|
|
2016-04-22 19:02:52 +01:00
|
|
|
postInstall = ''
|
|
|
|
wrapPythonPrograms
|
|
|
|
'';
|
|
|
|
|
2020-01-30 18:12:36 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2016-04-22 19:02:52 +01:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Common interface to speech synthesis";
|
2020-01-30 18:02:04 +00:00
|
|
|
homepage = "https://devel.freebsoft.org/speechd";
|
2016-04-22 19:02:52 +01:00
|
|
|
license = licenses.gpl2Plus;
|
2017-12-20 22:52:42 +00:00
|
|
|
maintainers = with maintainers; [ berce ];
|
2016-04-22 19:02:52 +01:00
|
|
|
platforms = platforms.linux;
|
2011-02-10 19:23:27 +00:00
|
|
|
};
|
|
|
|
}
|