Merge pull request #237099 from erdnaxe/libdatachannel

This commit is contained in:
Janik 2023-06-27 11:34:43 +02:00 committed by GitHub
commit a327d55960
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 82 additions and 0 deletions

View File

@ -0,0 +1,80 @@
{ stdenv
, lib
, fetchFromGitHub
, srcOnly
, cmake
, ninja
, pkg-config
, libnice
, openssl
, plog
, srtp
, usrsctp
}:
let
# Use usrsctp version specified at https://github.com/paullouisageneau/libdatachannel/tree/master/deps
# Older or newer usrsctp might break libdatachannel, please keep it synced with upstream.
customUsrsctp = usrsctp.overrideAttrs (finalAttrs: previousAttrs: {
version = "unstable-2021-10-08";
src = fetchFromGitHub {
owner = "sctplab";
repo = "usrsctp";
rev = "7c31bd35c79ba67084ce029511193a19ceb97447";
hash = "sha256-KeOR/0WDtG1rjUndwTUOhE21PoS+ETs1Vk7jQYy/vNs=";
};
});
in
stdenv.mkDerivation rec {
pname = "libdatachannel";
version = "0.18.5";
src = fetchFromGitHub {
owner = "paullouisageneau";
repo = pname;
rev = "v${version}";
hash = "sha256-ognjEDw68DpdQ/4JqcTejP5f9K0zLZGnpr99P/dvHK4=";
};
outputs = [ "out" "dev" ];
strictDeps = true;
nativeBuildInputs = [
cmake
ninja
pkg-config
];
buildInputs = [
libnice
openssl
srtp
];
cmakeFlags = [
"-DUSE_NICE=ON"
"-DUSE_SYSTEM_SRTP=ON"
"-DNO_EXAMPLES=ON"
];
postPatch = ''
# TODO: Remove when updating to 0.19.x, and add
# -DUSE_SYSTEM_USRSCTP=ON and -DUSE_SYSTEM_PLOG=ON to cmakeFlags instead
mkdir -p deps/{usrsctp,plog}
cp -r --no-preserve=mode ${srcOnly customUsrsctp}/. deps/usrsctp
cp -r --no-preserve=mode ${srcOnly plog}/. deps/plog
'';
postFixup = ''
# Fix shared library path that will be incorrect on move to "dev" output
substituteInPlace "$dev/lib/cmake/LibDataChannel/LibDataChannelTargets-release.cmake" \
--replace "\''${_IMPORT_PREFIX}/lib" "$out/lib"
'';
meta = with lib; {
description = "C/C++ WebRTC network library featuring Data Channels, Media Transport, and WebSockets";
homepage = "https://libdatachannel.org/";
license = with licenses; [ mpl20 ];
maintainers = with maintainers; [ erdnaxe ];
platforms = platforms.linux;
};
}

View File

@ -27298,6 +27298,8 @@ with pkgs;
libcgroup = callPackage ../os-specific/linux/libcgroup { }; libcgroup = callPackage ../os-specific/linux/libcgroup { };
libdatachannel = callPackage ../development/libraries/libdatachannel { };
libkrun = callPackage ../development/libraries/libkrun { libkrun = callPackage ../development/libraries/libkrun {
inherit (darwin.apple_sdk.frameworks) Hypervisor; inherit (darwin.apple_sdk.frameworks) Hypervisor;
}; };