summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Mayer <tobim@fastmail.fm>2024-07-29 07:38:02 +0200
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2024-07-31 10:19:49 +0000
commit1e3a3f292b9a5ea02d9c89d3d67d0e1a5ff556eb (patch)
tree19b0af795501be460418bf9710db2f1f3a0da83d
parentrapidjson: remove questionable options (diff)
downloadnixpkgs-1e3a3f292b9a5ea02d9c89d3d67d0e1a5ff556eb.tar.gz
rapidjson: additional cleanuporigin/backport-330698-to-release-24.05
(cherry picked from commit 11ff4aefaeb5132904f05267db01a74705f2226c)
-rw-r--r--pkgs/development/libraries/rapidjson/default.nix32
-rw-r--r--pkgs/development/libraries/rapidjson/suppress-valgrind-failures.patch (renamed from pkgs/development/libraries/rapidjson/0001-unstable-valgrind-suppress-failures.patch)0
-rw-r--r--pkgs/development/libraries/rapidjson/test-skip-valgrind.diff7
-rw-r--r--pkgs/development/libraries/rapidjson/use-nixpkgs-gtest.patch (renamed from pkgs/development/libraries/rapidjson/0000-unstable-use-nixpkgs-gtest.patch)28
4 files changed, 41 insertions, 26 deletions
diff --git a/pkgs/development/libraries/rapidjson/default.nix b/pkgs/development/libraries/rapidjson/default.nix
index 97c76cf9e530..9aa239458502 100644
--- a/pkgs/development/libraries/rapidjson/default.nix
+++ b/pkgs/development/libraries/rapidjson/default.nix
@@ -6,7 +6,6 @@
, graphviz
, gtest
, valgrind
-, buildTests ? !stdenv.hostPlatform.isStatic && !stdenv.isDarwin
}:
stdenv.mkDerivation (finalAttrs: {
@@ -25,33 +24,48 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-kAGVJfDHEUV2qNR1LpnWq3XKBJy4hD3Swh6LX5shJpM=";
};
- patches = lib.optionals buildTests [
- ./0000-unstable-use-nixpkgs-gtest.patch
+ patches = [
+ ./use-nixpkgs-gtest.patch
# https://github.com/Tencent/rapidjson/issues/2214
- ./0001-unstable-valgrind-suppress-failures.patch
+ ./suppress-valgrind-failures.patch
];
+ postPatch = ''
+ for f in doc/Doxyfile.*; do
+ substituteInPlace $f \
+ --replace-fail "WARN_IF_UNDOCUMENTED = YES" "WARN_IF_UNDOCUMENTED = NO"
+ done
+ '';
+
nativeBuildInputs = [
cmake
doxygen
graphviz
];
+ buildInputs = [
+ gtest
+ ];
+
+ strictDeps = true;
+
cmakeFlags = [
(lib.cmakeBool "RAPIDJSON_BUILD_DOC" true)
- (lib.cmakeBool "RAPIDJSON_BUILD_TESTS" buildTests)
+ (lib.cmakeBool "RAPIDJSON_BUILD_TESTS" true)
(lib.cmakeBool "RAPIDJSON_BUILD_EXAMPLES" true)
# gtest 1.13+ requires C++14 or later.
(lib.cmakeBool "RAPIDJSON_BUILD_CXX11" false)
(lib.cmakeBool "RAPIDJSON_BUILD_CXX17" true)
- ] ++ lib.optionals buildTests [
- (lib.cmakeFeature "GTEST_INCLUDE_DIR" "${lib.getDev gtest}")
+ # Prevent -march=native
+ (lib.cmakeBool "RAPIDJSON_ENABLE_INSTRUMENTATION_OPT" false)
+ # Disable -Werror by using build type specific flags, which are
+ # added after general CMAKE_CXX_FLAGS.
+ (lib.cmakeFeature "CMAKE_CXX_FLAGS_RELEASE" "-Wno-error")
];
- doCheck = buildTests;
+ doCheck = !(stdenv.hostPlatform.isStatic || stdenv.isDarwin);
nativeCheckInputs = [
- gtest
valgrind
];
diff --git a/pkgs/development/libraries/rapidjson/0001-unstable-valgrind-suppress-failures.patch b/pkgs/development/libraries/rapidjson/suppress-valgrind-failures.patch
index dd06ba6a6971..dd06ba6a6971 100644
--- a/pkgs/development/libraries/rapidjson/0001-unstable-valgrind-suppress-failures.patch
+++ b/pkgs/development/libraries/rapidjson/suppress-valgrind-failures.patch
diff --git a/pkgs/development/libraries/rapidjson/test-skip-valgrind.diff b/pkgs/development/libraries/rapidjson/test-skip-valgrind.diff
deleted file mode 100644
index a791d88699ff..000000000000
--- a/pkgs/development/libraries/rapidjson/test-skip-valgrind.diff
+++ /dev/null
@@ -1,7 +0,0 @@
---- a/test/unittest/CMakeLists.txt
-+++ b/test/unittest/CMakeLists.txt
-@@ -82,3 +81,0 @@
-- add_test(NAME valgrind_unittest
-- COMMAND valgrind --leak-check=full --error-exitcode=1 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest --gtest_filter=-SIMD.*
-- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
-
diff --git a/pkgs/development/libraries/rapidjson/0000-unstable-use-nixpkgs-gtest.patch b/pkgs/development/libraries/rapidjson/use-nixpkgs-gtest.patch
index df334cc91264..878182ea5a5f 100644
--- a/pkgs/development/libraries/rapidjson/0000-unstable-use-nixpkgs-gtest.patch
+++ b/pkgs/development/libraries/rapidjson/use-nixpkgs-gtest.patch
@@ -1,28 +1,33 @@
+From b9206d360c19412d185263795d67c884feab281a Mon Sep 17 00:00:00 2001
+From: Tobias Mayer <tobim@fastmail.fm>
+Date: Mon, 29 Jul 2024 07:26:50 +0200
+Subject: [PATCH] Use nixpkgs gtest
+
+---
+ test/CMakeLists.txt | 24 ++++++------------------
+ 1 file changed, 6 insertions(+), 18 deletions(-)
+
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
-index 11c1b04c..762eaa75 100644
+index 11c1b04c..3d02d475 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
-@@ -1,20 +1,14 @@
+@@ -1,20 +1,8 @@
-find_package(GTestSrc)
++find_package(GTest REQUIRED)
+enable_testing()
-IF(GTESTSRC_FOUND)
- enable_testing()
-+if (WIN32 AND (NOT CYGWIN) AND (NOT MINGW))
-+ set(gtest_disable_pthreads ON)
-+ set(gtest_force_shared_crt ON)
-+endif()
++set(TEST_LIBRARIES GTest::gtest GTest::gtest_main)
- if (WIN32 AND (NOT CYGWIN) AND (NOT MINGW))
- set(gtest_disable_pthreads ON)
- set(gtest_force_shared_crt ON)
- endif()
-+include_directories(SYSTEM ${GTEST_INCLUDE_DIR})
-
+-
- add_subdirectory(${GTEST_SOURCE_DIR} ${CMAKE_BINARY_DIR}/googletest)
- include_directories(SYSTEM ${GTEST_INCLUDE_DIR})
-+set(TEST_LIBRARIES gtest gtest_main)
-
+-
- set(TEST_LIBRARIES gtest gtest_main)
-
- add_custom_target(tests ALL)
@@ -33,3 +38,6 @@ index 11c1b04c..762eaa75 100644
+add_custom_target(tests ALL)
+add_subdirectory(perftest)
+add_subdirectory(unittest)
+--
+2.45.2
+