2023-07-15 17:15:38 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
2024-04-21 15:54:59 +00:00
|
|
|
, gitUpdater
|
2023-07-15 17:15:38 +00:00
|
|
|
, meson
|
|
|
|
, python3
|
|
|
|
, ninja
|
|
|
|
, fixedPoint ? false
|
|
|
|
, withCustomModes ? true
|
|
|
|
, withIntrinsics ? stdenv.hostPlatform.isAarch || stdenv.hostPlatform.isx86
|
|
|
|
, withAsm ? false
|
|
|
|
|
|
|
|
# tests
|
|
|
|
, ffmpeg-headless
|
2024-04-21 15:54:59 +00:00
|
|
|
, testers
|
2023-07-15 17:15:38 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "libopus";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "1.5.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2024-04-21 15:54:59 +00:00
|
|
|
url = "https://downloads.xiph.org/releases/opus/opus-${finalAttrs.version}.tar.gz";
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-ZcHS94ufL7IAgsOMvkfJUa1YOTRYduRpQWEu6H+afOE=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
patches = [
|
2023-08-04 22:07:22 +00:00
|
|
|
# Some tests time out easily on slower machines
|
|
|
|
./test-timeout.patch
|
2023-07-15 17:15:38 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
patchShebangs meson/
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
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)
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-18 13:19:15 +00:00
|
|
|
doCheck = !stdenv.isi686 && !stdenv.isAarch32; # test_unit_LPC_inv_pred_gain fails
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
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" ];
|
|
|
|
};
|
|
|
|
};
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Open, royalty-free, highly versatile audio codec";
|
2023-07-15 17:15:38 +00:00
|
|
|
homepage = "https://opus-codec.org/";
|
2024-04-21 15:54:59 +00:00
|
|
|
changelog = "https://gitlab.xiph.org/xiph/opus/-/releases/v${finalAttrs.version}";
|
2023-07-15 17:15:38 +00:00
|
|
|
license = licenses.bsd3;
|
2021-05-03 20:48:10 +00:00
|
|
|
platforms = platforms.all;
|
2023-07-15 17:15:38 +00:00
|
|
|
maintainers = [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2024-04-21 15:54:59 +00:00
|
|
|
})
|