1{
2 lib,
3 stdenv,
4 fetchFromGitLab,
5 fetchpatch,
6 abseil-cpp,
7 meson,
8 ninja,
9 pkg-config,
10 testers,
11}:
12
13stdenv.mkDerivation (finalAttrs: {
14 pname = "webrtc-audio-processing";
15 version = "2.1";
16
17 src = fetchFromGitLab {
18 domain = "gitlab.freedesktop.org";
19 owner = "pulseaudio";
20 repo = "webrtc-audio-processing";
21 tag = "v${finalAttrs.version}";
22 hash = "sha256-YR4ELukJgHMbfe80H+r8OiaZUCAqefGXmVOaTVVgOqA=";
23 };
24
25 patches = [
26 (fetchpatch {
27 name = "gcc-15-compat.patch";
28 url = "https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/commit/e9c78dc4712fa6362b0c839ad57b6b46dce1ba83.diff";
29 hash = "sha256-QXOtya7RA0UTV9VK4qpql5D8QcOKAn6qURZvPpWT+vg=";
30 })
31 ];
32
33 outputs = [
34 "out"
35 "dev"
36 ];
37
38 nativeBuildInputs = [
39 meson
40 ninja
41 pkg-config
42 ];
43
44 propagatedBuildInputs = [
45 abseil-cpp
46 ];
47
48 mesonFlags =
49 lib.lists.optional (!stdenv.hostPlatform.isAarch64) "-Dneon=disabled"
50 ++ lib.lists.optional (stdenv.hostPlatform.isi686) "-Dinline-sse=false";
51
52 passthru.tests.pkg-config = testers.hasPkgConfigModules {
53 package = finalAttrs.finalPackage;
54 versionCheck = true;
55 };
56
57 meta = {
58 homepage = "https://www.freedesktop.org/software/pulseaudio/webrtc-audio-processing";
59 description = "More Linux packaging friendly copy of the AudioProcessing module from the WebRTC project";
60 pkgConfigModules = [ "webrtc-audio-processing-2" ];
61 license = lib.licenses.bsd3;
62 maintainers = with lib.maintainers; [ fzdslr ];
63 platforms =
64 with lib.platforms;
65 lib.intersectLists
66 # https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/blob/master/webrtc/rtc_base/system/arch.h
67 (arm ++ aarch64 ++ mips ++ power ++ riscv ++ x86 ++ loongarch64)
68 # https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/blob/master/meson.build
69 (linux ++ windows ++ freebsd ++ netbsd ++ openbsd ++ darwin);
70 };
71})