1{ stdenv
2, fetchgit
3, cmake
4, jsoncpp
5, argtable
6, curl
7, libmicrohttpd
8, doxygen
9, catch
10}:
11stdenv.mkDerivation rec {
12 name = "libjson-rpc-cpp-${version}";
13 version = "0.6.0";
14
15 src = fetchgit {
16 url = https://github.com/cinemast/libjson-rpc-cpp.git;
17 sha256 = "00fxxisg89zgg1wq047n8r8ws48jx35x3s6bbym4kg7dkxv9vv9f";
18 rev = "c6e3d7195060774bf95afc6df9c9588922076d3e";
19 };
20
21 hardeningDisable = [ "format" ];
22
23 patchPhase = ''
24 for f in cmake/FindArgtable.cmake \
25 src/stubgenerator/stubgenerator.cpp \
26 src/stubgenerator/stubgeneratorfactory.cpp
27 do
28 sed -i -re 's/argtable2/argtable3/g' $f
29 done
30
31 sed -i -re 's#MATCHES "jsoncpp"#MATCHES ".*/jsoncpp/json$"#g' cmake/FindJsoncpp.cmake
32 '';
33
34 configurePhase = ''
35 mkdir -p Build/Install
36 pushd Build
37
38 cmake .. -DCMAKE_INSTALL_PREFIX=$(pwd)/Install \
39 -DCMAKE_BUILD_TYPE=Release
40 '';
41
42 installPhase = ''
43 mkdir -p $out
44
45 function fixRunPath {
46 p=$(patchelf --print-rpath $1)
47 q="$p:${stdenv.lib.makeLibraryPath [ stdenv.cc.cc jsoncpp argtable libmicrohttpd curl ]}:$out/lib"
48 patchelf --set-rpath $q $1
49 }
50
51 make install
52
53 sed -i -re "s#-([LI]).*/Build/Install(.*)#-\1$out\2#g" Install/lib/pkgconfig/*.pc
54 for f in Install/lib/*.so* $(find Install/bin -executable -type f); do
55 fixRunPath $f
56 done
57
58 cp -r Install/* $out
59 '';
60
61 dontStrip = true;
62
63 buildInputs = [ cmake jsoncpp argtable curl libmicrohttpd doxygen catch ];
64
65 meta = with stdenv.lib; {
66 description = "C++ framework for json-rpc (json remote procedure call)";
67 homepage = https://github.com/cinemast/libjson-rpc-cpp;
68 license = licenses.mit;
69 platforms = platforms.linux;
70 };
71}