8 # External poll is required for e.g. mosquitto, but discouraged by the maintainer.
9 , withExternalPoll ? false
12 stdenv.mkDerivation rec {
13 pname = "libwebsockets";
16 src = fetchFromGitHub {
18 repo = "libwebsockets";
20 hash = "sha256-why8LAcc4XN0JdTJ1JoNWijKENL5mOHBsi9K4wpYr2c=";
23 buildInputs = [ openssl zlib libuv ];
25 nativeBuildInputs = [ cmake ];
28 "-DLWS_WITH_PLUGINS=ON"
30 "-DLWS_WITH_SOCKS5=ON"
32 "-DLWS_BUILD_HASH=no_hash"
33 ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "-DLWS_WITHOUT_TESTAPPS=ON"
34 ++ lib.optional withExternalPoll "-DLWS_WITH_EXTERNAL_POLL=ON";
37 rm -r ${placeholder "out"}/share/libwebsockets-test-server
40 # $out/share/libwebsockets-test-server/plugins/libprotocol_*.so refers to crtbeginS.o
41 disallowedReferences = [ stdenv.cc.cc ];
44 description = "Light, portable C library for websockets";
46 Libwebsockets is a lightweight pure C library built to
47 use minimal CPU and memory resources, and provide fast
48 throughput in both directions.
50 homepage = "https://libwebsockets.org/";
51 # Relicensed from LGPLv2.1+ to MIT with 4.0. Licensing situation
52 # is tricky, see https://github.com/warmcat/libwebsockets/blob/main/LICENSE
53 license = with licenses; [ mit publicDomain bsd3 asl20 ];
54 maintainers = with maintainers; [ mindavi ];
55 platforms = platforms.all;