about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libwebsockets
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libwebsockets')
-rw-r--r--nixpkgs/pkgs/development/libraries/libwebsockets/default.nix56
1 files changed, 56 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libwebsockets/default.nix b/nixpkgs/pkgs/development/libraries/libwebsockets/default.nix
new file mode 100644
index 000000000000..8f749d9fe6aa
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libwebsockets/default.nix
@@ -0,0 +1,56 @@
+{ fetchFromGitHub, lib, stdenv, cmake, openssl, zlib, libuv }:
+
+let
+  generic = { version, sha256 }: stdenv.mkDerivation rec {
+    pname = "libwebsockets";
+    inherit version;
+
+    src = fetchFromGitHub {
+      owner = "warmcat";
+      repo = "libwebsockets";
+      rev = "v${version}";
+      inherit sha256;
+    };
+
+    buildInputs = [ openssl zlib libuv ];
+
+    nativeBuildInputs = [ cmake ];
+
+    cmakeFlags = [
+      "-DLWS_WITH_PLUGINS=ON"
+      "-DLWS_WITH_IPV6=ON"
+      "-DLWS_WITH_SOCKS5=ON"
+    ];
+
+    NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isGNU "-Wno-error=unused-but-set-variable";
+
+    meta = with lib; {
+      description = "Light, portable C library for websockets";
+      longDescription = ''
+        Libwebsockets is a lightweight pure C library built to
+        use minimal CPU and memory resources, and provide fast
+        throughput in both directions.
+      '';
+      homepage = "https://libwebsockets.org/";
+      license = licenses.lgpl21;
+      platforms = platforms.all;
+    };
+  };
+
+in
+rec {
+  libwebsockets_3_1 = generic {
+    sha256 = "1w1wz6snf3cmcpa3f4dci2nz9za2f5rrylxl109id7bcb36xhbdl";
+    version = "3.1.0";
+  };
+
+  libwebsockets_3_2 = generic {
+    version = "3.2.2";
+    sha256 = "0m1kn4p167jv63zvwhsvmdn8azx3q7fkk8qc0fclwyps2scz6dna";
+  };
+
+  libwebsockets_4_0 = generic {
+    version = "4.0.1";
+    sha256 = "1pf7km0w5q7dqlwcwqizdpfqgg10prfq8g2c093f5nghwsfv8mmf";
+  };
+}