2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, substituteAll
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchurl
|
|
|
|
, python3Packages
|
|
|
|
, gettext
|
|
|
|
, itstool
|
|
|
|
, libtool
|
|
|
|
, texinfo
|
2020-11-24 20:58:05 +00:00
|
|
|
, util-linux
|
2020-04-24 23:36:52 +00:00
|
|
|
, 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
|
|
|
|
# , withIvona ? false, libdumbtts
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2021-02-05 17:12:51 +00:00
|
|
|
inherit (lib) optional optionals;
|
2020-04-24 23:36:52 +00:00
|
|
|
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";
|
2021-03-19 17:17:44 +00:00
|
|
|
version = "0.10.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/brailcom/speechd/releases/download/${version}/${pname}-${version}.tar.gz";
|
2021-03-19 17:17:44 +00:00
|
|
|
sha256 = "sha256-sGMZ8gHhXlbGKWZTr1vPwwDLNI6XLVF9+LBurHfq4tw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./fix-paths.patch;
|
2020-11-24 20:58:05 +00:00
|
|
|
utillinux = util-linux;
|
2020-04-24 23:36:52 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
autoreconfHook
|
|
|
|
gettext
|
|
|
|
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
|
|
|
|
;
|
|
|
|
|
|
|
|
pythonPath = [ pyxdg ];
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
# Audio method falls back from left to right.
|
|
|
|
"--with-default-audio-method=\"libao,pulse,alsa,oss\""
|
2021-02-05 17:12:51 +00:00
|
|
|
"--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
|
2020-04-24 23:36:52 +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"
|
|
|
|
;
|
|
|
|
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Common interface to speech synthesis";
|
|
|
|
homepage = "https://devel.freebsoft.org/speechd";
|
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
maintainers = with maintainers; [ berce ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|