From 3082f673187cd99e583d8c0217272724765a9872 Mon Sep 17 00:00:00 2001 From: WeetHet Date: Wed, 25 Dec 2024 19:34:18 +0200 Subject: [PATCH] livekit-libwebrtc: fix builds on darwin --- ...02-disable-narrowing-const-reference.patch | 13 +++++ pkgs/by-name/li/livekit-libwebrtc/package.nix | 52 ++++++++++--------- 2 files changed, 41 insertions(+), 24 deletions(-) create mode 100644 pkgs/by-name/li/livekit-libwebrtc/0002-disable-narrowing-const-reference.patch diff --git a/pkgs/by-name/li/livekit-libwebrtc/0002-disable-narrowing-const-reference.patch b/pkgs/by-name/li/livekit-libwebrtc/0002-disable-narrowing-const-reference.patch new file mode 100644 index 0000000000000..fc7c615cdaca5 --- /dev/null +++ b/pkgs/by-name/li/livekit-libwebrtc/0002-disable-narrowing-const-reference.patch @@ -0,0 +1,13 @@ +diff --git a/BUILD.gn b/BUILD.gn +index 598bbbcb72..62c6c5a187 100644 +--- a/BUILD.gn ++++ b/BUILD.gn +@@ -138,7 +138,7 @@ config("library_impl_config") { + # target_defaults and direct_dependent_settings. + config("common_inherited_config") { + defines = [] +- cflags = [ "-fvisibility=default" ] ++ cflags = [ "-fvisibility=default", "-Wno-error=c++11-narrowing-const-reference" ] + ldflags = [ "-lavutil", "-lavformat", "-lavcodec" ] + + if (rtc_dlog_always_on) { diff --git a/pkgs/by-name/li/livekit-libwebrtc/package.nix b/pkgs/by-name/li/livekit-libwebrtc/package.nix index 20589f68b8799..69bf213bc4535 100644 --- a/pkgs/by-name/li/livekit-libwebrtc/package.nix +++ b/pkgs/by-name/li/livekit-libwebrtc/package.nix @@ -78,30 +78,34 @@ stdenv.mkDerivation { src = "${sources}/src"; - patches = [ - # Adds missing dependencies to generated LICENSE - (fetchpatch { - url = "https://raw.githubusercontent.com/livekit/rust-sdks/b41861c7b71762d5d85b3de07ae67ffcae7c3fa2/webrtc-sys/libwebrtc/patches/add_licenses.patch"; - hash = "sha256-9A4KyRW1K3eoQxsTbPX0vOnj66TCs2Fxjpsu5wO8mGI="; - }) - # Fixes the certificate chain, required for Let's Encrypt certs - (fetchpatch { - url = "https://raw.githubusercontent.com/livekit/rust-sdks/b41861c7b71762d5d85b3de07ae67ffcae7c3fa2/webrtc-sys/libwebrtc/patches/ssl_verify_callback_with_native_handle.patch"; - hash = "sha256-/gneuCac4VGJCWCjJZlgLKFOTV+x7Lc5KVFnNIKenwM="; - }) - # Adds dependencies and features required by livekit - (fetchpatch { - url = "https://raw.githubusercontent.com/livekit/rust-sdks/b41861c7b71762d5d85b3de07ae67ffcae7c3fa2/webrtc-sys/libwebrtc/patches/add_deps.patch"; - hash = "sha256-EMNYcTcBYh51Tt96+HP43ND11qGKClfx3xIPQmIBSo0="; - }) - # Fixes concurrency and localization issues - (fetchpatch { - url = "https://github.com/zed-industries/webrtc/commit/08f7a701a2eda6407670508fc2154257a3c90308.patch"; - hash = "sha256-oWYZLwqjRSHDt92MqsxsoBSMyZKj1ubNbOXZRbPpbEw="; - }) - # Required for dynamically linking to ffmpeg libraries and exposing symbols - ./0001-shared-libraries.patch - ]; + patches = + [ + # Adds missing dependencies to generated LICENSE + (fetchpatch { + url = "https://raw.githubusercontent.com/livekit/rust-sdks/b41861c7b71762d5d85b3de07ae67ffcae7c3fa2/webrtc-sys/libwebrtc/patches/add_licenses.patch"; + hash = "sha256-9A4KyRW1K3eoQxsTbPX0vOnj66TCs2Fxjpsu5wO8mGI="; + }) + # Fixes the certificate chain, required for Let's Encrypt certs + (fetchpatch { + url = "https://raw.githubusercontent.com/livekit/rust-sdks/b41861c7b71762d5d85b3de07ae67ffcae7c3fa2/webrtc-sys/libwebrtc/patches/ssl_verify_callback_with_native_handle.patch"; + hash = "sha256-/gneuCac4VGJCWCjJZlgLKFOTV+x7Lc5KVFnNIKenwM="; + }) + # Adds dependencies and features required by livekit + (fetchpatch { + url = "https://raw.githubusercontent.com/livekit/rust-sdks/b41861c7b71762d5d85b3de07ae67ffcae7c3fa2/webrtc-sys/libwebrtc/patches/add_deps.patch"; + hash = "sha256-EMNYcTcBYh51Tt96+HP43ND11qGKClfx3xIPQmIBSo0="; + }) + # Fixes concurrency and localization issues + (fetchpatch { + url = "https://github.com/zed-industries/webrtc/commit/08f7a701a2eda6407670508fc2154257a3c90308.patch"; + hash = "sha256-oWYZLwqjRSHDt92MqsxsoBSMyZKj1ubNbOXZRbPpbEw="; + }) + # Required for dynamically linking to ffmpeg libraries and exposing symbols + ./0001-shared-libraries.patch + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + ./0002-disable-narrowing-const-reference.patch + ]; postPatch = ''