diff options
author | William A. Kennington III <william@wkennington.com> | 2015-05-01 17:48:59 -0700 |
---|---|---|
committer | William A. Kennington III <william@wkennington.com> | 2015-05-01 17:48:59 -0700 |
commit | c5d13d4fe96674a4fcb04b54ea552847302e13ee (patch) | |
tree | 767df480a7c3789f3e6a69636249e4421ec34dae /pkgs/development/libraries/libmicrohttpd | |
parent | 60eda8f64d1147f9210ff50f056edd6c71145519 (diff) | |
download | nixlib-c5d13d4fe96674a4fcb04b54ea552847302e13ee.tar nixlib-c5d13d4fe96674a4fcb04b54ea552847302e13ee.tar.gz nixlib-c5d13d4fe96674a4fcb04b54ea552847302e13ee.tar.bz2 nixlib-c5d13d4fe96674a4fcb04b54ea552847302e13ee.tar.lz nixlib-c5d13d4fe96674a4fcb04b54ea552847302e13ee.tar.xz nixlib-c5d13d4fe96674a4fcb04b54ea552847302e13ee.tar.zst nixlib-c5d13d4fe96674a4fcb04b54ea552847302e13ee.zip |
libmicrohttpd: Modernize
Diffstat (limited to 'pkgs/development/libraries/libmicrohttpd')
-rw-r--r-- | pkgs/development/libraries/libmicrohttpd/default.nix | 69 |
1 files changed, 48 insertions, 21 deletions
diff --git a/pkgs/development/libraries/libmicrohttpd/default.nix b/pkgs/development/libraries/libmicrohttpd/default.nix index 8b9f6f1dca57..9eca6bd84b99 100644 --- a/pkgs/development/libraries/libmicrohttpd/default.nix +++ b/pkgs/development/libraries/libmicrohttpd/default.nix @@ -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 { - name = "libmicrohttpd-0.9.38"; + name = "libmicrohttpd-0.9.41"; src = fetchurl { 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 = - # Since `localhost' can't be resolved in a chroot, work around it. - '' for i in "src/test"*"/"*.[ch] - do - sed -i "$i" -es/localhost/127.0.0.1/g - done - ''; + 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) + ]; # Disabled because the tests can time-out. doCheck = false; meta = { 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/; - - maintainers = [ ]; + license = licenses.lgpl2Plus; + platforms = platforms.all; + maintainers = with maintainers; [ wkennington ]; }; } |