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