depot/third_party/nixpkgs/pkgs/by-name/li/libcpr/package.nix
Default email ae2dc6aea6 Project import generated by Copybara.
GitOrigin-RevId: 4c2fcb090b1f3e5b47eaa7bd33913b574a11e0a0
2024-10-11 07:15:48 +02:00

56 lines
1.1 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
cmake,
curl,
staticOnly ? stdenv.hostPlatform.isStatic,
}:
let
version = "1.11.0";
in
stdenv.mkDerivation {
pname = "libcpr";
inherit version;
outputs = [
"out"
"dev"
];
src = fetchFromGitHub {
owner = "libcpr";
repo = "cpr";
rev = version;
hash = "sha256-jWyss0krj8MVFqU1LAig+4UbXO5pdcWIT+hCs9DxemM=";
};
nativeBuildInputs = [ cmake ];
propagatedBuildInputs = [ curl ];
cmakeFlags = [
"-DBUILD_SHARED_LIBS=${if staticOnly then "OFF" else "ON"}"
"-DCPR_USE_SYSTEM_CURL=ON"
];
postPatch = ''
# Linking with stdc++fs is no longer necessary.
sed -i '/stdc++fs/d' include/CMakeLists.txt
'';
postInstall = ''
substituteInPlace "$out/lib/cmake/cpr/cprTargets.cmake" \
--replace "_IMPORT_PREFIX \"$out\"" \
"_IMPORT_PREFIX \"$dev\""
'';
meta = with lib; {
description = "C++ wrapper around libcurl";
homepage = "https://docs.libcpr.org/";
license = licenses.mit;
maintainers = with maintainers; [ rycee ];
platforms = platforms.all;
};
}