1{ buildPythonPackage,
2 fetchFromGitHub,
3 fetchpatch,
4 isPy27,
5 libopus,
6 nose,
7 lib, stdenv,
8 substituteAll,
9}:
10
11buildPythonPackage rec {
12 pname = "opuslib";
13 version = "3.0.3";
14
15 disabled = isPy27;
16
17 src = fetchFromGitHub {
18 owner = "orion-labs";
19 repo = pname;
20 rev = "92109c528f9f6c550df5e5325ca0fcd4f86b0909";
21 hash = "sha256-NxmC/4TTIEDVzrfMPN4PcT1JY4QCw8IBMy80XiM/o00=";
22 };
23
24 patches = [
25 # https://github.com/orion-labs/opuslib/pull/22
26 (fetchpatch {
27 name = "fix-variadic-functions-on-aarch64-darwin.patch";
28 url = "https://github.com/orion-labs/opuslib/commit/8aee916e4da4b3183d49cff5a986dc2408076d8d.patch";
29 hash = "sha256-oa1HCFHNS3ejzSf0jxv9NueUKOZgdCtpv+xTrjYW5os=";
30 })
31 (substituteAll {
32 src = ./opuslib-paths.patch;
33 opusLibPath = "${libopus}/lib/libopus${stdenv.hostPlatform.extensions.sharedLibrary}";
34 })
35 ];
36
37 nativeCheckInputs = [ nose ];
38
39 meta = with lib; {
40 description = "Python bindings to the libopus, IETF low-delay audio codec";
41 homepage = "https://github.com/orion-labs/opuslib";
42 license = licenses.bsd3;
43 platforms = platforms.all;
44 maintainers = with maintainers; [ thelegy ];
45 };
46}