libmicrohttpd: Modernize
This commit is contained in:
parent
60eda8f64d
commit
c5d13d4fe9
@ -1,38 +1,65 @@
|
|||||||
{stdenv, fetchurl, curl, libgcrypt}:
|
{ stdenv, fetchurl, pkgconfig
|
||||||
|
, curl
|
||||||
|
|
||||||
|
# Optional Dependencies
|
||||||
|
, openssl ? null, zlib ? null, libgcrypt ? null, gnutls ? null
|
||||||
|
}:
|
||||||
|
|
||||||
|
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 "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;
|
||||||
|
|
||||||
|
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;
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "libmicrohttpd-0.9.38";
|
name = "libmicrohttpd-0.9.41";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "mirror://gnu/libmicrohttpd/${name}.tar.gz";
|
url = "mirror://gnu/libmicrohttpd/${name}.tar.gz";
|
||||||
sha256 = "08g7p4l0p2fsjj8ayl68zq1bqgrn0pck19bm8yd7k61whvfv9wld";
|
sha256 = "0z3s3aplgxj8cj947i4rxk9wzvg68b8hbn71fyipc7aagmivx64p";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [ curl libgcrypt ];
|
nativeBuildInputs = [ pkgconfig ];
|
||||||
|
buildInputs = optional doCheck curl
|
||||||
|
++ optionals hasSpdy [ optOpenssl optZlib ]
|
||||||
|
++ optionals hasHttps [ optLibgcrypt optGnutls ];
|
||||||
|
|
||||||
preCheck =
|
configureFlags = [
|
||||||
# Since `localhost' can't be resolved in a chroot, work around it.
|
(mkWith true "threads" "posix")
|
||||||
'' for i in "src/test"*"/"*.[ch]
|
(mkEnable true "doc" null)
|
||||||
do
|
(mkEnable false "examples" null)
|
||||||
sed -i "$i" -es/localhost/127.0.0.1/g
|
(mkEnable true "epoll" "auto")
|
||||||
done
|
(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)
|
||||||
|
];
|
||||||
|
|
||||||
# Disabled because the tests can time-out.
|
# Disabled because the tests can time-out.
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "Embeddable HTTP server library";
|
description = "Embeddable HTTP server library";
|
||||||
|
|
||||||
longDescription = ''
|
|
||||||
GNU libmicrohttpd is a small C library that is supposed to make
|
|
||||||
it easy to run an HTTP server as part of another application.
|
|
||||||
'';
|
|
||||||
|
|
||||||
license = stdenv.lib.licenses.lgpl2Plus;
|
|
||||||
|
|
||||||
homepage = http://www.gnu.org/software/libmicrohttpd/;
|
homepage = http://www.gnu.org/software/libmicrohttpd/;
|
||||||
|
license = licenses.lgpl2Plus;
|
||||||
maintainers = [ ];
|
platforms = platforms.all;
|
||||||
|
maintainers = with maintainers; [ wkennington ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user