2021-01-21 17:00:13 +00:00
|
|
|
{ lib, stdenv, fetchurl, pkg-config
|
2015-05-01 21:35:56 +00:00
|
|
|
|
2016-04-18 18:42:50 +00:00
|
|
|
# Optional Dependencies
|
2019-11-11 19:07:37 +00:00
|
|
|
, openssl ? null, zlib ? null
|
|
|
|
, enableLibEv ? !stdenv.hostPlatform.isWindows, libev ? null
|
|
|
|
, enableCAres ? !stdenv.hostPlatform.isWindows, c-ares ? null
|
2016-12-12 23:45:05 +00:00
|
|
|
, enableHpack ? false, jansson ? null
|
|
|
|
, enableAsioLib ? false, boost ? null
|
|
|
|
, enableGetAssets ? false, libxml2 ? null
|
|
|
|
, enableJemalloc ? false, jemalloc ? null
|
2021-01-03 21:40:14 +00:00
|
|
|
, enableApp ? with stdenv.hostPlatform; !isWindows && !isStatic
|
2020-03-29 21:05:50 +00:00
|
|
|
, enablePython ? false, python ? null, cython ? null, ncurses ? null, setuptools ? null
|
2022-03-07 17:41:38 +00:00
|
|
|
|
|
|
|
# downstream dependencies, for testing
|
|
|
|
, curl
|
|
|
|
, libsoup
|
2015-05-01 21:35:56 +00:00
|
|
|
}:
|
|
|
|
|
2020-06-26 20:44:45 +00:00
|
|
|
# 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.
|
|
|
|
|
2016-12-12 23:45:05 +00:00
|
|
|
assert enableHpack -> jansson != null;
|
|
|
|
assert enableAsioLib -> boost != null;
|
|
|
|
assert enableGetAssets -> libxml2 != null;
|
|
|
|
assert enableJemalloc -> jemalloc != null;
|
2020-03-29 21:05:50 +00:00
|
|
|
assert enablePython -> python != null && cython != null && ncurses != null && setuptools != null;
|
2016-12-12 23:45:05 +00:00
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
let inherit (lib) optional optionals optionalString; in
|
2016-12-12 23:45:05 +00:00
|
|
|
|
2015-05-01 21:35:56 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-03-12 20:41:46 +00:00
|
|
|
pname = "nghttp2";
|
2021-03-30 07:42:32 +00:00
|
|
|
version = "1.43.0";
|
2015-05-01 21:35:56 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-03-12 20:41:46 +00:00
|
|
|
url = "https://github.com/${pname}/${pname}/releases/download/v${version}/${pname}-${version}.tar.bz2";
|
2021-03-30 07:42:32 +00:00
|
|
|
sha256 = "0qhgyphzdv72dgdfxin2xbk9623za3jwbcvhhaxixiwp6djj8vsm";
|
2015-05-01 21:35:56 +00:00
|
|
|
};
|
|
|
|
|
2020-03-29 21:05:50 +00:00
|
|
|
outputs = [ "bin" "out" "dev" "lib" ]
|
|
|
|
++ optional enablePython "python";
|
2016-04-18 18:42:50 +00:00
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2019-11-11 19:07:37 +00:00
|
|
|
buildInputs = [ openssl ]
|
|
|
|
++ optional enableLibEv libev
|
|
|
|
++ [ zlib ]
|
|
|
|
++ optional enableCAres c-ares
|
2016-12-12 23:45:05 +00:00
|
|
|
++ optional enableHpack jansson
|
|
|
|
++ optional enableAsioLib boost
|
|
|
|
++ optional enableGetAssets libxml2
|
2020-03-29 21:05:50 +00:00
|
|
|
++ optional enableJemalloc jemalloc
|
|
|
|
++ optionals enablePython [ python ncurses setuptools ];
|
2015-05-01 21:35:56 +00:00
|
|
|
|
2016-04-18 18:42:50 +00:00
|
|
|
enableParallelBuilding = true;
|
2015-05-01 21:35:56 +00:00
|
|
|
|
2018-10-17 17:44:23 +00:00
|
|
|
configureFlags = [
|
|
|
|
"--with-spdylay=no"
|
|
|
|
"--disable-examples"
|
2021-01-21 17:00:13 +00:00
|
|
|
(lib.enableFeature enableApp "app")
|
2020-03-29 21:05:50 +00:00
|
|
|
] ++ 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}
|
|
|
|
# convince installer it's ok to install here
|
|
|
|
export PYTHONPATH="$PYTHONPATH:$out/${python.sitePackages}"
|
|
|
|
'';
|
|
|
|
postInstall = optionalString enablePython ''
|
|
|
|
mkdir -p $python/${python.sitePackages}
|
|
|
|
mv $out/${python.sitePackages}/* $python/${python.sitePackages}
|
|
|
|
'';
|
2017-03-15 23:55:13 +00:00
|
|
|
|
|
|
|
#doCheck = true; # requires CUnit ; currently failing at test_util_localtime_date in util_test.cc
|
|
|
|
|
2022-03-07 17:41:38 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit curl libsoup;
|
|
|
|
};
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://nghttp2.org/";
|
2016-04-18 18:42:50 +00:00
|
|
|
description = "A C implementation of HTTP/2";
|
2015-05-01 21:35:56 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|