1{ lib, stdenv, fetchFromGitHub, alsa-lib, fetchpatch }:
2
3stdenv.mkDerivation rec {
4 pname = "flite";
5 version = "2.2";
6
7 src = fetchFromGitHub {
8 owner = "festvox";
9 repo = "flite";
10 rev = "v${version}";
11 sha256 = "1n0p81jzndzc1rzgm66kw9ls189ricy5v1ps11y0p2fk1p56kbjf";
12 };
13
14 buildInputs = lib.optionals stdenv.isLinux [ alsa-lib ];
15
16 # https://github.com/festvox/flite/pull/60.
17 # Replaces `ar` with `$(AR)` in config/common_make_rules.
18 # Improves cross-compilation compatibility.
19 patches = [
20 (fetchpatch {
21 url = "https://github.com/festvox/flite/commit/54c65164840777326bbb83517568e38a128122ef.patch";
22 sha256 = "sha256-hvKzdX7adiqd9D+9DbnfNdqEULg1Hhqe1xElYxNM1B8=";
23 })
24 ];
25
26 configureFlags = [
27 "--enable-shared"
28 ] ++ lib.optionals stdenv.isLinux [ "--with-audio=alsa" ];
29
30 # main/Makefile creates and removes 'flite_voice_list.c' from multiple targets:
31 # make[1]: *** No rule to make target 'flite_voice_list.c', needed by 'all'. Stop
32 enableParallelBuilding = false;
33
34 meta = with lib; {
35 description = "A small, fast run-time speech synthesis engine";
36 homepage = "http://www.festvox.org/flite/";
37 license = licenses.bsdOriginal;
38 platforms = platforms.all;
39 };
40}