about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/rapidjson
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2022-12-06 19:57:55 +0000
committerAlyssa Ross <hi@alyssa.is>2023-02-08 13:48:30 +0000
commitbf3aadfdd39aa197e18bade671fab6726349ffa4 (patch)
tree698567af766ed441d757b57a7b21e68d4a342a2b /nixpkgs/pkgs/development/libraries/rapidjson
parentf4afc5a01d9539ce09e47494e679c51f80723d07 (diff)
parent99665eb45f58d959d2cb9e49ddb960c79d596f33 (diff)
downloadnixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.gz
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.bz2
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.lz
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.xz
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.zst
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.zip
Merge commit '99665eb45f58d959d2cb9e49ddb960c79d596f33'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/rapidjson')
-rw-r--r--nixpkgs/pkgs/development/libraries/rapidjson/default.nix41
1 files changed, 36 insertions, 5 deletions
diff --git a/nixpkgs/pkgs/development/libraries/rapidjson/default.nix b/nixpkgs/pkgs/development/libraries/rapidjson/default.nix
index 1211892890ad..ac2d7e0b5f55 100644
--- a/nixpkgs/pkgs/development/libraries/rapidjson/default.nix
+++ b/nixpkgs/pkgs/development/libraries/rapidjson/default.nix
@@ -1,4 +1,11 @@
-{ stdenv, lib, fetchFromGitHub, fetchpatch, pkg-config, cmake }:
+{ lib
+, stdenv
+, fetchFromGitHub
+, fetchpatch
+, pkg-config
+, cmake
+, gtest
+}:
 
 stdenv.mkDerivation rec {
   pname = "rapidjson";
@@ -16,20 +23,44 @@ stdenv.mkDerivation rec {
       url = "https://src.fedoraproject.org/rpms/rapidjson/raw/48402da9f19d060ffcd40bf2b2e6987212c58b0c/f/rapidjson-1.1.0-c++20.patch";
       sha256 = "1qm62iad1xfsixv1li7qy475xc7gc04hmi2q21qdk6l69gk7mf82";
     })
+    (fetchpatch {
+      url = "https://git.alpinelinux.org/aports/plain/community/rapidjson/do-not-include-gtest-src-dir.patch";
+      hash = "sha256-BjSZEwfCXA/9V+kxQ/2JPWbc26jQn35CfN8+8NW24s4=";
+    })
   ];
 
+  postPatch = ''
+    find -name CMakeLists.txt | xargs \
+      sed -i -e "s/-Werror//g" -e "s/-march=native//g"
+  '';
+
   nativeBuildInputs = [ pkg-config cmake ];
 
-  preConfigure = ''
-    substituteInPlace CMakeLists.txt --replace "-Werror" ""
-    substituteInPlace example/CMakeLists.txt --replace "-Werror" ""
+  cmakeFlags = [
+    "-DGTEST_SOURCE_DIR=${gtest.dev}/include"
+  ] ++ lib.optionals (!doCheck) [
+    "-DRAPIDJSON_BUILD_TESTS=OFF"
+  ];
+
+  checkInputs = [
+    gtest
+  ];
+
+  checkPhase = ''
+    runHook preCheck
+
+    ctest -E '.*valgrind.*'
+
+    runHook postCheck
   '';
 
+  doCheck = !stdenv.hostPlatform.isStatic;
+
   meta = with lib; {
     description = "Fast JSON parser/generator for C++ with both SAX/DOM style API";
     homepage = "http://rapidjson.org/";
     license = licenses.mit;
     platforms = platforms.unix;
-    maintainers = with maintainers; [ cstrahan ];
+    maintainers = with maintainers; [ cstrahan dotlambda ];
   };
 }