nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 84 lines 2.3 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 fetchpatch, 6 alsa-lib, 7 libpulseaudio, 8 nix-update-script, 9 testers, 10 audioBackend ? "pulseaudio", 11}: 12assert lib.assertOneOf "audioBackend" audioBackend [ 13 "alsa" 14 "pulseaudio" 15]; 16stdenv.mkDerivation (finalAttrs: { 17 pname = "flite"; 18 version = "2.2"; 19 20 outputs = [ 21 "bin" 22 "dev" 23 "lib" 24 "out" 25 ]; 26 27 src = fetchFromGitHub { 28 owner = "festvox"; 29 repo = "flite"; 30 rev = "v${finalAttrs.version}"; 31 hash = "sha256-Tq5pyg3TiQt8CPqGXTyLOaGgaeLTmPp+Duw3+2VAF9g="; 32 }; 33 34 patches = [ 35 # https://github.com/festvox/flite/pull/60. 36 # Replaces `ar` with `$(AR)` in config/common_make_rules. 37 # Improves cross-compilation compatibility. 38 (fetchpatch { 39 url = "https://github.com/festvox/flite/commit/54c65164840777326bbb83517568e38a128122ef.patch"; 40 hash = "sha256-hvKzdX7adiqd9D+9DbnfNdqEULg1Hhqe1xElYxNM1B8="; 41 }) 42 # patch missing bsd conditions in configure 43 (fetchpatch { 44 url = "https://raw.githubusercontent.com/freebsd/freebsd-ports/0d316feccaf89c1bd804d6001274426a7135c93a/audio/flite/files/patch-configure"; 45 hash = "sha256-D2wOtmHFcuA8JRtIds03yPrBGtMuhLJHuufEQdpcB58="; 46 extraPrefix = ""; 47 }) 48 ]; 49 50 buildInputs = lib.optional stdenv.hostPlatform.isLinux ( 51 { 52 alsa = alsa-lib; 53 pulseaudio = libpulseaudio; 54 } 55 .${audioBackend} or (throw "${audioBackend} is not a supported backend!") 56 ); 57 58 configureFlags = [ 59 "--enable-shared" 60 ] 61 ++ lib.optionals stdenv.hostPlatform.isLinux [ "--with-audio=${audioBackend}" ]; 62 63 # main/Makefile creates and removes 'flite_voice_list.c' from multiple targets: 64 # make[1]: *** No rule to make target 'flite_voice_list.c', needed by 'all'. Stop 65 enableParallelBuilding = false; 66 67 passthru = { 68 tests.version = testers.testVersion { 69 # `flite` does have a `--version` command, but it returns 1 70 command = "flite --help"; 71 package = finalAttrs.finalPackage; 72 }; 73 74 updateScript = nix-update-script { }; 75 }; 76 77 meta = { 78 description = "Small, fast run-time speech synthesis engine"; 79 homepage = "http://www.festvox.org/flite/"; 80 license = lib.licenses.bsdOriginal; 81 maintainers = with lib.maintainers; [ getchoo ]; 82 mainProgram = "flite"; 83 }; 84})