nixpkgs/pkgs/development/libraries/speechd/default.nix
Jonathan Ringer 9bb3fccb5b treewide: pkgs.pkgconfig -> pkgs.pkg-config, move pkgconfig to alias.nix
continuation of #109595

pkgconfig was aliased in 2018, however, it remained in
all-packages.nix due to its wide usage. This cleans
up the remaining references to pkgs.pkgsconfig and
moves the entry to aliases.nix.

python3Packages.pkgconfig remained unchanged because
it's the canonical name of the upstream package
on pypi.
2021-01-19 01:16:25 -08:00

121 lines
2.9 KiB
Nix

{ stdenv
, substituteAll
, pkg-config
, fetchurl
, python3Packages
, gettext
, itstool
, libtool
, texinfo
, util-linux
, 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
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";
version = "0.10.1";
src = fetchurl {
url = "https://github.com/brailcom/speechd/releases/download/${version}/${pname}-${version}.tar.gz";
sha256 = "0j2lfzkmbsxrrgjw6arzvnfd4jn5pxab28xsk2djssr2ydb9x309";
};
patches = [
(substituteAll {
src = ./fix-paths.patch;
utillinux = util-linux;
})
];
nativeBuildInputs = [
pkg-config
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\""
"--with-systemdsystemunitdir=${placeholder ''out''}/lib/systemd/system"
] ++ 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;
meta = with stdenv.lib; {
description = "Common interface to speech synthesis";
homepage = "https://devel.freebsoft.org/speechd";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ berce ];
platforms = platforms.linux;
};
}