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

129 lines
3.2 KiB
Nix
Raw Normal View History

{ lib, stdenv
, substituteAll
, pkg-config
2020-01-30 18:02:04 +00:00
, fetchurl
2021-03-24 09:54:50 +00:00
, fetchpatch
2020-01-30 18:02:04 +00:00
, python3Packages
, 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, alsa-lib
2017-12-20 22:52:42 +00:00
, withOss ? false
, withFlite ? true, flite
# , withFestival ? false, festival-freebsoft-utils
, withEspeak ? true, espeak, sonic, pcaudiolib
, withPico ? true, svox
2017-12-20 22:52:42 +00:00
# , withIvona ? false, libdumbtts
}:
2017-12-20 22:52:42 +00:00
let
inherit (lib) optional optionals;
2017-12-20 22:52:42 +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-09 19:56:18 +00:00
version = "0.10.2";
src = fetchurl {
url = "https://github.com/brailcom/speechd/releases/download/${version}/${pname}-${version}.tar.gz";
2021-03-09 19:56:18 +00:00
sha256 = "sha256-sGMZ8gHhXlbGKWZTr1vPwwDLNI6XLVF9+LBurHfq4tw=";
};
patches = [
(substituteAll {
src = ./fix-paths.patch;
2020-11-24 15:29:28 +00:00
utillinux = util-linux;
})
2021-03-24 09:54:50 +00:00
# Fix build with Glib 2.68
# https://github.com/brailcom/speechd/pull/462
(fetchpatch {
url = "https://github.com/brailcom/speechd/commit/a2faab416e42cbdf3d73f98578a89eb7a235e25a.patch";
sha256 = "8Q7tUdKKBBtgXZZnj59OcJOkrCNeBR9gkBjhKlpW0hQ=";
})
];
2020-01-30 18:02:04 +00:00
nativeBuildInputs = [
pkg-config
2020-01-30 18:02:04 +00:00
autoreconfHook
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
alsa-lib
2020-01-30 18:02:04 +00:00
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
;
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\""
"--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"
;
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"
'';
postInstall = ''
wrapPythonPrograms
'';
enableParallelBuilding = true;
meta = with lib; {
description = "Common interface to speech synthesis";
2020-01-30 18:02:04 +00:00
homepage = "https://devel.freebsoft.org/speechd";
license = licenses.gpl2Plus;
2017-12-20 22:52:42 +00:00
maintainers = with maintainers; [ berce ];
platforms = platforms.linux;
};
}