Merge pull request #330698 from tobim/pkgs/rapidjson-unstable-default

rapidjson: 1.1.0 -> unstable-2024-04-09, rapidjson-unstable: drop
This commit is contained in:
Masum Reza 2024-07-31 10:37:21 +05:30 committed by GitHub
commit 28ec6ee964
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 68 additions and 138 deletions

View File

@ -1,65 +1,79 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, pkg-config
, cmake
, doxygen
, graphviz
, gtest
, valgrind
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "rapidjson";
version = "1.1.0";
version = "unstable-2024-04-09";
outputs = [
"out"
"doc"
];
src = fetchFromGitHub {
owner = "Tencent";
repo = "rapidjson";
rev = "v${version}";
sha256 = "1jixgb8w97l9gdh3inihz7avz7i770gy2j2irvvlyrq3wi41f5ab";
rev = "ab1842a2dae061284c0a62dca1cc6d5e7e37e346";
hash = "sha256-kAGVJfDHEUV2qNR1LpnWq3XKBJy4hD3Swh6LX5shJpM=";
};
patches = [
(fetchpatch {
url = "https://src.fedoraproject.org/rpms/rapidjson/raw/48402da9f19d060ffcd40bf2b2e6987212c58b0c/f/rapidjson-1.1.0-c++20.patch";
sha256 = "1qm62iad1xfsixv1li7qy475xc7gc04hmi2q21qdk6l69gk7mf82";
})
(fetchpatch {
name = "do-not-include-gtest-src-dir.patch";
url = "https://git.alpinelinux.org/aports/plain/community/rapidjson/do-not-include-gtest-src-dir.patch?id=9e5eefc7a5fcf5938a8dc8a3be8c75e9e6809909";
hash = "sha256-BjSZEwfCXA/9V+kxQ/2JPWbc26jQn35CfN8+8NW24s4=";
})
# One of these three tests reports memcpy overlap after update to glibc-2.38
./test-skip-valgrind.diff
./use-nixpkgs-gtest.patch
# https://github.com/Tencent/rapidjson/issues/2214
./suppress-valgrind-failures.patch
];
postPatch = ''
find -name CMakeLists.txt | xargs \
sed -i -e "s/-Werror//g" -e "s/-march=native//g"
for f in doc/Doxyfile.*; do
substituteInPlace $f \
--replace-fail "WARN_IF_UNDOCUMENTED = YES" "WARN_IF_UNDOCUMENTED = NO"
done
'';
nativeBuildInputs = [ pkg-config cmake ];
# for tests, adding gtest to checkInputs does not work
# https://github.com/NixOS/nixpkgs/pull/212200
buildInputs = [ gtest ];
cmakeFlags = [
"-DGTEST_SOURCE_DIR=${gtest.dev}/include"
# Build rapidjson with std=c++17 so gtest 1.13.0+ works
# https://github.com/NixOS/nixpkgs/pull/282245#issuecomment-1951796902
"-DRAPIDJSON_BUILD_CXX11=OFF"
"-DRAPIDJSON_BUILD_CXX17=ON"
nativeBuildInputs = [
cmake
doxygen
graphviz
];
nativeCheckInputs = [ valgrind ];
doCheck = !stdenv.hostPlatform.isStatic && !stdenv.isDarwin;
buildInputs = [
gtest
];
strictDeps = true;
cmakeFlags = [
(lib.cmakeBool "RAPIDJSON_BUILD_DOC" true)
(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)
# 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 = !(stdenv.hostPlatform.isStatic || stdenv.isDarwin);
nativeCheckInputs = [
valgrind
];
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; [ dotlambda ];
maintainers = with maintainers; [ dotlambda Madouura tobim ];
};
}
})

View File

@ -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)

View File

