Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 cmake, 6 curl, 7 staticOnly ? stdenv.hostPlatform.isStatic, 8}: 9 10let 11 version = "1.12.0"; 12in 13stdenv.mkDerivation { 14 pname = "libcpr"; 15 inherit version; 16 17 outputs = [ 18 "out" 19 "dev" 20 ]; 21 22 src = fetchFromGitHub { 23 owner = "libcpr"; 24 repo = "cpr"; 25 rev = version; 26 hash = "sha256-OkOyh2ibt/jX/Dc+TB1uSlWtzEhdSQwHVN96oCOh2yM="; 27 }; 28 29 nativeBuildInputs = [ cmake ]; 30 31 propagatedBuildInputs = [ curl ]; 32 33 cmakeFlags = [ 34 "-DBUILD_SHARED_LIBS=${if staticOnly then "OFF" else "ON"}" 35 "-DCPR_USE_SYSTEM_CURL=ON" 36 ]; 37 38 postPatch = '' 39 # Linking with stdc++fs is no longer necessary. 40 sed -i '/stdc++fs/d' include/CMakeLists.txt 41 ''; 42 43 postInstall = '' 44 substituteInPlace "$out/lib/cmake/cpr/cprTargets.cmake" \ 45 --replace "_IMPORT_PREFIX \"$out\"" \ 46 "_IMPORT_PREFIX \"$dev\"" 47 ''; 48 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 }; 56}