kubernetes-controller-tools: 0.17.1 -> 0.17.2 (#380899)
[NixPkgs.git] / pkgs / by-name / ht / http-parser / package.nix
blob30e33e13130a6e08bcd795c2e6fd9fb53efd594e
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   fetchpatch,
6   enableShared ? !stdenv.hostPlatform.isStatic,
7   enableStatic ? stdenv.hostPlatform.isStatic,
8 }:
10 stdenv.mkDerivation rec {
11   pname = "http-parser";
12   version = "2.9.4";
14   src = fetchFromGitHub {
15     owner = "nodejs";
16     repo = "http-parser";
17     rev = "v${version}";
18     sha256 = "1vda4dp75pjf5fcph73sy0ifm3xrssrmf927qd1x8g3q46z0cv6c";
19   };
21   env.NIX_CFLAGS_COMPILE = "-Wno-error";
23   patches =
24     [
25       ./enable-static-shared.patch
26     ]
27     ++ lib.optionals stdenv.hostPlatform.isAarch32 [
28       # https://github.com/nodejs/http-parser/pull/510
29       (fetchpatch {
30         url = "https://github.com/nodejs/http-parser/commit/4f15b7d510dc7c6361a26a7c6d2f7c3a17f8d878.patch";
31         sha256 = "sha256-rZZMJeow3V1fTnjadRaRa+xTq3pdhZn/eJ4xjxEDoU4=";
32       })
33     ];
35   makeFlags =
36     [
37       "DESTDIR="
38       "PREFIX=$(out)"
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"}"
44     ]
45     ++ lib.optionals enableShared [
46       "SOEXT=${lib.strings.removePrefix "." stdenv.hostPlatform.extensions.sharedLibrary}"
47     ]
48     ++ lib.optionals enableStatic [
49       "AEXT=${lib.strings.removePrefix "." stdenv.hostPlatform.extensions.staticLibrary}"
50     ]
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"
55     ];
57   buildFlags = lib.optional enableShared "library" ++ lib.optional enableStatic "package";
59   doCheck = true;
60   checkTarget = "test";
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
67   '';
69   meta = with lib; {
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;
75   };