about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libdatachannel
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-08-08 16:04:42 +0000
committerAlyssa Ross <hi@alyssa.is>2023-08-13 06:35:37 +0000
commit12aaa58dac35800b5b7d77f81cf2a87c21ee55da (patch)
treebe0add9e5c22a85d20b5d78206aa74f956eb2a1b /nixpkgs/pkgs/development/libraries/libdatachannel
parent45892a5591202f75a1c2f1ca7c62a92c7566e3c5 (diff)
parent5a8e9243812ba528000995b294292d3b5e120947 (diff)
downloadnixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar
nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.gz
nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.bz2
nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.lz
nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.xz
nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.zst
nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.zip
Merge branch 'nixos-unstable' of https://github.com/NixOS/nixpkgs
Conflicts:
	nixpkgs/pkgs/applications/window-managers/sway/default.nix
	nixpkgs/pkgs/build-support/go/module.nix
	nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix
	nixpkgs/pkgs/development/libraries/mesa/default.nix
	nixpkgs/pkgs/servers/dict/dictd-db.nix

Link: https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/issues/391
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libdatachannel')
-rw-r--r--nixpkgs/pkgs/development/libraries/libdatachannel/default.nix80
1 files changed, 80 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libdatachannel/default.nix b/nixpkgs/pkgs/development/libraries/libdatachannel/default.nix
new file mode 100644
index 000000000000..f2c7b1197810
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libdatachannel/default.nix
@@ -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;
+  };
+}