depot/third_party/nixpkgs/pkgs/development/libraries/libopus/default.nix
Default email 587713944a Project import generated by Copybara.
GitOrigin-RevId: 6143fc5eeb9c4f00163267708e26191d1e918932
2024-04-21 17:54:59 +02:00

81 lines
1.8 KiB
Nix

{ lib
, stdenv
, fetchpatch
, 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.1";
src = fetchurl {
url = "https://downloads.xiph.org/releases/opus/opus-${finalAttrs.version}.tar.gz";
hash = "sha256-uEYQlZuNQXthGqEqIlZeCjcyCXxjidGQmNhEVD40D4U=";
};
patches = [
./fix-pkg-config-paths.patch
# 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.isi686 && !stdenv.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 = with lib; {
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 = licenses.bsd3;
platforms = platforms.all;
maintainers = [ ];
};
})