blob: ce4b9977ff52851b8ace457bd1122bd9f7fadeff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
{
stdenv,
lib,
fetchFromGitHub,
cmake,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "cjson";
version = "1.7.19";
src = fetchFromGitHub {
owner = "DaveGamble";
repo = "cJSON";
rev = "v${finalAttrs.version}";
sha256 = "sha256-WjgzokT9aHJ7dB40BtmhS7ur1slTuXmemgDimZHLVQM=";
};
nativeBuildInputs = [ cmake ];
cmakeFlags = lib.optional (stdenv.cc.isClang && !stdenv.hostPlatform.isDarwin) (
lib.cmakeBool "ENABLE_CUSTOM_COMPILER_FLAGS" false
);
postPatch =
# cJSON actually uses C99 standard, not C89
# https://github.com/DaveGamble/cJSON/issues/275
''
substituteInPlace CMakeLists.txt --replace -std=c89 -std=c99
''
# Fix the build with CMake 4.
#
# See:
# * <https://github.com/DaveGamble/cJSON/issues/946>
# * <https://github.com/DaveGamble/cJSON/pull/935>
# * <https://github.com/DaveGamble/cJSON/pull/949>
+ ''
substituteInPlace CMakeLists.txt \
--replace-fail \
'cmake_minimum_required(VERSION 3.0)' \
'cmake_minimum_required(VERSION 3.10)'
'';
meta = {
homepage = "https://github.com/DaveGamble/cJSON";
description = "Ultralightweight JSON parser in ANSI C";
license = lib.licenses.mit;
maintainers = [ lib.maintainers.matthiasbeyer ];
platforms = lib.platforms.windows ++ lib.platforms.unix;
};
})
|