1{ lib, stdenv, fetchFromGitHub, cmake, curl }:
2
3let version = "1.10.4"; in
4stdenv.mkDerivation {
5 pname = "libcpr";
6 inherit version;
7
8 outputs = [ "out" "dev" ];
9
10 src = fetchFromGitHub {
11 owner = "libcpr";
12 repo = "cpr";
13 rev = version;
14 hash = "sha256-8qRNlZgBB71t/FSFPnxFhr02OuD2erLVeoc6wAx3LKk=";
15 };
16
17 nativeBuildInputs = [ cmake ];
18
19 propagatedBuildInputs = [ curl ];
20
21 cmakeFlags = [
22 "-DCPR_USE_SYSTEM_CURL=ON"
23 ];
24
25 postPatch = ''
26 # Linking with stdc++fs is no longer necessary.
27 sed -i '/stdc++fs/d' include/CMakeLists.txt
28 '';
29
30 postInstall = ''
31 substituteInPlace "$out/lib/cmake/cpr/cprTargets.cmake" \
32 --replace "_IMPORT_PREFIX \"$out\"" \
33 "_IMPORT_PREFIX \"$dev\""
34 '';
35
36 meta = with lib; {
37 description = "C++ wrapper around libcurl";
38 homepage = "https://docs.libcpr.org/";
39 license = licenses.mit;
40 maintainers = with maintainers; [ rycee ];
41 platforms = platforms.all;
42 };
43}