@ -1,77 +1,36 @@
{ stdenv , fetchurl , pkgconfig
# Optinal Dependencies
# Optio nal Dependencies
, openssl ? null , libev ? null , zlib ? null , jansson ? null , boost ? null
, libxml2 ? null , jemalloc ? null
# Extra argument
, prefix ? " "
} :
let
mkFlag = trueStr : falseStr : cond : name : val :
if cond == null then null else
" - - ${ if cond != false then trueStr else falseStr } ${ name } ${ if val != null && cond != false then " = ${ val } " else " " } " ;
mkEnable = mkFlag " e n a b l e - " " d i s a b l e - " ;
mkWith = mkFlag " w i t h - " " w i t h o u t - " ;
mkOther = mkFlag " " " " true ;
shouldUsePkg = pkg : if pkg != null && stdenv . lib . any ( x : x == stdenv . system ) pkg . meta . platforms then pkg else null ;
isLib = prefix == " l i b " ;
optOpenssl = if isLib then null else shouldUsePkg openssl ;
optLibev = if isLib then null else shouldUsePkg libev ;
optZlib = if isLib then null else shouldUsePkg zlib ;
hasApp = optOpenssl != null && optLibev != null && optZlib != null ;
optJansson = if isLib then null else shouldUsePkg jansson ;
#optBoost = if isLib then null else shouldUsePkg boost;
optBoost = null ; # Currently detection is broken
optLibxml2 = if ! hasApp then null else shouldUsePkg libxml2 ;
optJemalloc = if ! hasApp then null else shouldUsePkg jemalloc ;
in
stdenv . mkDerivation rec {
name = " ${ prefix } ng h t t p 2 - ${ version } " ;
version = " 1 . 8 . 0 " ;
name = " n g h t t p 2 - ${ version } " ;
version = " 1 . 9 . 2 " ;
# Don't use fetchFromGitHub since this needs a bootstrap curl
src = fetchurl {
url = " h t t p s : / / g i t h u b . c o m / n g h t t p 2 / n g h t t p 2 / r e l e a s e s / d o w n l o a d / v ${ version } / n g h t t p 2 - ${ version } . t a r . b z 2 " ;
sha256 = " 1 0 x z 3 s 6 2 4 w 2 0 8 p r 9 x g m 4 a m m c 8 b c 5 m i 1 7 v y 4 3 5 7 h j f d 5 v m m p 5 m 8 b 0 " ;
sha256 = " 1 j n m s 0 m m f 7 3 c w d q v b z p d y i 9 7 4 f 8 x q 7 p 8 b x g b a 2 i p p w 7 0 p z 8 y 0 a c 0 " ;
} ;
# Configure script searches for a symbol which does not exist in jemalloc on Darwin
# Reported upstream in https://github.com/tatsuhiro-t/nghttp2/issues/233
postPatch = if ( stdenv . isDarwin && optJ emalloc != null ) then ''
postPatch = if stdenv . isDarwin && jemalloc != null then ''
substituteInPlace configure - - replace " m a l l o c _ s t a t s _ p r i n t " " j e _ m a l l o c _ s t a t s _ p r i n t "
'' e l s e n u l l ;
outputs = [ " d e v " " o u t " " l i b " ] ;
nativeBuildInputs = [ pkgconfig ] ;
buildInputs = [ optJansson optBoost optLibxml2 optJemalloc ]
++ stdenv . lib . optionals hasApp [ optOpenssl optLibev optZlib ] ;
buildInputs = [ openssl libev zlib ] ;
configureFlags = [
( mkEnable false " w e r r o r " null )
( mkEnable false " d e b u g " null )
( mkEnable true " t h r e a d s " null )
( mkEnable hasApp " a p p " null )
( mkEnable ( optJansson != null ) " h p a c k - t o o l s " null )
( mkEnable ( optBoost != null ) " a s i o - l i b " null )
( mkEnable false " e x a m p l e s " null )
( mkEnable false " p y t h o n - b i n d i n g s " null )
( mkEnable false " f a i l m a l l o c " null )
( mkWith ( optLibxml2 != null ) " l i b x m l 2 " null )
( mkWith ( optJemalloc != null ) " j e m a l l o c " null )
( mkWith false " s p d y l a y " null )
( mkWith false " c y t h o n " null )
( mkWith false " m r u b y " null )
] ;
enableParallelBuilding = true ;
meta = with stdenv . lib ; {
homepage = http://nghttp2.org/ ;
description = " a n i m p l e m e n t a t i o n o f H T T P / 2 i n C " ;
description = " A C i m p l e m e n t a t i o n o f H T T P / 2 " ;
license = licenses . mit ;
platforms = platforms . all ;
maintainers = with maintainers ; [ wkennington ] ;