From d819f155032abaa4752122d184d21ed1beec09de Mon Sep 17 00:00:00 2001 From: Rick van Schijndel Date: Tue, 5 Jul 2022 10:37:07 +0200 Subject: [PATCH 1/2] libwebsockets: 4.3.1 -> 4.3.2 Drop the upstreamed patch that was required for fixing ttyd. Changes: https://github.com/warmcat/libwebsockets/compare/v4.3.1...v4.3.2 --- .../libraries/libwebsockets/default.nix | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/pkgs/development/libraries/libwebsockets/default.nix b/pkgs/development/libraries/libwebsockets/default.nix index 82f5614458f0..9c68c4a86de6 100644 --- a/pkgs/development/libraries/libwebsockets/default.nix +++ b/pkgs/development/libraries/libwebsockets/default.nix @@ -5,13 +5,12 @@ , openssl , zlib , libuv -, fetchpatch # External poll is required for e.g. mosquitto, but discouraged by the maintainer. , withExternalPoll ? false }: let - generic = { version, sha256, patches ? [] }: stdenv.mkDerivation rec { + generic = { version, hash, patches ? [] }: stdenv.mkDerivation rec { pname = "libwebsockets"; inherit version; @@ -19,7 +18,7 @@ let owner = "warmcat"; repo = "libwebsockets"; rev = "v${version}"; - inherit sha256; + inherit hash; }; inherit patches; @@ -63,15 +62,7 @@ let in { libwebsockets_4_3 = generic { - version = "4.3.1"; - sha256 = "sha256-lB3JHh058cQc5rycLnHk3JAOgtku0nRCixN5U6lPKq8="; - patches = [ - # fixes the propagated cmake files, fixing the build of ttyd - # see also https://github.com/tsl0922/ttyd/issues/918 - (fetchpatch { - url = "https://github.com/warmcat/libwebsockets/commit/99a8b9c4422bed45c8b7412a1e121056f2a6132a.patch"; - hash = "sha256-zHBo2ZEayvibM+jzeVaZqySxghaOLUglpSFwuGhl6HM="; - }) - ]; + version = "4.3.2"; + hash = "sha256-why8LAcc4XN0JdTJ1JoNWijKENL5mOHBsi9K4wpYr2c="; }; } From bcd5ad6d83f89e2f0b16137cfc280a952dba9406 Mon Sep 17 00:00:00 2001 From: Rick van Schijndel Date: Wed, 6 Jul 2022 22:02:40 +0200 Subject: [PATCH 2/2] libwebsockets: remove generic function, format Formatted with nixpkgs-fmt. --- .../libraries/libwebsockets/default.nix | 98 +++++++++---------- pkgs/top-level/all-packages.nix | 4 +- 2 files changed, 45 insertions(+), 57 deletions(-) diff --git a/pkgs/development/libraries/libwebsockets/default.nix b/pkgs/development/libraries/libwebsockets/default.nix index 9c68c4a86de6..0b8d8d8e5817 100644 --- a/pkgs/development/libraries/libwebsockets/default.nix +++ b/pkgs/development/libraries/libwebsockets/default.nix @@ -5,64 +5,54 @@ , openssl , zlib , libuv -# External poll is required for e.g. mosquitto, but discouraged by the maintainer. + # External poll is required for e.g. mosquitto, but discouraged by the maintainer. , withExternalPoll ? false }: -let - generic = { version, hash, patches ? [] }: stdenv.mkDerivation rec { - pname = "libwebsockets"; - inherit version; +stdenv.mkDerivation rec { + pname = "libwebsockets"; + version = "4.3.2"; - src = fetchFromGitHub { - owner = "warmcat"; - repo = "libwebsockets"; - rev = "v${version}"; - inherit hash; - }; - - inherit patches; - - buildInputs = [ openssl zlib libuv ]; - - nativeBuildInputs = [ cmake ]; - - cmakeFlags = [ - "-DLWS_WITH_PLUGINS=ON" - "-DLWS_WITH_IPV6=ON" - "-DLWS_WITH_SOCKS5=ON" - "-DDISABLE_WERROR=ON" - # Required since v4.2.0 - "-DLWS_BUILD_HASH=no_hash" - ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "-DLWS_WITHOUT_TESTAPPS=ON" - ++ lib.optional withExternalPoll "-DLWS_WITH_EXTERNAL_POLL=ON"; - - postInstall = '' - rm -r ${placeholder "out"}/share/libwebsockets-test-server - ''; - - # $out/share/libwebsockets-test-server/plugins/libprotocol_*.so refers to crtbeginS.o - disallowedReferences = [ stdenv.cc.cc ]; - - 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/"; - # Relicensed from LGPLv2.1+ to MIT with 4.0. Licensing situation - # is tricky, see https://github.com/warmcat/libwebsockets/blob/main/LICENSE - license = with licenses; [ mit publicDomain bsd3 asl20 ]; - maintainers = with maintainers; [ mindavi ]; - platforms = platforms.all; - }; - }; - -in { - libwebsockets_4_3 = generic { - version = "4.3.2"; + src = fetchFromGitHub { + owner = "warmcat"; + repo = "libwebsockets"; + rev = "v${version}"; hash = "sha256-why8LAcc4XN0JdTJ1JoNWijKENL5mOHBsi9K4wpYr2c="; }; + + buildInputs = [ openssl zlib libuv ]; + + nativeBuildInputs = [ cmake ]; + + cmakeFlags = [ + "-DLWS_WITH_PLUGINS=ON" + "-DLWS_WITH_IPV6=ON" + "-DLWS_WITH_SOCKS5=ON" + "-DDISABLE_WERROR=ON" + "-DLWS_BUILD_HASH=no_hash" + ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "-DLWS_WITHOUT_TESTAPPS=ON" + ++ lib.optional withExternalPoll "-DLWS_WITH_EXTERNAL_POLL=ON"; + + postInstall = '' + rm -r ${placeholder "out"}/share/libwebsockets-test-server + ''; + + # $out/share/libwebsockets-test-server/plugins/libprotocol_*.so refers to crtbeginS.o + disallowedReferences = [ stdenv.cc.cc ]; + + 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/"; + # Relicensed from LGPLv2.1+ to MIT with 4.0. Licensing situation + # is tricky, see https://github.com/warmcat/libwebsockets/blob/main/LICENSE + license = with licenses; [ mit publicDomain bsd3 asl20 ]; + maintainers = with maintainers; [ mindavi ]; + platforms = platforms.all; + }; } + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5716dd88ed2e..99f6b950eb26 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8094,9 +8094,7 @@ with pkgs; librest_1_0 = callPackage ../development/libraries/librest/1.0.nix { }; - inherit (callPackages ../development/libraries/libwebsockets { }) - libwebsockets_4_3; - libwebsockets = libwebsockets_4_3; + libwebsockets = callPackage ../development/libraries/libwebsockets { }; licensee = callPackage ../tools/package-management/licensee { };