python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / development / libraries / rapidjson / default.nix
blobac2d7e0b5f55acf7ec95e9dccf15246d36d03519
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , fetchpatch
5 , pkg-config
6 , cmake
7 , gtest
8 }:
10 stdenv.mkDerivation rec {
11   pname = "rapidjson";
12   version = "1.1.0";
14   src = fetchFromGitHub {
15     owner = "miloyip";
16     repo = "rapidjson";
17     rev = "v${version}";
18     sha256 = "1jixgb8w97l9gdh3inihz7avz7i770gy2j2irvvlyrq3wi41f5ab";
19   };
21   patches = [
22     (fetchpatch {
23       url = "https://src.fedoraproject.org/rpms/rapidjson/raw/48402da9f19d060ffcd40bf2b2e6987212c58b0c/f/rapidjson-1.1.0-c++20.patch";
24       sha256 = "1qm62iad1xfsixv1li7qy475xc7gc04hmi2q21qdk6l69gk7mf82";
25     })
26     (fetchpatch {
27       url = "https://git.alpinelinux.org/aports/plain/community/rapidjson/do-not-include-gtest-src-dir.patch";
28       hash = "sha256-BjSZEwfCXA/9V+kxQ/2JPWbc26jQn35CfN8+8NW24s4=";
29     })
30   ];
32   postPatch = ''
33     find -name CMakeLists.txt | xargs \
34       sed -i -e "s/-Werror//g" -e "s/-march=native//g"
35   '';
37   nativeBuildInputs = [ pkg-config cmake ];
39   cmakeFlags = [
40     "-DGTEST_SOURCE_DIR=${gtest.dev}/include"
41   ] ++ lib.optionals (!doCheck) [
42     "-DRAPIDJSON_BUILD_TESTS=OFF"
43   ];
45   checkInputs = [
46     gtest
47   ];
49   checkPhase = ''
50     runHook preCheck
52     ctest -E '.*valgrind.*'
54     runHook postCheck
55   '';
57   doCheck = !stdenv.hostPlatform.isStatic;
59   meta = with lib; {
60     description = "Fast JSON parser/generator for C++ with both SAX/DOM style API";
61     homepage = "http://rapidjson.org/";
62     license = licenses.mit;
63     platforms = platforms.unix;
64     maintainers = with maintainers; [ cstrahan dotlambda ];
65   };