nixpkgs/pkgs/by-name/li/libjson-rpc-cpp/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

82 lines
2.1 KiB
Nix
Raw Normal View History

2024-08-01 19:04:34 +00:00
{ lib, stdenv, fetchFromGitHub, pkg-config, cmake, argtable, catch2
, curl, doxygen, hiredis, jsoncpp, libmicrohttpd }:
stdenv.mkDerivation rec {
pname = "libjson-rpc-cpp";
2024-08-01 19:04:34 +00:00
version = "1.4.1";
2013-10-14 14:11:46 +00:00
src = fetchFromGitHub {
owner = "cinemast";
repo = "libjson-rpc-cpp";
2024-08-01 19:04:34 +00:00
sha256 = "sha256-YCCZN4y88AixQeo24pk6YHfSCsJz8jJ97Dg40KM08cQ=";
rev = "v${version}";
};
2013-10-14 14:11:46 +00:00
env.NIX_CFLAGS_COMPILE = "-I${catch2}/include/catch2";
2021-01-10 13:57:25 +00:00
nativeBuildInputs = [ pkg-config cmake doxygen ];
2024-08-01 19:04:34 +00:00
buildInputs = [ argtable catch2 curl hiredis jsoncpp libmicrohttpd ];
postPatch = ''
for f in cmake/FindArgtable.cmake \
src/stubgenerator/stubgenerator.cpp \
src/stubgenerator/stubgeneratorfactory.cpp
do
sed -i -re 's/argtable2/argtable3/g' $f
done
2013-10-14 14:11:46 +00:00
sed -i -re 's#MATCHES "jsoncpp"#MATCHES ".*/jsoncpp/json$"#g' cmake/FindJsoncpp.cmake
'';
2021-01-10 13:57:25 +00:00
preConfigure = ''
mkdir -p Build/Install
pushd Build
2021-01-10 13:57:25 +00:00
'';
2021-01-10 13:57:25 +00:00
# this hack is needed because the cmake scripts
# require write permission to absolute paths
configurePhase = ''
runHook preConfigure
cmake .. -DCMAKE_INSTALL_PREFIX=$(pwd)/Install \
-DCMAKE_BUILD_TYPE=Release
2021-01-10 13:57:25 +00:00
runHook postConfigure
'';
2021-01-10 13:57:25 +00:00
preInstall = ''
function fixRunPath {
p=$(patchelf --print-rpath $1)
2024-08-01 19:04:34 +00:00
q="$p:${
lib.makeLibraryPath [ jsoncpp argtable libmicrohttpd curl ]
}:$out/lib"
patchelf --set-rpath $q $1
}
2021-01-10 13:57:25 +00:00
mkdir -p $out
'';
2013-10-14 14:11:46 +00:00
2021-01-10 13:57:25 +00:00
postInstall = ''
sed -i -re "s#-([LI]).*/Build/Install(.*)#-\1$out\2#g" Install/lib64/pkgconfig/*.pc
for f in Install/lib64/*.so* $(find Install/bin -executable -type f); do
fixRunPath $f
done
cp -r Install/* $out
'';
2013-10-14 14:11:46 +00:00
2021-01-10 13:57:25 +00:00
installPhase = ''
runHook preInstall
make install
runHook postInstall
'';
meta = with lib; {
2013-10-14 14:11:46 +00:00
description = "C++ framework for json-rpc (json remote procedure call)";
mainProgram = "jsonrpcstub";
homepage = "https://github.com/cinemast/libjson-rpc-cpp";
license = licenses.mit;
platforms = platforms.linux;
2024-08-01 19:04:34 +00:00
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
maintainers = with maintainers; [ robertrichter ];
2013-10-14 14:11:46 +00:00
};
}