diff --git a/pkgs/development/libraries/webrtc-audio-processing/0.3.nix b/pkgs/development/libraries/webrtc-audio-processing/0.3.nix new file mode 100644 index 000000000000..1ce3c2d9fa8b --- /dev/null +++ b/pkgs/development/libraries/webrtc-audio-processing/0.3.nix @@ -0,0 +1,26 @@ +{ lib, stdenv, fetchurl, darwin }: + +stdenv.mkDerivation rec { + pname = "webrtc-audio-processing"; + version = "0.3.1"; + + src = fetchurl { + url = "https://freedesktop.org/software/pulseaudio/webrtc-audio-processing/webrtc-audio-processing-${version}.tar.xz"; + sha256 = "1gsx7k77blfy171b6g3m0k0s0072v6jcawhmx1kjs9w5zlwdkzd0"; + }; + + patches = [ ./enable-riscv.patch ]; + + buildInputs = lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ ApplicationServices ]); + + patchPhase = lib.optionalString stdenv.hostPlatform.isMusl '' + substituteInPlace webrtc/base/checks.cc --replace 'defined(__UCLIBC__)' 1 + ''; + + meta = with lib; { + homepage = "http://www.freedesktop.org/software/pulseaudio/webrtc-audio-processing"; + description = "A more Linux packaging friendly copy of the AudioProcessing module from the WebRTC project"; + license = licenses.bsd3; + platforms = platforms.unix; + }; +} diff --git a/pkgs/development/libraries/webrtc-audio-processing/default.nix b/pkgs/development/libraries/webrtc-audio-processing/default.nix index 1ce3c2d9fa8b..7ec54eac80b0 100644 --- a/pkgs/development/libraries/webrtc-audio-processing/default.nix +++ b/pkgs/development/libraries/webrtc-audio-processing/default.nix @@ -1,19 +1,34 @@ -{ lib, stdenv, fetchurl, darwin }: +{ lib, stdenv, fetchurl +, darwin +, abseil-cpp_202111 +, meson +, ninja +}: stdenv.mkDerivation rec { pname = "webrtc-audio-processing"; - version = "0.3.1"; + version = "1.0"; src = fetchurl { - url = "https://freedesktop.org/software/pulseaudio/webrtc-audio-processing/webrtc-audio-processing-${version}.tar.xz"; - sha256 = "1gsx7k77blfy171b6g3m0k0s0072v6jcawhmx1kjs9w5zlwdkzd0"; + url = "https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/archive/v1.0/webrtc-audio-processing-v${version}.tar.gz"; + sha256 = "sha256-dqRy1OfOG9TX2cgCD8cowU44zVanns/nPYZrilPfuiU="; }; - patches = [ ./enable-riscv.patch ]; + nativeBuildInputs = [ + meson + ninja + ]; - buildInputs = lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ ApplicationServices ]); + buildInputs = [ + abseil-cpp_202111 + ] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ ApplicationServices ]); - patchPhase = lib.optionalString stdenv.hostPlatform.isMusl '' + patchPhase = '' + # this is just incorrect upstream + # see https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/issues/4 + substituteInPlace meson.build \ + --replace "absl_flags_registry" "absl_flags_reflection" + '' + lib.optionalString stdenv.hostPlatform.isMusl '' substituteInPlace webrtc/base/checks.cc --replace 'defined(__UCLIBC__)' 1 ''; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4692524da345..5744b803a307 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -20400,7 +20400,10 @@ with pkgs; websocketpp = callPackage ../development/libraries/websocket++ { }; - webrtc-audio-processing = callPackage ../development/libraries/webrtc-audio-processing { }; + webrtc-audio-processing_1 = callPackage ../development/libraries/webrtc-audio-processing { }; + webrtc-audio-processing_0_3 = callPackage ../development/libraries/webrtc-audio-processing/0.3.nix { }; + # bump when majoring of packages have updated + webrtc-audio-processing = webrtc-audio-processing_0_3; wildmidi = callPackage ../development/libraries/wildmidi { };