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 # https://github.com/orion-labs/opuslib/pull/25
32 (fetchpatch {
33 name = "fix-tests-when-using-libopus-1.4.patch";
34 url = "https://github.com/orion-labs/opuslib/commit/87a214fc98c1dcae38035e99fe8e279a160c4a52.patch";
35 hash = "sha256-UoOafyTFvWLY7ErtBhkXTZSgbMZFrg5DGxjbhqEI7wo=";
36 })
37 (substituteAll {
38 src = ./opuslib-paths.patch;
39 opusLibPath = "${libopus}/lib/libopus${stdenv.hostPlatform.extensions.sharedLibrary}";
40 })
41 ];
42
43 nativeCheckInputs = [ nose ];
44
45 meta = with lib; {
46 description = "Python bindings to the libopus, IETF low-delay audio codec";
47 homepage = "https://github.com/orion-labs/opuslib";
48 license = licenses.bsd3;
49 platforms = platforms.all;
50 maintainers = with maintainers; [ thelegy ];
51 };
52}