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 cmakeFlags = [
32 "-DJSONCPP_LIB_BUILD_SHARED=ON"
33 "-DJSONCPP_LIB_BUILD_STATIC=OFF"
34 "-DJSONCPP_WITH_CMAKE_PACKAGE=ON"
35 ];
36
37 meta = {
38 inherit version;
39 homepage = https://github.com/open-source-parsers/jsoncpp;
40 description = "A simple API to manipulate JSON data in C++";
41 maintainers = with stdenv.lib.maintainers; [ ttuegel page ];
42 license = stdenv.lib.licenses.mit;
43 branch = "1.6";
44 };
45}