lol
at 23.05-pre 58 lines 1.7 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4, cmake 5, openssl 6, zlib 7, libuv 8 # External poll is required for e.g. mosquitto, but discouraged by the maintainer. 9, withExternalPoll ? false 10}: 11 12stdenv.mkDerivation rec { 13 pname = "libwebsockets"; 14 version = "4.3.2"; 15 16 src = fetchFromGitHub { 17 owner = "warmcat"; 18 repo = "libwebsockets"; 19 rev = "v${version}"; 20 hash = "sha256-why8LAcc4XN0JdTJ1JoNWijKENL5mOHBsi9K4wpYr2c="; 21 }; 22 23 buildInputs = [ openssl zlib libuv ]; 24 25 nativeBuildInputs = [ cmake ]; 26 27 cmakeFlags = [ 28 "-DLWS_WITH_PLUGINS=ON" 29 "-DLWS_WITH_IPV6=ON" 30 "-DLWS_WITH_SOCKS5=ON" 31 "-DDISABLE_WERROR=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"; 35 36 postInstall = '' 37 rm -r ${placeholder "out"}/share/libwebsockets-test-server 38 ''; 39 40 # $out/share/libwebsockets-test-server/plugins/libprotocol_*.so refers to crtbeginS.o 41 disallowedReferences = [ stdenv.cc.cc ]; 42 43 meta = with lib; { 44 description = "Light, portable C library for websockets"; 45 longDescription = '' 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. 49 ''; 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; 56 }; 57} 58