about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libcpr/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libcpr/default.nix')
-rw-r--r--nixpkgs/pkgs/development/libraries/libcpr/default.nix43
1 files changed, 43 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libcpr/default.nix b/nixpkgs/pkgs/development/libraries/libcpr/default.nix
new file mode 100644
index 000000000000..9652b4a67f96
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libcpr/default.nix
@@ -0,0 +1,43 @@
+{ lib, stdenv, fetchFromGitHub, cmake, curl }:
+
+let version = "1.10.4"; in
+stdenv.mkDerivation {
+  pname = "libcpr";
+  inherit version;
+
+  outputs = [ "out" "dev" ];
+
+  src = fetchFromGitHub {
+    owner = "libcpr";
+    repo = "cpr";
+    rev = version;
+    hash = "sha256-8qRNlZgBB71t/FSFPnxFhr02OuD2erLVeoc6wAx3LKk=";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  propagatedBuildInputs = [ curl ];
+
+  cmakeFlags = [
+    "-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;
+  };
+}