btrbk: add mainProgram
[NixPkgs.git] / pkgs / by-name / li / libcpr / package.nix
blobabbf0dcb6e6e1a3b2c98ae80928935cb6d0740ef
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   cmake,
6   curl,
7   staticOnly ? stdenv.hostPlatform.isStatic,
8 }:
10 let
11   version = "1.11.0";
13 stdenv.mkDerivation {
14   pname = "libcpr";
15   inherit version;
17   outputs = [
18     "out"
19     "dev"
20   ];
22   src = fetchFromGitHub {
23     owner = "libcpr";
24     repo = "cpr";
25     rev = version;
26     hash = "sha256-jWyss0krj8MVFqU1LAig+4UbXO5pdcWIT+hCs9DxemM=";
27   };
29   nativeBuildInputs = [ cmake ];
31   propagatedBuildInputs = [ curl ];
33   cmakeFlags = [
34     "-DBUILD_SHARED_LIBS=${if staticOnly then "OFF" else "ON"}"
35     "-DCPR_USE_SYSTEM_CURL=ON"
36   ];
38   postPatch = ''
39     # Linking with stdc++fs is no longer necessary.
40     sed -i '/stdc++fs/d' include/CMakeLists.txt
41   '';
43   postInstall = ''
44     substituteInPlace "$out/lib/cmake/cpr/cprTargets.cmake" \
45       --replace "_IMPORT_PREFIX \"$out\"" \
46                 "_IMPORT_PREFIX \"$dev\""
47   '';
49   meta = with lib; {
50     description = "C++ wrapper around libcurl";
51     homepage = "https://docs.libcpr.org/";
52     license = licenses.mit;
53     maintainers = with maintainers; [ rycee ];
54     platforms = platforms.all;
55   };