mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-29 02:13:23 +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" ```
84 lines
1.8 KiB
Nix
84 lines
1.8 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchurl,
|
|
gitUpdater,
|
|
meson,
|
|
python3,
|
|
ninja,
|
|
fixedPoint ? false,
|
|
withCustomModes ? true,
|
|
withIntrinsics ? stdenv.hostPlatform.isAarch || stdenv.hostPlatform.isx86,
|
|
withAsm ? false,
|
|
|
|
# tests
|
|
ffmpeg-headless,
|
|
testers,
|
|
}:
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "libopus";
|
|
version = "1.5.2";
|
|
|
|
src = fetchurl {
|
|
url = "https://downloads.xiph.org/releases/opus/opus-${finalAttrs.version}.tar.gz";
|
|
hash = "sha256-ZcHS94ufL7IAgsOMvkfJUa1YOTRYduRpQWEu6H+afOE=";
|
|
};
|
|
|
|
patches = [
|
|
# Some tests time out easily on slower machines
|
|
./test-timeout.patch
|
|
];
|
|
|
|
postPatch = ''
|
|
patchShebangs meson/
|
|
'';
|
|
|
|
outputs = [
|
|
"out"
|
|
"dev"
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
meson
|
|
python3
|
|
ninja
|
|
];
|
|
|
|
mesonFlags = [
|
|
(lib.mesonBool "fixed-point" fixedPoint)
|
|
(lib.mesonBool "custom-modes" withCustomModes)
|
|
(lib.mesonEnable "intrinsics" withIntrinsics)
|
|
(lib.mesonEnable "rtcd" (withIntrinsics || withAsm))
|
|
(lib.mesonEnable "asm" withAsm)
|
|
(lib.mesonEnable "docs" false)
|
|
];
|
|
|
|
doCheck = !stdenv.hostPlatform.isi686 && !stdenv.hostPlatform.isAarch32; # test_unit_LPC_inv_pred_gain fails
|
|
|
|
passthru = {
|
|
updateScript = gitUpdater {
|
|
url = "https://gitlab.xiph.org/xiph/opus.git";
|
|
rev-prefix = "v";
|
|
};
|
|
|
|
tests = {
|
|
inherit ffmpeg-headless;
|
|
|
|
pkg-config = testers.hasPkgConfigModules {
|
|
package = finalAttrs.finalPackage;
|
|
moduleNames = [ "opus" ];
|
|
};
|
|
};
|
|
};
|
|
|
|
meta = {
|
|
description = "Open, royalty-free, highly versatile audio codec";
|
|
homepage = "https://opus-codec.org/";
|
|
changelog = "https://gitlab.xiph.org/xiph/opus/-/releases/v${finalAttrs.version}";
|
|
license = lib.licenses.bsd3;
|
|
platforms = lib.platforms.all;
|
|
maintainers = with lib.maintainers; [ getchoo jopejoe1 ];
|
|
};
|
|
})
|