btrbk: add mainProgram (#356350)
[NixPkgs.git] / pkgs / by-name / li / libopus / package.nix
blobf809c40000e95788d145adc0d1cee86339149e0b
2   lib,
3   stdenv,
4   fetchurl,
5   gitUpdater,
6   meson,
7   python3,
8   ninja,
9   fixedPoint ? false,
10   withCustomModes ? true,
11   withIntrinsics ? stdenv.hostPlatform.isAarch || stdenv.hostPlatform.isx86,
12   withAsm ? false,
14   # tests
15   ffmpeg-headless,
16   testers,
19 stdenv.mkDerivation (finalAttrs: {
20   pname = "libopus";
21   version = "1.5.2";
23   src = fetchurl {
24     url = "https://downloads.xiph.org/releases/opus/opus-${finalAttrs.version}.tar.gz";
25     hash = "sha256-ZcHS94ufL7IAgsOMvkfJUa1YOTRYduRpQWEu6H+afOE=";
26   };
28   patches = [
29     # Some tests time out easily on slower machines
30     ./test-timeout.patch
31   ];
33   postPatch = ''
34     patchShebangs meson/
35   '';
37   outputs = [
38     "out"
39     "dev"
40   ];
42   nativeBuildInputs = [
43     meson
44     python3
45     ninja
46   ];
48   mesonFlags = [
49     (lib.mesonBool "fixed-point" fixedPoint)
50     (lib.mesonBool "custom-modes" withCustomModes)
51     (lib.mesonEnable "intrinsics" withIntrinsics)
52     (lib.mesonEnable "rtcd" (withIntrinsics || withAsm))
53     (lib.mesonEnable "asm" withAsm)
54     (lib.mesonEnable "docs" false)
55   ];
57   doCheck = !stdenv.hostPlatform.isi686 && !stdenv.hostPlatform.isAarch32; # test_unit_LPC_inv_pred_gain fails
59   passthru = {
60     updateScript = gitUpdater {
61       url = "https://gitlab.xiph.org/xiph/opus.git";
62       rev-prefix = "v";
63     };
65     tests = {
66       inherit ffmpeg-headless;
68       pkg-config = testers.hasPkgConfigModules {
69         package = finalAttrs.finalPackage;
70         moduleNames = [ "opus" ];
71       };
72     };
73   };
75   meta = {
76     description = "Open, royalty-free, highly versatile audio codec";
77     homepage = "https://opus-codec.org/";
78     changelog = "https://gitlab.xiph.org/xiph/opus/-/releases/v${finalAttrs.version}";
79     license = lib.licenses.bsd3;
80     platforms = lib.platforms.all;
81     maintainers = with lib.maintainers; [ getchoo jopejoe1 ];
82   };