1{
2 lib,
3 stdenv,
4 fetchFromGitLab,
5 fetchurl,
6 abseil-cpp,
7 meson,
8 ninja,
9 pkg-config,
10}:
11
12stdenv.mkDerivation rec {
13 pname = "webrtc-audio-processing";
14 version = "1.3";
15
16 src = fetchFromGitLab {
17 domain = "gitlab.freedesktop.org";
18 owner = "pulseaudio";
19 repo = "webrtc-audio-processing";
20 rev = "v${version}";
21 hash = "sha256-8CDt4kMt2Owzyv22dqWIcFuHeg4Y3FxB405cLw3FZ+g=";
22 };
23
24 patches = [
25 # Fix an include oppsie that happens to not happen on glibc
26 # https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/merge_requests/38
27 (fetchurl {
28 url = "https://git.alpinelinux.org/aports/plain/community/webrtc-audio-processing-1/0001-rtc_base-Include-stdint.h-to-fix-build-failures.patch?id=625e19c19972e69e034c0870a31b375833d1ab5d";
29 hash = "sha256-9nI22SJoU0H3CzsPSAObtCFTadtvkzdnqIh6mxmUuds=";
30 })
31 # Add loongarch64 support
32 (fetchurl {
33 url = "https://gitlab.alpinelinux.org/alpine/aports/-/raw/0630fa25465530c0e7358f00016bdc812894f67f/community/webrtc-audio-processing-1/add-loongarch-support.patch";
34 hash = "sha256-Cn3KwKSSV/QJm1JW0pkEWB6OmeA0fRlVkiMU8OzXNzY=";
35 })
36 ];
37
38 outputs = [
39 "out"
40 "dev"
41 ];
42
43 nativeBuildInputs = [
44 meson
45 ninja
46 pkg-config
47 ];
48
49 propagatedBuildInputs = [
50 abseil-cpp
51 ];
52
53 env = lib.optionalAttrs stdenv.hostPlatform.isx86_32 {
54 # https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/issues/5
55 NIX_CFLAGS_COMPILE = "-msse2";
56 };
57
58 meta = with lib; {
59 homepage = "https://www.freedesktop.org/software/pulseaudio/webrtc-audio-processing";
60 description = "More Linux packaging friendly copy of the AudioProcessing module from the WebRTC project";
61 license = licenses.bsd3;
62 platforms =
63 intersectLists
64 # https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/blob/master/meson.build
65 (platforms.darwin ++ platforms.linux ++ platforms.windows)
66 # https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/blob/master/webrtc/rtc_base/system/arch.h
67 (
68 platforms.arm
69 ++ platforms.aarch64
70 ++ platforms.loongarch64
71 ++ platforms.mips
72 ++ platforms.power
73 ++ platforms.riscv
74 ++ platforms.x86
75 );
76 # BE platforms are unsupported
77 # https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/issues/31
78 badPlatforms = platforms.bigEndian;
79 };
80}