nghttp2: 1.43.0 -> 1.47.0

Refactor of the feature switches as there was some invalid combinations.
{c-ares,libev,openssl,zlib} are all strictly needed if we want to build
the applications but are unnecessary when building the lib alone.

Accordingly the overrides  in `fetchurl` and `pythonPackages.nghttp2`
are updated to use `enableApp = false` as they only want libnghttp2.
fetchurl bootstrapping just got lighter. :)

Also enable the checks whenever possible. To run them we need to set
TZDATA environment variable and the `CUnit` tool.
Those tests are made optionals as we don't want to scope `cunit` and
`tzdata` when bootstrapping `fetchurl`.

Also install the Bash completions for h2load, nghttp, nghttpd and nghttpx.

Finally, add `c0bw3b` as maintainer.
This commit is contained in:
c0bw3b
2022-03-08 19:32:23 +01:00
parent f9ab767d67
commit 32dbdc4388
3 changed files with 66 additions and 45 deletions
+61 -41
View File
@@ -1,90 +1,110 @@
{ lib, stdenv, fetchurl, pkg-config { lib
, stdenv
, fetchurl
, installShellFiles
, pkg-config
# Optional Dependencies # Optional dependencies
, openssl ? null, zlib ? null , enableApp ? with stdenv.hostPlatform; !isWindows && !isStatic
, enableLibEv ? !stdenv.hostPlatform.isWindows, libev ? null , c-ares ? null, libev ? null, openssl ? null, zlib ? null
, enableCAres ? !stdenv.hostPlatform.isWindows, c-ares ? null
, enableHpack ? false, jansson ? null
, enableAsioLib ? false, boost ? null , enableAsioLib ? false, boost ? null
, enableGetAssets ? false, libxml2 ? null , enableGetAssets ? false, libxml2 ? null
, enableHpack ? false, jansson ? null
, enableJemalloc ? false, jemalloc ? null , enableJemalloc ? false, jemalloc ? null
, enableApp ? with stdenv.hostPlatform; !isWindows && !isStatic
, enablePython ? false, python ? null, cython ? null, ncurses ? null, setuptools ? null , enablePython ? false, python ? null, cython ? null, ncurses ? null, setuptools ? null
# Unit tests ; on Darwin CUnit brings an additional dependency on ncurses which is inconvenient here
, enableTests ? (!stdenv.isDarwin), cunit ? null, tzdata ? null
# downstream dependencies, for testing # downstream dependencies, for testing
, curl , curl
, libsoup , libsoup
}: }:
# Note: this package is used for bootstrapping fetchurl, and thus # Note: this package is used for bootstrapping fetchurl, and thus cannot use fetchpatch!
# cannot use fetchpatch! All mutable patches (generated by GitHub or # All mutable patches (generated by GitHub or cgit) that are needed here
# cgit) that are needed here should be included directly in Nixpkgs as # should be included directly in Nixpkgs as files.
# files.
assert enableHpack -> jansson != null; assert enableApp -> c-ares != null && libev != null && openssl != null && zlib != null;
assert enableAsioLib -> boost != null; assert enableAsioLib -> boost != null;
assert enableGetAssets -> libxml2 != null; assert enableGetAssets -> enableApp == true && libxml2 != null;
assert enableJemalloc -> jemalloc != null; assert enableHpack -> enableApp == true && jansson != null;
assert enableJemalloc -> enableApp == true && jemalloc != null;
assert enablePython -> python != null && cython != null && ncurses != null && setuptools != null; assert enablePython -> python != null && cython != null && ncurses != null && setuptools != null;
assert enableTests -> cunit != null && tzdata != null;
let inherit (lib) optional optionals optionalString; in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "nghttp2"; pname = "nghttp2";
version = "1.43.0"; version = "1.47.0";
src = fetchurl { src = fetchurl {
url = "https://github.com/${pname}/${pname}/releases/download/v${version}/${pname}-${version}.tar.bz2"; url = "https://github.com/${pname}/${pname}/releases/download/v${version}/${pname}-${version}.tar.bz2";
sha256 = "0qhgyphzdv72dgdfxin2xbk9623za3jwbcvhhaxixiwp6djj8vsm"; sha256 = "11d6w8iqrhnxmjd9ss9fzf66f7a32d48h2ihyk1580lg8d3rkj07";
}; };
outputs = [ "bin" "out" "dev" "lib" ] outputs = [ "bin" "out" "dev" "lib" ]
++ optional enablePython "python"; ++ lib.optionals (enablePython) [ "python" ];
nativeBuildInputs = [ pkg-config ]; nativeBuildInputs = [ pkg-config ]
buildInputs = [ openssl ] ++ lib.optionals (enableApp) [ installShellFiles ]
++ optional enableLibEv libev ++ lib.optionals (enablePython) [ cython ];
++ [ zlib ]
++ optional enableCAres c-ares buildInputs = lib.optionals enableApp [ c-ares libev openssl zlib ]
++ optional enableHpack jansson ++ lib.optionals (enableAsioLib) [ boost ]
++ optional enableAsioLib boost ++ lib.optionals (enableGetAssets) [ libxml2 ]
++ optional enableGetAssets libxml2 ++ lib.optionals (enableHpack) [ jansson ]
++ optional enableJemalloc jemalloc ++ lib.optionals (enableJemalloc) [ jemalloc ]
++ optionals enablePython [ python ncurses setuptools ]; ++ lib.optionals (enablePython) [ python ncurses setuptools ];
enableParallelBuilding = true; enableParallelBuilding = true;
configureFlags = [ configureFlags = [
"--with-spdylay=no"
"--disable-examples" "--disable-examples"
(lib.enableFeature enableApp "app") (lib.enableFeature enableApp "app")
] ++ optional enableAsioLib "--enable-asio-lib --with-boost-libdir=${boost}/lib" ] ++ lib.optionals (enableAsioLib) [ "--enable-asio-lib" "--with-boost-libdir=${boost}/lib" ]
++ (if enablePython then [ ++ lib.optionals (enablePython) [ "--with-cython=${cython}/bin/cython" ];
"--with-cython=${cython}/bin/cython"
] else [
"--disable-python-bindings"
]);
preInstall = optionalString enablePython '' # Unit tests require CUnit and setting TZDIR environment variable
doCheck = enableTests;
checkInputs = lib.optionals (enableTests) [ cunit tzdata ];
preCheck = lib.optionalString (enableTests) ''
export TZDIR=${tzdata}/share/zoneinfo
'';
preInstall = lib.optionalString (enablePython) ''
mkdir -p $out/${python.sitePackages} mkdir -p $out/${python.sitePackages}
# convince installer it's ok to install here # convince installer it's ok to install here
export PYTHONPATH="$PYTHONPATH:$out/${python.sitePackages}" export PYTHONPATH="$PYTHONPATH:$out/${python.sitePackages}"
''; '';
postInstall = optionalString enablePython '' postInstall = lib.optionalString (enablePython) ''
mkdir -p $python/${python.sitePackages} mkdir -p $python/${python.sitePackages}
mv $out/${python.sitePackages}/* $python/${python.sitePackages} mv $out/${python.sitePackages}/* $python/${python.sitePackages}
rm -r $out/lib
'' + lib.optionalString (enableApp) ''
installShellCompletion --bash doc/bash_completion/{h2load,nghttp,nghttpd,nghttpx}
''; '';
#doCheck = true; # requires CUnit ; currently failing at test_util_localtime_date in util_test.cc
passthru.tests = { passthru.tests = {
inherit curl libsoup; inherit curl libsoup;
}; };
meta = with lib; { meta = with lib; {
description = "HTTP/2 C library and tools";
longDescription = ''
nghttp2 is an implementation of the HyperText Transfer Protocol version 2 in C.
The framing layer of HTTP/2 is implemented as a reusable C library. On top of that,
we have implemented an HTTP/2 client, server and proxy. We have also developed
load test and benchmarking tools for HTTP/2.
An HPACK encoder and decoder are available as a public API.
We have Python bindings of this library, but we do not have full code coverage yet.
An experimental high level C++ library is also available.
'';
homepage = "https://nghttp2.org/"; homepage = "https://nghttp2.org/";
description = "A C implementation of HTTP/2"; changelog = "https://github.com/nghttp2/nghttp2/releases/tag/v${version}";
# News articles with changes summary can be found here: https://nghttp2.org/blog/archives/
license = licenses.mit; license = licenses.mit;
maintainers = with maintainers; [ c0bw3b ];
platforms = platforms.all; platforms = platforms.all;
}; };
} }
+3 -3
View File
@@ -652,9 +652,9 @@ with pkgs;
}; };
nghttp2 = buildPackages.nghttp2.override { nghttp2 = buildPackages.nghttp2.override {
fetchurl = stdenv.fetchurlBoot; fetchurl = stdenv.fetchurlBoot;
inherit zlib pkg-config openssl; inherit pkg-config;
c-ares = buildPackages.c-ares.override { fetchurl = stdenv.fetchurlBoot; }; enableApp = false; # curl just needs libnghttp2
libev = buildPackages.libev.override { fetchurl = stdenv.fetchurlBoot; }; enableTests = false; # avoids bringing `cunit` and `tzdata` into scope
}; };
}); });
}; };
+2 -1
View File
@@ -5473,7 +5473,8 @@ in {
nghttp2 = (toPythonModule (pkgs.nghttp2.override { nghttp2 = (toPythonModule (pkgs.nghttp2.override {
inherit (self) python cython setuptools; inherit (self) python cython setuptools;
inherit (pkgs) ncurses; inherit (pkgs) ncurses;
enablePython = true; enableApp = false; # build only libnghttp2 ...
enablePython = true; # ... and its Python bindings
})).python; })).python;
nibabel = callPackage ../development/python-modules/nibabel { }; nibabel = callPackage ../development/python-modules/nibabel { };