1{ lib
2, stdenv
3, fetchFromGitLab
4, fetchurl
5, darwin
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 ];
32
33 outputs = [ "out" "dev" ];
34
35 nativeBuildInputs = [
36 meson
37 ninja
38 pkg-config
39 ];
40
41 propagatedBuildInputs = [
42 abseil-cpp
43 ];
44
45 buildInputs = lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ ApplicationServices Foundation ]);
46
47 env = lib.optionalAttrs stdenv.isx86_32 {
48 # https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/issues/5
49 NIX_CFLAGS_COMPILE = "-msse2";
50 };
51
52 meta = with lib; {
53 homepage = "https://www.freedesktop.org/software/pulseaudio/webrtc-audio-processing";
54 description = "More Linux packaging friendly copy of the AudioProcessing module from the WebRTC project";
55 license = licenses.bsd3;
56 # https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/blob/master/webrtc/rtc_base/system/arch.h
57 platforms = intersectLists platforms.unix (platforms.arm ++ platforms.aarch64 ++ platforms.mips ++ platforms.power ++ platforms.riscv ++ platforms.x86);
58 # BE platforms are unsupported
59 # https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/issues/31
60 badPlatforms = platforms.bigEndian;
61 };
62}