2015-05-02 00:48:59 +00:00
|
|
|
{ stdenv, fetchurl, pkgconfig
|
|
|
|
, curl
|
2008-05-11 11:46:48 +00:00
|
|
|
|
2015-05-02 00:48:59 +00:00
|
|
|
# Optional Dependencies
|
|
|
|
, openssl ? null, zlib ? null, libgcrypt ? null, gnutls ? null
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2015-06-01 18:52:03 +00:00
|
|
|
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 "enable-" "disable-";
|
|
|
|
mkWith = mkFlag "with-" "without-";
|
|
|
|
mkOther = mkFlag "" "" true;
|
|
|
|
|
|
|
|
shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
|
|
|
|
|
2015-05-02 00:48:59 +00:00
|
|
|
optOpenssl = shouldUsePkg openssl;
|
|
|
|
optZlib = shouldUsePkg zlib;
|
|
|
|
hasSpdy = optOpenssl != null && optZlib != null;
|
|
|
|
|
|
|
|
optLibgcrypt = shouldUsePkg libgcrypt;
|
|
|
|
optGnutls = shouldUsePkg gnutls;
|
|
|
|
hasHttps = optLibgcrypt != null && optGnutls != null;
|
|
|
|
in
|
|
|
|
with stdenv.lib;
|
2008-08-29 21:54:26 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2015-05-02 00:48:59 +00:00
|
|
|
name = "libmicrohttpd-0.9.41";
|
2008-05-11 11:46:48 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2008-08-29 21:54:26 +00:00
|
|
|
url = "mirror://gnu/libmicrohttpd/${name}.tar.gz";
|
2015-05-02 00:48:59 +00:00
|
|
|
sha256 = "0z3s3aplgxj8cj947i4rxk9wzvg68b8hbn71fyipc7aagmivx64p";
|
2008-05-11 11:46:48 +00:00
|
|
|
};
|
|
|
|
|
2015-05-02 00:48:59 +00:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
|
|
|
buildInputs = optional doCheck curl
|
|
|
|
++ optionals hasSpdy [ optOpenssl optZlib ]
|
|
|
|
++ optionals hasHttps [ optLibgcrypt optGnutls ];
|
2008-08-29 21:54:26 +00:00
|
|
|
|
2015-05-02 00:48:59 +00:00
|
|
|
configureFlags = [
|
|
|
|
(mkWith true "threads" "posix")
|
|
|
|
(mkEnable true "doc" null)
|
|
|
|
(mkEnable false "examples" null)
|
|
|
|
(mkEnable true "epoll" "auto")
|
|
|
|
(mkEnable doCheck "curl" null)
|
|
|
|
(mkEnable hasSpdy "spdy" null)
|
|
|
|
(mkEnable true "messages" null)
|
|
|
|
(mkEnable true "postprocessor" null)
|
|
|
|
(mkWith hasHttps "gnutls" null)
|
|
|
|
(mkEnable hasHttps "https" null)
|
|
|
|
(mkEnable true "bauth" null)
|
|
|
|
(mkEnable true "dauth" null)
|
|
|
|
];
|
2010-01-05 11:16:37 +00:00
|
|
|
|
2014-04-22 08:05:51 +00:00
|
|
|
# Disabled because the tests can time-out.
|
|
|
|
doCheck = false;
|
2008-08-29 21:54:26 +00:00
|
|
|
|
|
|
|
meta = {
|
2014-08-24 14:21:08 +00:00
|
|
|
description = "Embeddable HTTP server library";
|
2008-08-29 21:54:26 +00:00
|
|
|
homepage = http://www.gnu.org/software/libmicrohttpd/;
|
2015-05-02 00:48:59 +00:00
|
|
|
license = licenses.lgpl2Plus;
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ wkennington ];
|
2008-08-29 21:54:26 +00:00
|
|
|
};
|
2008-05-11 11:46:48 +00:00
|
|
|
}
|