1{ stdenv, lib, fetchFromGitHub, cmake }:
2
3stdenv.mkDerivation rec {
4 pname = "cjson";
5 version = "1.7.16";
6
7 src = fetchFromGitHub {
8 owner = "DaveGamble";
9 repo = "cJSON";
10 rev = "v${version}";
11 sha256 = "sha256-sdhnDpaAO9Fau4uMzNXrbOJ2k0b8+MdhKh6rpFMUwaQ=";
12 };
13
14 nativeBuildInputs = [ cmake ];
15
16 # cJSON actually uses C99 standard, not C89
17 # https://github.com/DaveGamble/cJSON/issues/275
18 postPatch = ''
19 substituteInPlace CMakeLists.txt --replace -std=c89 -std=c99
20 '';
21
22 meta = with lib; {
23 homepage = "https://github.com/DaveGamble/cJSON";
24 description = "Ultralightweight JSON parser in ANSI C";
25 license = licenses.mit;
26 maintainers = [ maintainers.matthiasbeyer ];
27 platforms = platforms.unix;
28 };
29}