1{ stdenv, fetchFromGitHub, cmake, python }:
2
3stdenv.mkDerivation rec {
4 name = "jsoncpp-${version}";
5 version = "1.6.5";
6
7 src = fetchFromGitHub {
8 owner = "open-source-parsers";
9 repo = "jsoncpp";
10 rev = version;
11 sha256 = "08y54n4v3q18ik8iv8zyziava3x130ilzf1l3qli3vjwf6l42fm0";
12 };
13
14 /* During darwin bootstrap, we have a cp that doesn't understand the
15 * --reflink=auto flag, which is used in the default unpackPhase for dirs
16 */
17 unpackPhase = ''
18 cp -a ${src} ${src.name}
19 chmod -R +w ${src.name}
20 export sourceRoot=${src.name}
21 '';
22
23 # Hack to be able to run the test, broken because we use
24 # CMAKE_SKIP_BUILD_RPATH to avoid cmake resetting rpath on install
25 preBuild = ''
26 export LD_LIBRARY_PATH="`pwd`/src/lib_json:$LD_LIBRARY_PATH"
27 '';
28
29 nativeBuildInputs = [ cmake python ];
30
31 CXXFLAGS = "-Wno-shift-negative-value";
32
33 cmakeFlags = [
34 "-DJSONCPP_LIB_BUILD_SHARED=ON"
35 "-DJSONCPP_LIB_BUILD_STATIC=OFF"
36 "-DJSONCPP_WITH_CMAKE_PACKAGE=ON"
37 ];
38
39 meta = {
40 inherit version;
41 homepage = https://github.com/open-source-parsers/jsoncpp;
42 description = "A simple API to manipulate JSON data in C++";
43 maintainers = with stdenv.lib.maintainers; [ ttuegel page ];
44 platforms = stdenv.lib.platforms.all;
45 license = stdenv.lib.licenses.mit;
46 branch = "1.6";
47 };
48}