diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/nghttp2')
-rw-r--r-- | nixpkgs/pkgs/development/libraries/nghttp2/default.nix | 122 |
1 files changed, 69 insertions, 53 deletions
diff --git a/nixpkgs/pkgs/development/libraries/nghttp2/default.nix b/nixpkgs/pkgs/development/libraries/nghttp2/default.nix index bd639ec3041a..ca8cb6418190 100644 --- a/nixpkgs/pkgs/development/libraries/nghttp2/default.nix +++ b/nixpkgs/pkgs/development/libraries/nghttp2/default.nix @@ -1,90 +1,106 @@ -{ lib, stdenv, fetchurl, pkg-config - -# Optional Dependencies -, openssl ? null, zlib ? null -, enableLibEv ? !stdenv.hostPlatform.isWindows, libev ? null -, enableCAres ? !stdenv.hostPlatform.isWindows, c-ares ? null -, enableHpack ? false, jansson ? null -, enableAsioLib ? false, boost ? null -, enableGetAssets ? false, libxml2 ? null -, enableJemalloc ? false, jemalloc ? null +{ lib +, stdenv +, fetchurl +, installShellFiles +, pkg-config + +# Optional dependencies , enableApp ? with stdenv.hostPlatform; !isWindows && !isStatic -, enablePython ? false, python ? null, cython ? null, ncurses ? null, setuptools ? null +, c-ares, libev, openssl, zlib +, enableAsioLib ? false, boost +, enableGetAssets ? false, libxml2 +, enableHpack ? false, jansson +, enableJemalloc ? false, jemalloc +, enablePython ? false, python3Packages, ncurses + +# Unit tests ; we have to set TZDIR, which is a GNUism. +, enableTests ? stdenv.hostPlatform.isGnu, cunit, tzdata # downstream dependencies, for testing , curl , libsoup }: -# Note: this package is used for bootstrapping fetchurl, and thus -# cannot use fetchpatch! All mutable patches (generated by GitHub or -# cgit) that are needed here should be included directly in Nixpkgs as -# files. - -assert enableHpack -> jansson != null; -assert enableAsioLib -> boost != null; -assert enableGetAssets -> libxml2 != null; -assert enableJemalloc -> jemalloc != null; -assert enablePython -> python != null && cython != null && ncurses != null && setuptools != null; +# Note: this package is used for bootstrapping fetchurl, and thus cannot use fetchpatch! +# All mutable patches (generated by GitHub or cgit) that are needed here +# should be included directly in Nixpkgs as files. -let inherit (lib) optional optionals optionalString; in +assert enableGetAssets -> enableApp; +assert enableHpack -> enableApp; +assert enableJemalloc -> enableApp; stdenv.mkDerivation rec { pname = "nghttp2"; - version = "1.43.0"; + version = "1.47.0"; src = fetchurl { url = "https://github.com/${pname}/${pname}/releases/download/v${version}/${pname}-${version}.tar.bz2"; - sha256 = "0qhgyphzdv72dgdfxin2xbk9623za3jwbcvhhaxixiwp6djj8vsm"; + sha256 = "11d6w8iqrhnxmjd9ss9fzf66f7a32d48h2ihyk1580lg8d3rkj07"; }; outputs = [ "bin" "out" "dev" "lib" ] - ++ optional enablePython "python"; - - nativeBuildInputs = [ pkg-config ]; - buildInputs = [ openssl ] - ++ optional enableLibEv libev - ++ [ zlib ] - ++ optional enableCAres c-ares - ++ optional enableHpack jansson - ++ optional enableAsioLib boost - ++ optional enableGetAssets libxml2 - ++ optional enableJemalloc jemalloc - ++ optionals enablePython [ python ncurses setuptools ]; + ++ lib.optionals (enablePython) [ "python" ]; + + nativeBuildInputs = [ pkg-config ] + ++ lib.optionals (enableApp) [ installShellFiles ] + ++ lib.optionals (enablePython) [ python3Packages.cython ]; + + buildInputs = lib.optionals enableApp [ c-ares libev openssl zlib ] + ++ lib.optionals (enableAsioLib) [ boost ] + ++ lib.optionals (enableGetAssets) [ libxml2 ] + ++ lib.optionals (enableHpack) [ jansson ] + ++ lib.optionals (enableJemalloc) [ jemalloc ] + ++ lib.optionals (enablePython) [ python3Packages.python ncurses python3Packages.setuptools ]; enableParallelBuilding = true; configureFlags = [ - "--with-spdylay=no" "--disable-examples" (lib.enableFeature enableApp "app") - ] ++ optional enableAsioLib "--enable-asio-lib --with-boost-libdir=${boost}/lib" - ++ (if enablePython then [ - "--with-cython=${cython}/bin/cython" - ] else [ - "--disable-python-bindings" - ]); - - preInstall = optionalString enablePython '' - mkdir -p $out/${python.sitePackages} + ] ++ lib.optionals (enableAsioLib) [ "--enable-asio-lib" "--with-boost-libdir=${boost}/lib" ] + ++ lib.optionals (enablePython) [ "--with-cython=${python3Packages.cython}/bin/cython" ]; + + # 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/${python3Packages.python.sitePackages} # convince installer it's ok to install here - export PYTHONPATH="$PYTHONPATH:$out/${python.sitePackages}" + export PYTHONPATH="$PYTHONPATH:$out/${python3Packages.python.sitePackages}" ''; - postInstall = optionalString enablePython '' - mkdir -p $python/${python.sitePackages} - mv $out/${python.sitePackages}/* $python/${python.sitePackages} + postInstall = lib.optionalString (enablePython) '' + mkdir -p $python/${python3Packages.python.sitePackages} + mv $out/${python3Packages.python.sitePackages}/* $python/${python3Packages.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 = { inherit curl libsoup; }; 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/"; - 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; + maintainers = with maintainers; [ c0bw3b ]; platforms = platforms.all; }; } |