Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at fix-function-merge 65 lines 1.9 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4, fetchpatch 5, pkg-config 6, cmake 7, gtest 8, valgrind 9}: 10 11stdenv.mkDerivation rec { 12 pname = "rapidjson"; 13 version = "1.1.0"; 14 15 src = fetchFromGitHub { 16 owner = "Tencent"; 17 repo = "rapidjson"; 18 rev = "v${version}"; 19 sha256 = "1jixgb8w97l9gdh3inihz7avz7i770gy2j2irvvlyrq3wi41f5ab"; 20 }; 21 22 patches = [ 23 (fetchpatch { 24 url = "https://src.fedoraproject.org/rpms/rapidjson/raw/48402da9f19d060ffcd40bf2b2e6987212c58b0c/f/rapidjson-1.1.0-c++20.patch"; 25 sha256 = "1qm62iad1xfsixv1li7qy475xc7gc04hmi2q21qdk6l69gk7mf82"; 26 }) 27 (fetchpatch { 28 name = "do-not-include-gtest-src-dir.patch"; 29 url = "https://git.alpinelinux.org/aports/plain/community/rapidjson/do-not-include-gtest-src-dir.patch?id=9e5eefc7a5fcf5938a8dc8a3be8c75e9e6809909"; 30 hash = "sha256-BjSZEwfCXA/9V+kxQ/2JPWbc26jQn35CfN8+8NW24s4="; 31 }) 32 # One of these three tests reports memcpy overlap after update to glibc-2.38 33 ./test-skip-valgrind.diff 34 ]; 35 36 postPatch = '' 37 find -name CMakeLists.txt | xargs \ 38 sed -i -e "s/-Werror//g" -e "s/-march=native//g" 39 ''; 40 41 nativeBuildInputs = [ pkg-config cmake ]; 42 43 # for tests, adding gtest to checkInputs does not work 44 # https://github.com/NixOS/nixpkgs/pull/212200 45 buildInputs = [ gtest ]; 46 cmakeFlags = [ 47 "-DGTEST_SOURCE_DIR=${gtest.dev}/include" 48 49 # Build rapidjson with std=c++17 so gtest 1.13.0+ works 50 # https://github.com/NixOS/nixpkgs/pull/282245#issuecomment-1951796902 51 "-DRAPIDJSON_BUILD_CXX11=OFF" 52 "-DRAPIDJSON_BUILD_CXX17=ON" 53 ]; 54 55 nativeCheckInputs = [ valgrind ]; 56 doCheck = !stdenv.hostPlatform.isStatic && !stdenv.isDarwin; 57 58 meta = with lib; { 59 description = "Fast JSON parser/generator for C++ with both SAX/DOM style API"; 60 homepage = "http://rapidjson.org/"; 61 license = licenses.mit; 62 platforms = platforms.unix; 63 maintainers = with maintainers; [ dotlambda ]; 64 }; 65}