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