Merge #318370: flite: refactor & modernize

...into staging
This commit is contained in:
Vladimír Čunát
2024-06-24 12:23:46 +02:00
3 changed files with 74 additions and 53 deletions
+74
View File
@@ -0,0 +1,74 @@
{
lib,
stdenv,
fetchFromGitHub,
fetchpatch,
alsa-lib,
libpulseaudio,
testers,
audioBackend ? "pulseaudio",
}:
assert lib.assertOneOf "audioBackend" audioBackend [
"alsa"
"pulseaudio"
];
stdenv.mkDerivation (finalAttrs: {
pname = "flite";
version = "2.2";
outputs = [
"bin"
"dev"
"lib"
"out"
];
src = fetchFromGitHub {
owner = "festvox";
repo = "flite";
rev = "v${finalAttrs.version}";
hash = "sha256-Tq5pyg3TiQt8CPqGXTyLOaGgaeLTmPp+Duw3+2VAF9g=";
};
# https://github.com/festvox/flite/pull/60.
# Replaces `ar` with `$(AR)` in config/common_make_rules.
# Improves cross-compilation compatibility.
patches = [
(fetchpatch {
url = "https://github.com/festvox/flite/commit/54c65164840777326bbb83517568e38a128122ef.patch";
hash = "sha256-hvKzdX7adiqd9D+9DbnfNdqEULg1Hhqe1xElYxNM1B8=";
})
];
buildInputs = lib.optional stdenv.isLinux (
{
alsa = alsa-lib;
pulseaudio = libpulseaudio;
}
.${audioBackend} or (throw "${audioBackend} is not a supported backend!")
);
configureFlags = [
"--enable-shared"
] ++ lib.optionals stdenv.isLinux [ "--with-audio=${audioBackend}" ];
# main/Makefile creates and removes 'flite_voice_list.c' from multiple targets:
# make[1]: *** No rule to make target 'flite_voice_list.c', needed by 'all'. Stop
enableParallelBuilding = false;
passthru = {
tests.version = testers.testVersion {
# `flite` does have a `--version` command, but it returns 1
command = "flite --help";
package = finalAttrs.finalPackage;
};
};
meta = {
description = "Small, fast run-time speech synthesis engine";
homepage = "http://www.festvox.org/flite/";
license = lib.licenses.bsdOriginal;
maintainers = with lib.maintainers; [ getchoo ];
mainProgram = "flite";
};
})
@@ -1,51 +0,0 @@
{ lib
, stdenv
, fetchFromGitHub
, alsa-lib
, fetchpatch
, libpulseaudio
, audioBackend ? "pulseaudio"
}:
assert lib.assertOneOf "audioBackend" audioBackend [ "alsa" "pulseaudio" ];
stdenv.mkDerivation rec {
pname = "flite";
version = "2.2";
src = fetchFromGitHub {
owner = "festvox";
repo = "flite";
rev = "v${version}";
sha256 = "1n0p81jzndzc1rzgm66kw9ls189ricy5v1ps11y0p2fk1p56kbjf";
};
buildInputs = lib.optional (stdenv.isLinux && audioBackend == "alsa") alsa-lib
++ lib.optional (stdenv.isLinux && audioBackend == "pulseaudio") libpulseaudio;
# https://github.com/festvox/flite/pull/60.
# Replaces `ar` with `$(AR)` in config/common_make_rules.
# Improves cross-compilation compatibility.
patches = [
(fetchpatch {
url = "https://github.com/festvox/flite/commit/54c65164840777326bbb83517568e38a128122ef.patch";
sha256 = "sha256-hvKzdX7adiqd9D+9DbnfNdqEULg1Hhqe1xElYxNM1B8=";
})
];
configureFlags = [
"--enable-shared"
] ++ lib.optionals stdenv.isLinux [ "--with-audio=${audioBackend}" ];
# main/Makefile creates and removes 'flite_voice_list.c' from multiple targets:
# make[1]: *** No rule to make target 'flite_voice_list.c', needed by 'all'. Stop
enableParallelBuilding = false;
meta = with lib; {
description = "Small, fast run-time speech synthesis engine";
homepage = "http://www.festvox.org/flite/";
license = licenses.bsdOriginal;
maintainers = with maintainers; [ getchoo ];
platforms = platforms.all;
};
}
-2
View File
@@ -20577,8 +20577,6 @@ with pkgs;
flint3 = callPackage ../development/libraries/flint/3.nix { };
flite = callPackage ../development/libraries/flite { };
fltk13 = callPackage ../development/libraries/fltk {
inherit (darwin.apple_sdk.frameworks) ApplicationServices Carbon Cocoa OpenGL;
};