1{ lib, stdenv, libgcrypt, curl, gnutls, pkg-config, libiconv, libintl, version, src, meta ? {}, fetchpatch }:
2
3let
4 meta_ = meta;
5in
6
7stdenv.mkDerivation rec {
8 pname = "libmicrohttpd";
9 inherit version src;
10
11 patches = lib.optionals (lib.versionOlder version "0.9.76") [
12 (fetchpatch {
13 name = "CVE-2023-27371.patch";
14 url = "https://git.gnunet.org/libmicrohttpd.git/patch/?id=e0754d1638c602382384f1eface30854b1defeec";
15 hash = "sha256-vzrq9HPysGpc13rFEk6zLPgpUqp/ST4q/Wp30Dam97k=";
16 excludes = [
17 "ChangeLog"
18 ];
19 })
20 ];
21
22 outputs = [ "out" "dev" "devdoc" "info" ];
23 nativeBuildInputs = [ pkg-config ];
24 buildInputs = [ libgcrypt curl gnutls libiconv libintl ];
25
26 preCheck = ''
27 # Since `localhost' can't be resolved in a chroot, work around it.
28 sed -ie 's/localhost/127.0.0.1/g' src/test*/*.[ch]
29 '';
30
31 # Disabled because the tests can time-out.
32 doCheck = false;
33
34 meta = with lib; {
35 description = "Embeddable HTTP server library";
36
37 longDescription = ''
38 GNU libmicrohttpd is a small C library that is supposed to make
39 it easy to run an HTTP server as part of another application.
40 '';
41
42 license = licenses.lgpl2Plus;
43
44 homepage = "https://www.gnu.org/software/libmicrohttpd/";
45
46 maintainers = with maintainers; [ eelco vrthra fpletz ];
47 platforms = platforms.unix;
48 } // meta_;
49}