mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-29 18:33:00 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
78 lines
1.9 KiB
Nix
78 lines
1.9 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchFromGitHub,
|
|
fetchpatch,
|
|
alsa-lib,
|
|
libpulseaudio,
|
|
nix-update-script,
|
|
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.hostPlatform.isLinux (
|
|
{
|
|
alsa = alsa-lib;
|
|
pulseaudio = libpulseaudio;
|
|
}
|
|
.${audioBackend} or (throw "${audioBackend} is not a supported backend!")
|
|
);
|
|
|
|
configureFlags = [
|
|
"--enable-shared"
|
|
] ++ lib.optionals stdenv.hostPlatform.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;
|
|
};
|
|
|
|
updateScript = nix-update-script { };
|
|
};
|
|
|
|
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";
|
|
};
|
|
})
|