Loading maintainers/maintainer-list.nix +6 −0 Original line number Diff line number Diff line Loading @@ -24072,6 +24072,12 @@ githubId = 49368953; keys = [ { fingerprint = "D20F C904 A145 8B28 53D8 FBA0 0422 0096 01E4 87FC"; } ]; }; WeetHet = { name = "WeetHet"; matrix = "@weethet:catgirl.cloud"; github = "WeetHet"; githubId = 43210583; }; wegank = { name = "Weijia Wang"; email = "contact@weijia.wang"; pkgs/by-name/li/livekit-libwebrtc/0001-shared-libraries.patch 0 → 100644 +15 −0 Original line number Diff line number Diff line diff --git a/BUILD.gn b/BUILD.gn index d5289b8..598bbbc 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -138,8 +138,8 @@ config("library_impl_config") { # target_defaults and direct_dependent_settings. config("common_inherited_config") { defines = [] - cflags = [] - ldflags = [] + cflags = [ "-fvisibility=default" ] + ldflags = [ "-lavutil", "-lavformat", "-lavcodec" ] if (rtc_dlog_always_on) { defines += [ "DLOG_ALWAYS_ON" ] pkgs/by-name/li/livekit-libwebrtc/gclient2nix.nix 0 → 100644 +61 −0 Original line number Diff line number Diff line { lib, buildPythonPackage, fetchFromGitHub, flit-core, click, nurl, nix-prefetch-git, nix, coreutils, nixfmt-rfc-style, makeWrapper, }: # Based on https://github.com/milahu/gclient2nix # but with libwebrtc-specific changes. let nativeDeps = [ nurl nix-prefetch-git nix coreutils nixfmt-rfc-style ]; in buildPythonPackage { pname = "gclient2nix"; version = "0.2.0-unstable-2024-12-19"; pyproject = true; src = fetchFromGitHub { owner = "WeetHet"; repo = "gclient2nix"; rev = "bdf5ab79818595be9dcfc655bd6784cf4bcdb863"; hash = "sha256-KOXG8E2g30XyZGmM4ZnYPBSybBhHIjOZL8ZXRKYrkZQ="; }; build-system = [ flit-core ]; dependencies = [ click ]; nativeBuildInputs = [ makeWrapper ]; postFixup = '' wrapProgram $out/bin/gclient2nix \ --set PATH ${lib.makeBinPath nativeDeps} ''; meta = { description = "Generate Nix expressions for projects based on the Google build tools"; homepage = "https://github.com/WeetHet/gclient2nix"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ WeetHet ]; mainProgram = "gclient2nix"; }; } pkgs/by-name/li/livekit-libwebrtc/mkSystemLibraries.nix 0 → 100644 +64 −0 Original line number Diff line number Diff line { brotli, fontconfig, freetype, harfbuzz, icu, jsoncpp, libpng, libwebp, libxml2, libxslt, minizip, ffmpeg_6, }: { "brotli" = { package = brotli; path = "third_party/brotli/BUILD.gn"; }; "fontconfig" = { package = fontconfig; path = "third_party/fontconfig/BUILD.gn"; }; "freetype" = { package = freetype; path = "build/config/freetype/freetype.gni"; }; "harfbuzz-ng" = { package = harfbuzz; path = "third_party/harfbuzz-ng/harfbuzz.gni"; }; "jsoncpp" = { package = jsoncpp; path = "third_party/jsoncpp/BUILD.gn"; }; "icu" = { package = icu; path = "third_party/icu/BUILD.gn"; }; "libpng" = { package = libpng; path = "third_party/libpng/BUILD.gn"; }; "libwebp" = { package = libwebp; path = "third_party/libwebp/BUILD.gn"; }; "libxml" = { package = libxml2; path = "third_party/libxml/BUILD.gn"; }; "libxslt" = { package = libxslt; path = "third_party/libxslt/BUILD.gn"; }; "zlib" = { package = minizip; path = "third_party/zlib/BUILD.gn"; }; "ffmpeg" = { package = ffmpeg_6; path = "third_party/ffmpeg/BUILD.gn"; }; } pkgs/by-name/li/livekit-libwebrtc/package.nix 0 → 100644 +298 −0 Original line number Diff line number Diff line { stdenv, clang, callPackage, lib, gn, fetchurl, fetchpatch, xcbuild, python3, ninja, apple-sdk_14, darwinMinVersionHook, git, cpio, pkg-config, glib, alsa-lib, pulseaudio, nasm, brotli, fontconfig, freetype, harfbuzz, icu, jsoncpp, libpng, libwebp, libxml2, libxslt, minizip, ffmpeg_6, writeShellScript, }: let sources = callPackage ./sources.nix { }; platformMap = { "x86_64" = "x64"; "i686" = "x86"; "arm" = "arm"; "aarch64" = "arm64"; }; cpuName = stdenv.hostPlatform.parsed.cpu.name; gnArch = platformMap."${cpuName}" or (throw "unsupported arch ${cpuName}"); gnOs = if stdenv.hostPlatform.isLinux then "linux" else if stdenv.hostPlatform.isDarwin then "mac" else throw "unknown platform ${stdenv.hostPlatform.config}"; boringSslSymbols = fetchurl { url = "https://raw.githubusercontent.com/livekit/rust-sdks/refs/tags/webrtc-dac8015-6/webrtc-sys/libwebrtc/boringssl_prefix_symbols.txt"; hash = "sha256-dAweArv8zjsFPENEKi9mNBQkt4y+hh3rCqG6QZjRC20="; }; gnSystemLibraries = import ./mkSystemLibraries.nix { inherit brotli fontconfig freetype harfbuzz icu jsoncpp libpng libwebp libxml2 libxslt minizip ffmpeg_6 ; }; gclient2nix = python3.pkgs.callPackage ./gclient2nix.nix { }; in stdenv.mkDerivation { pname = "livekit-libwebrtc"; version = "m114"; 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 ]; postPatch = '' substituteInPlace tools/generate_shim_headers/generate_shim_headers.py \ --replace-fail "OFFICIAL_BUILD" "GOOGLE_CHROME_BUILD" substituteInPlace BUILD.gn \ --replace-fail "rtc_static_library" "rtc_shared_library" \ --replace-fail "complete_static_lib = true" "" substituteInPlace webrtc.gni \ --replace-fail "!build_with_chromium && is_component_build" "false" substituteInPlace rtc_tools/BUILD.gn \ --replace-fail "\":frame_analyzer\"," "" for lib in ${toString (builtins.attrNames gnSystemLibraries)}; do if [ -d "third_party/$lib" ]; then find "third_party/$lib" -type f \ \! -path "third_party/$lib/chromium/*" \ \! -path "third_party/$lib/google/*" \ \! -path "third_party/harfbuzz-ng/utils/hb_scoped.h" \ \! -regex '.*\.\(gn\|gni\|isolate\)' \ \! -name 'LICENSE*' \ \! -name 'COPYING*' \ -delete fi done '' + lib.optionalString stdenv.hostPlatform.isLinux '' ln -sf ${lib.getExe gn} buildtools/linux64/gn substituteInPlace build/toolchain/linux/BUILD.gn \ --replace 'toolprefix = "aarch64-linux-gnu-"' 'toolprefix = ""' '' + lib.optionalString stdenv.hostPlatform.isDarwin '' ln -sf ${lib.getExe gn} buildtools/mac/gn chmod +x build/toolchain/apple/linker_driver.py patchShebangs build/toolchain/apple/linker_driver.py substituteInPlace build/toolchain/apple/toolchain.gni --replace-fail "/bin/cp -Rc" "cp -a" ''; nativeBuildInputs = (builtins.concatLists ( lib.mapAttrsToList ( _: library: if (library.package ? dev) then [ library.package.dev ] else [ ] ) gnSystemLibraries )) ++ [ gn (python3.withPackages (ps: [ ps.setuptools ])) ninja git cpio pkg-config ] ++ lib.optionals stdenv.isDarwin [ xcbuild ]; buildInputs = [ nasm ] ++ (lib.mapAttrsToList (_: library: library.package) gnSystemLibraries) ++ (lib.optionals stdenv.hostPlatform.isLinux [ glib alsa-lib pulseaudio ]) ++ lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_14 (darwinMinVersionHook "12.3") ]; preConfigure = '' echo "generate_location_tags = true" >> build/config/gclient_args.gni echo "0" > build/util/LASTCHANGE.committime python build/linux/unbundle/replace_gn_files.py \ --system-libraries ${toString (builtins.attrNames gnSystemLibraries)} ''; gnFlags = [ "is_debug=false" "rtc_include_tests=false" ''target_os="${gnOs}"'' ''target_cpu="${gnArch}"'' "treat_warnings_as_errors=false" "rtc_enable_protobuf=false" "rtc_include_tests=false" "rtc_build_examples=false" "rtc_build_tools=false" "rtc_libvpx_build_vp9=true" "enable_libaom=true" "use_dummy_lastchange=true" "is_component_build=true" "enable_stripping=true" "rtc_use_h264=true" "use_custom_libcxx=false" "use_rtti=true" ] ++ (lib.optionals stdenv.hostPlatform.isLinux [ "use_goma=false" "rtc_use_pipewire=false" "symbol_level=0" "enable_iterator_debugging=false" "rtc_use_x11=false" "use_sysroot=false" "is_clang=false" ]) ++ (lib.optionals stdenv.hostPlatform.isDarwin [ ''mac_deployment_target="12.3"'' "rtc_enable_symbol_export=true" "rtc_enable_objc_symbol_export=true" "rtc_include_dav1d_in_internal_decoder_factory=true" "clang_use_chrome_plugins=false" "use_lld=false" ''clang_base_path="${clang}"'' ]); ninjaFlags = [ ":default" ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ "api/audio_codecs:builtin_audio_decoder_factory" "api/task_queue:default_task_queue_factory" "sdk:native_api" "sdk:default_codec_factory_objc" "pc:peerconnection" "sdk:videocapture_objc" "sdk:mac_framework_objc" ]; postBuild = lib.optionalString stdenv.hostPlatform.isLinux '' objcopy --redefine-syms="${boringSslSymbols}" "libwebrtc.so" '' + '' # Generate licenses python3 "../../tools_webrtc/libs/generate_licenses.py" \ --target ${if stdenv.hostPlatform.isDarwin then ":webrtc" else ":default"} $PWD $PWD ''; installPhase = '' runHook preInstall mkdir -p $out/{lib,include} cp obj/webrtc.ninja $out/ cp args.gn $out/ cp LICENSE.md $out/ '' + lib.optionalString stdenv.hostPlatform.isLinux '' cp libwebrtc.so $out/lib/ cp libthird_party_boringssl.so $out/lib/ '' + lib.optionalString stdenv.hostPlatform.isDarwin '' mkdir -p $out/Library/Frameworks cp -r WebRTC.framework $out/Library/Frameworks cp libwebrtc.dylib $out/lib cp libthird_party_boringssl.dylib $out/lib/ '' + '' cd ../.. find . -name "*.h" -print | cpio -pd $out/include runHook postInstall ''; postFixup = lib.optionalString stdenv.hostPlatform.isDarwin '' boringssl="$out/lib/libthird_party_boringssl.dylib" webrtc="$out/lib/libwebrtc.dylib" framework="$out/Library/Frameworks/WebRTC.framework/Versions/A/WebRTC" install_name_tool -id "$boringssl" "$boringssl" install_name_tool -id "$webrtc" "$webrtc" install_name_tool -change @rpath/libthird_party_boringssl.dylib "$boringssl" "$webrtc" install_name_tool -id "$framework" "$framework" install_name_tool -change @rpath/libthird_party_boringssl.dylib "$boringssl" "$framework" ''; passthru.updateScript = writeShellScript "update-livekit-libwebrtc" '' set -eou pipefail cd pkgs/by-name/li/livekit-libwebrtc ${lib.getExe gclient2nix} --main-source-path src https://github.com/webrtc-sdk/webrtc.git m114_release ''; meta = { description = "WebRTC library used by livekit"; homepage = "https://github.com/livekit/rust-sdks/"; license = lib.licenses.bsd3; maintainers = with lib.maintainers; [ WeetHet niklaskorz ]; platforms = lib.platforms.linux ++ lib.platforms.darwin; }; } Loading
maintainers/maintainer-list.nix +6 −0 Original line number Diff line number Diff line Loading @@ -24072,6 +24072,12 @@ githubId = 49368953; keys = [ { fingerprint = "D20F C904 A145 8B28 53D8 FBA0 0422 0096 01E4 87FC"; } ]; }; WeetHet = { name = "WeetHet"; matrix = "@weethet:catgirl.cloud"; github = "WeetHet"; githubId = 43210583; }; wegank = { name = "Weijia Wang"; email = "contact@weijia.wang";
pkgs/by-name/li/livekit-libwebrtc/0001-shared-libraries.patch 0 → 100644 +15 −0 Original line number Diff line number Diff line diff --git a/BUILD.gn b/BUILD.gn index d5289b8..598bbbc 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -138,8 +138,8 @@ config("library_impl_config") { # target_defaults and direct_dependent_settings. config("common_inherited_config") { defines = [] - cflags = [] - ldflags = [] + cflags = [ "-fvisibility=default" ] + ldflags = [ "-lavutil", "-lavformat", "-lavcodec" ] if (rtc_dlog_always_on) { defines += [ "DLOG_ALWAYS_ON" ]
pkgs/by-name/li/livekit-libwebrtc/gclient2nix.nix 0 → 100644 +61 −0 Original line number Diff line number Diff line { lib, buildPythonPackage, fetchFromGitHub, flit-core, click, nurl, nix-prefetch-git, nix, coreutils, nixfmt-rfc-style, makeWrapper, }: # Based on https://github.com/milahu/gclient2nix # but with libwebrtc-specific changes. let nativeDeps = [ nurl nix-prefetch-git nix coreutils nixfmt-rfc-style ]; in buildPythonPackage { pname = "gclient2nix"; version = "0.2.0-unstable-2024-12-19"; pyproject = true; src = fetchFromGitHub { owner = "WeetHet"; repo = "gclient2nix"; rev = "bdf5ab79818595be9dcfc655bd6784cf4bcdb863"; hash = "sha256-KOXG8E2g30XyZGmM4ZnYPBSybBhHIjOZL8ZXRKYrkZQ="; }; build-system = [ flit-core ]; dependencies = [ click ]; nativeBuildInputs = [ makeWrapper ]; postFixup = '' wrapProgram $out/bin/gclient2nix \ --set PATH ${lib.makeBinPath nativeDeps} ''; meta = { description = "Generate Nix expressions for projects based on the Google build tools"; homepage = "https://github.com/WeetHet/gclient2nix"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ WeetHet ]; mainProgram = "gclient2nix"; }; }
pkgs/by-name/li/livekit-libwebrtc/mkSystemLibraries.nix 0 → 100644 +64 −0 Original line number Diff line number Diff line { brotli, fontconfig, freetype, harfbuzz, icu, jsoncpp, libpng, libwebp, libxml2, libxslt, minizip, ffmpeg_6, }: { "brotli" = { package = brotli; path = "third_party/brotli/BUILD.gn"; }; "fontconfig" = { package = fontconfig; path = "third_party/fontconfig/BUILD.gn"; }; "freetype" = { package = freetype; path = "build/config/freetype/freetype.gni"; }; "harfbuzz-ng" = { package = harfbuzz; path = "third_party/harfbuzz-ng/harfbuzz.gni"; }; "jsoncpp" = { package = jsoncpp; path = "third_party/jsoncpp/BUILD.gn"; }; "icu" = { package = icu; path = "third_party/icu/BUILD.gn"; }; "libpng" = { package = libpng; path = "third_party/libpng/BUILD.gn"; }; "libwebp" = { package = libwebp; path = "third_party/libwebp/BUILD.gn"; }; "libxml" = { package = libxml2; path = "third_party/libxml/BUILD.gn"; }; "libxslt" = { package = libxslt; path = "third_party/libxslt/BUILD.gn"; }; "zlib" = { package = minizip; path = "third_party/zlib/BUILD.gn"; }; "ffmpeg" = { package = ffmpeg_6; path = "third_party/ffmpeg/BUILD.gn"; }; }
pkgs/by-name/li/livekit-libwebrtc/package.nix 0 → 100644 +298 −0 Original line number Diff line number Diff line { stdenv, clang, callPackage, lib, gn, fetchurl, fetchpatch, xcbuild, python3, ninja, apple-sdk_14, darwinMinVersionHook, git, cpio, pkg-config, glib, alsa-lib, pulseaudio, nasm, brotli, fontconfig, freetype, harfbuzz, icu, jsoncpp, libpng, libwebp, libxml2, libxslt, minizip, ffmpeg_6, writeShellScript, }: let sources = callPackage ./sources.nix { }; platformMap = { "x86_64" = "x64"; "i686" = "x86"; "arm" = "arm"; "aarch64" = "arm64"; }; cpuName = stdenv.hostPlatform.parsed.cpu.name; gnArch = platformMap."${cpuName}" or (throw "unsupported arch ${cpuName}"); gnOs = if stdenv.hostPlatform.isLinux then "linux" else if stdenv.hostPlatform.isDarwin then "mac" else throw "unknown platform ${stdenv.hostPlatform.config}"; boringSslSymbols = fetchurl { url = "https://raw.githubusercontent.com/livekit/rust-sdks/refs/tags/webrtc-dac8015-6/webrtc-sys/libwebrtc/boringssl_prefix_symbols.txt"; hash = "sha256-dAweArv8zjsFPENEKi9mNBQkt4y+hh3rCqG6QZjRC20="; }; gnSystemLibraries = import ./mkSystemLibraries.nix { inherit brotli fontconfig freetype harfbuzz icu jsoncpp libpng libwebp libxml2 libxslt minizip ffmpeg_6 ; }; gclient2nix = python3.pkgs.callPackage ./gclient2nix.nix { }; in stdenv.mkDerivation { pname = "livekit-libwebrtc"; version = "m114"; 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 ]; postPatch = '' substituteInPlace tools/generate_shim_headers/generate_shim_headers.py \ --replace-fail "OFFICIAL_BUILD" "GOOGLE_CHROME_BUILD" substituteInPlace BUILD.gn \ --replace-fail "rtc_static_library" "rtc_shared_library" \ --replace-fail "complete_static_lib = true" "" substituteInPlace webrtc.gni \ --replace-fail "!build_with_chromium && is_component_build" "false" substituteInPlace rtc_tools/BUILD.gn \ --replace-fail "\":frame_analyzer\"," "" for lib in ${toString (builtins.attrNames gnSystemLibraries)}; do if [ -d "third_party/$lib" ]; then find "third_party/$lib" -type f \ \! -path "third_party/$lib/chromium/*" \ \! -path "third_party/$lib/google/*" \ \! -path "third_party/harfbuzz-ng/utils/hb_scoped.h" \ \! -regex '.*\.\(gn\|gni\|isolate\)' \ \! -name 'LICENSE*' \ \! -name 'COPYING*' \ -delete fi done '' + lib.optionalString stdenv.hostPlatform.isLinux '' ln -sf ${lib.getExe gn} buildtools/linux64/gn substituteInPlace build/toolchain/linux/BUILD.gn \ --replace 'toolprefix = "aarch64-linux-gnu-"' 'toolprefix = ""' '' + lib.optionalString stdenv.hostPlatform.isDarwin '' ln -sf ${lib.getExe gn} buildtools/mac/gn chmod +x build/toolchain/apple/linker_driver.py patchShebangs build/toolchain/apple/linker_driver.py substituteInPlace build/toolchain/apple/toolchain.gni --replace-fail "/bin/cp -Rc" "cp -a" ''; nativeBuildInputs = (builtins.concatLists ( lib.mapAttrsToList ( _: library: if (library.package ? dev) then [ library.package.dev ] else [ ] ) gnSystemLibraries )) ++ [ gn (python3.withPackages (ps: [ ps.setuptools ])) ninja git cpio pkg-config ] ++ lib.optionals stdenv.isDarwin [ xcbuild ]; buildInputs = [ nasm ] ++ (lib.mapAttrsToList (_: library: library.package) gnSystemLibraries) ++ (lib.optionals stdenv.hostPlatform.isLinux [ glib alsa-lib pulseaudio ]) ++ lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_14 (darwinMinVersionHook "12.3") ]; preConfigure = '' echo "generate_location_tags = true" >> build/config/gclient_args.gni echo "0" > build/util/LASTCHANGE.committime python build/linux/unbundle/replace_gn_files.py \ --system-libraries ${toString (builtins.attrNames gnSystemLibraries)} ''; gnFlags = [ "is_debug=false" "rtc_include_tests=false" ''target_os="${gnOs}"'' ''target_cpu="${gnArch}"'' "treat_warnings_as_errors=false" "rtc_enable_protobuf=false" "rtc_include_tests=false" "rtc_build_examples=false" "rtc_build_tools=false" "rtc_libvpx_build_vp9=true" "enable_libaom=true" "use_dummy_lastchange=true" "is_component_build=true" "enable_stripping=true" "rtc_use_h264=true" "use_custom_libcxx=false" "use_rtti=true" ] ++ (lib.optionals stdenv.hostPlatform.isLinux [ "use_goma=false" "rtc_use_pipewire=false" "symbol_level=0" "enable_iterator_debugging=false" "rtc_use_x11=false" "use_sysroot=false" "is_clang=false" ]) ++ (lib.optionals stdenv.hostPlatform.isDarwin [ ''mac_deployment_target="12.3"'' "rtc_enable_symbol_export=true" "rtc_enable_objc_symbol_export=true" "rtc_include_dav1d_in_internal_decoder_factory=true" "clang_use_chrome_plugins=false" "use_lld=false" ''clang_base_path="${clang}"'' ]); ninjaFlags = [ ":default" ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ "api/audio_codecs:builtin_audio_decoder_factory" "api/task_queue:default_task_queue_factory" "sdk:native_api" "sdk:default_codec_factory_objc" "pc:peerconnection" "sdk:videocapture_objc" "sdk:mac_framework_objc" ]; postBuild = lib.optionalString stdenv.hostPlatform.isLinux '' objcopy --redefine-syms="${boringSslSymbols}" "libwebrtc.so" '' + '' # Generate licenses python3 "../../tools_webrtc/libs/generate_licenses.py" \ --target ${if stdenv.hostPlatform.isDarwin then ":webrtc" else ":default"} $PWD $PWD ''; installPhase = '' runHook preInstall mkdir -p $out/{lib,include} cp obj/webrtc.ninja $out/ cp args.gn $out/ cp LICENSE.md $out/ '' + lib.optionalString stdenv.hostPlatform.isLinux '' cp libwebrtc.so $out/lib/ cp libthird_party_boringssl.so $out/lib/ '' + lib.optionalString stdenv.hostPlatform.isDarwin '' mkdir -p $out/Library/Frameworks cp -r WebRTC.framework $out/Library/Frameworks cp libwebrtc.dylib $out/lib cp libthird_party_boringssl.dylib $out/lib/ '' + '' cd ../.. find . -name "*.h" -print | cpio -pd $out/include runHook postInstall ''; postFixup = lib.optionalString stdenv.hostPlatform.isDarwin '' boringssl="$out/lib/libthird_party_boringssl.dylib" webrtc="$out/lib/libwebrtc.dylib" framework="$out/Library/Frameworks/WebRTC.framework/Versions/A/WebRTC" install_name_tool -id "$boringssl" "$boringssl" install_name_tool -id "$webrtc" "$webrtc" install_name_tool -change @rpath/libthird_party_boringssl.dylib "$boringssl" "$webrtc" install_name_tool -id "$framework" "$framework" install_name_tool -change @rpath/libthird_party_boringssl.dylib "$boringssl" "$framework" ''; passthru.updateScript = writeShellScript "update-livekit-libwebrtc" '' set -eou pipefail cd pkgs/by-name/li/livekit-libwebrtc ${lib.getExe gclient2nix} --main-source-path src https://github.com/webrtc-sdk/webrtc.git m114_release ''; meta = { description = "WebRTC library used by livekit"; homepage = "https://github.com/livekit/rust-sdks/"; license = lib.licenses.bsd3; maintainers = with lib.maintainers; [ WeetHet niklaskorz ]; platforms = lib.platforms.linux ++ lib.platforms.darwin; }; }