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