6 enableShared ? !stdenv.hostPlatform.isStatic,
7 enableStatic ? stdenv.hostPlatform.isStatic,
10 stdenv.mkDerivation rec {
11 pname = "http-parser";
14 src = fetchFromGitHub {
18 sha256 = "1vda4dp75pjf5fcph73sy0ifm3xrssrmf927qd1x8g3q46z0cv6c";
21 env.NIX_CFLAGS_COMPILE = "-Wno-error";
25 ./enable-static-shared.patch
27 ++ lib.optionals stdenv.hostPlatform.isAarch32 [
28 # https://github.com/nodejs/http-parser/pull/510
30 url = "https://github.com/nodejs/http-parser/commit/4f15b7d510dc7c6361a26a7c6d2f7c3a17f8d878.patch";
31 sha256 = "sha256-rZZMJeow3V1fTnjadRaRa+xTq3pdhZn/eJ4xjxEDoU4=";
39 "BINEXT=${stdenv.hostPlatform.extensions.executable}"
40 "Platform=${lib.toLower stdenv.hostPlatform.uname.system}"
41 "AEXT=${lib.strings.removePrefix "." stdenv.hostPlatform.extensions.staticLibrary}"
42 "ENABLE_SHARED=${if enableShared then "1" else "0"}"
43 "ENABLE_STATIC=${if enableStatic then "1" else "0"}"
45 ++ lib.optionals enableShared [
46 "SOEXT=${lib.strings.removePrefix "." stdenv.hostPlatform.extensions.sharedLibrary}"
48 ++ lib.optionals enableStatic [
49 "AEXT=${lib.strings.removePrefix "." stdenv.hostPlatform.extensions.staticLibrary}"
51 ++ lib.optionals (enableShared && stdenv.hostPlatform.isWindows) [
52 "SONAME=$(SOLIBNAME).$(SOMAJOR).$(SOMINOR).$(SOEXT)"
53 "LIBNAME=$(SOLIBNAME).$(SOMAJOR).$(SOMINOR).$(SOREV).$(SOEXT)"
54 "LDFLAGS=-Wl,--out-implib=$(LIBNAME).a"
57 buildFlags = lib.optional enableShared "library" ++ lib.optional enableStatic "package";
62 enableParallelBuilding = true;
64 postInstall = lib.optionalString stdenv.hostPlatform.isWindows ''
65 install -D *.dll.a $out/lib
66 ln -sf libhttp_parser.${version}.dll.a $out/lib/libhttp_parser.dll.a
70 description = "HTTP message parser written in C";
71 homepage = "https://github.com/nodejs/http-parser";
72 maintainers = with maintainers; [ matthewbauer ];
73 license = licenses.mit;
74 platforms = platforms.all;