@ -1,80 +0,0 @@
{ lib
, stdenv
, fetchFromGitHub
, cmake
, doxygen
, graphviz
, gtest
, valgrind
, buildDocs ? true
, buildTests ? !stdenv.hostPlatform.isStatic && !stdenv.isDarwin
, buildExamples ? true
}:
stdenv.mkDerivation (finalAttrs: {
pname = "rapidjson";
version = "unstable-2023-09-28";
outputs = [
"out"
] ++ lib.optionals buildDocs [
"doc"
] ++ lib.optionals buildExamples [
"example"
];
src = fetchFromGitHub {
owner = "Tencent";
repo = "rapidjson";
rev = "f9d53419e912910fd8fa57d5705fa41425428c35";
hash = "sha256-rl7iy14jn1K2I5U2DrcZnoTQVEGEDKlxmdaOCF/3hfY=";
};
patches = lib.optionals buildTests [
./0000-unstable-use-nixpkgs-gtest.patch
# https://github.com/Tencent/rapidjson/issues/2214
./0001-unstable-valgrind-suppress-failures.patch
];
nativeBuildInputs = [
cmake
] ++ lib.optionals buildDocs [
doxygen
graphviz
];
cmakeFlags = [
(lib.cmakeBool "RAPIDJSON_BUILD_DOC" buildDocs)
(lib.cmakeBool "RAPIDJSON_BUILD_TESTS" buildTests)
(lib.cmakeBool "RAPIDJSON_BUILD_EXAMPLES" buildExamples)
# 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}")
];
doCheck = buildTests;
nativeCheckInputs = [
gtest
valgrind
];
postInstall = lib.optionalString buildExamples ''
mkdir -p $example/bin
find bin -type f -executable \
-not -name "perftest" \
-not -name "unittest" \
-exec cp -a {} $example/bin \;
'';
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; [ Madouura ];
};
})

View File

@ -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

View File

@ -10,7 +10,6 @@
, opencv
, ffmpeg_4
, libjpeg_turbo
, rapidjson-unstable
}:
let
@ -304,7 +303,6 @@ in rec {
inherit (llvm) clang openmp;
opencv = opencv.override { enablePython = true; };
ffmpeg = ffmpeg_4;
rapidjson = rapidjson-unstable;
stdenv = llvm.rocmClangStdenv;
# Unfortunately, rocAL needs a custom libjpeg-turbo until further notice

View File

@ -10,7 +10,6 @@
, opencv
, ffmpeg_4
, libjpeg_turbo
, rapidjson-unstable
}:
let
@ -303,7 +302,6 @@ in rec {
inherit (llvm) clang openmp;
opencv = opencv.override { enablePython = true; };
ffmpeg = ffmpeg_4;
rapidjson = rapidjson-unstable;
stdenv = llvm.rocmClangStdenv;
# Unfortunately, rocAL needs a custom libjpeg-turbo until further notice

View File

@ -1234,6 +1234,7 @@ mapAliases ({
radicle-upstream = throw "'radicle-upstream' was sunset, see <https://community.radworks.org/t/2962>"; # Added 2024-05-04
railway-travel = diebahn; # Added 2024-04-01
rambox-pro = rambox; # Added 2022-12-12
rapidjson-unstable = lib.warn "'rapidjson-unstable' has been renamed to 'rapidjson'" rapidjson; # Added 2024-07-28
rarian = throw "rarian has been removed as unused"; # Added 2023-07-05
rccl = throw "'rccl' has been replaced with 'rocmPackages.rccl'"; # Added 2023-10-08
rdc = throw "'rdc' has been replaced with 'rocmPackages.rdc'"; # Added 2023-10-08

View File

@ -23677,8 +23677,6 @@ with pkgs;
rapidjson = callPackage ../development/libraries/rapidjson { };
rapidjson-unstable = callPackage ../development/libraries/rapidjson/unstable.nix { };
rapidxml = callPackage ../development/libraries/rapidxml { };
rapidyaml = callPackage ../development/libraries/rapidyaml {};