flite: add audioBackend option

this allows for arbitrary audio backends to be set while building flite
This commit is contained in:
seth 2023-06-22 08:31:59 -04:00
parent 61abd839c4
commit f256bf2dc4
No known key found for this signature in database
GPG key ID: D31BD0D494BBEE86

View file

@ -1,4 +1,13 @@
{ lib, stdenv, fetchFromGitHub, alsa-lib, fetchpatch }:
{ lib
, stdenv
, fetchFromGitHub
, alsa-lib
, fetchpatch
, libpulseaudio
, audioBackend ? "pulseaudio"
}:
assert lib.assertOneOf "audioBackend" audioBackend [ "alsa" "pulseaudio" ];
stdenv.mkDerivation rec {
pname = "flite";
@ -11,7 +20,8 @@ stdenv.mkDerivation rec {
sha256 = "1n0p81jzndzc1rzgm66kw9ls189ricy5v1ps11y0p2fk1p56kbjf";
};
buildInputs = lib.optionals stdenv.isLinux [ alsa-lib ];
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.
@ -25,7 +35,7 @@ stdenv.mkDerivation rec {
configureFlags = [
"--enable-shared"
] ++ lib.optionals stdenv.isLinux [ "--with-audio=alsa" ];
] ++ 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