dev-libs/rapidjson: Import from Gentoo to build sys-fs/overlaybd offline

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
This commit is contained in:
James Le Cuirot 2026-01-06 11:41:06 +00:00
parent 2d5b140d51
commit 2479cd95a6
No known key found for this signature in database
GPG Key ID: 1226415D00DD3137
13 changed files with 405 additions and 0 deletions

View File

@ -291,6 +291,7 @@ dev-libs/openssl
dev-libs/popt
dev-libs/protobuf
dev-libs/raft
dev-libs/rapidjson
dev-libs/tree-sitter
dev-libs/tree-sitter-bash
dev-libs/userspace-rcu

View File

@ -0,0 +1 @@
DIST rapidjson-1.1.0.tar.gz 1019402 BLAKE2B e1564b3cfa020f76437b0a35048a42ff2cd98b5ce285e63f228e158885182e5cecda13407cdf30c03fa39b47cbc579ff0065f6c2682d04b806e8f9ea8d36fc4e SHA512 2e82a4bddcd6c4669541f5945c2d240fb1b4fdd6e239200246d3dd50ce98733f0a4f6d3daa56f865d8c88779c036099c52a9ae85d47ad263686b68a88d832dff

View File

@ -0,0 +1,19 @@
https://bugs.gentoo.org/951839
https://github.com/Tencent/rapidjson/issues/2159 fixed in git already
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
if(POLICY CMP0025)
# detect Apple's Clang
cmake_policy(SET CMP0025 NEW)
--- a/example/CMakeLists.txt
+++ b/example/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.5)
if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)

View File

@ -0,0 +1,41 @@
https://github.com/Tencent/rapidjson/commit/bbdf5d1d4b40891c82e5c1946d32dfc841926066
From bbdf5d1d4b40891c82e5c1946d32dfc841926066 Mon Sep 17 00:00:00 2001
From: Christopher Warrington <chwarr@microsoft.com>
Date: Tue, 5 Sep 2017 16:58:09 -0700
Subject: [PATCH] Fix Windows doc build MSBuild error MSB6001
When using a MSBuild-based CMake generator like 'Visual Studio 15 2017
Win64', the doc build was failing with the error 'MSB6001: Invalid
command line switch for "cmd.exe". Illegal characters in path.'
This was due to the dependency on Doxyfile*, which wasn't expanded by
CMake.
The fix is to expand this glob in CMake before specifying the custom
command's dependencies.
Partial fix for https://github.com/miloyip/rapidjson/issues/622
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index c1f165a3..c5345ba6 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -10,11 +10,13 @@ ELSE()
CONFIGURE_FILE(Doxyfile.in Doxyfile @ONLY)
CONFIGURE_FILE(Doxyfile.zh-cn.in Doxyfile.zh-cn @ONLY)
+ file(GLOB DOXYFILES ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile*)
+
add_custom_command(OUTPUT html
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.zh-cn
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/html
- DEPENDS ${MARKDOWN_DOC} ${SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile*
+ DEPENDS ${MARKDOWN_DOC} ${SOURCES} ${DOXYFILES}
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../
)
--
2.45.2

View File

@ -0,0 +1,46 @@
From fe19b7b6016d446722621fb407738209d1a911e8 Mon Sep 17 00:00:00 2001
From: Harry Wong <harrywong@live.com>
Date: Thu, 4 May 2017 10:08:48 +0800
Subject: [PATCH 1/2] Supress implicit fallthrough in GCC
---
include/rapidjson/internal/regex.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/rapidjson/internal/regex.h b/include/rapidjson/internal/regex.h
index 1369ea266..6d110bdbd 100644
--- a/include/rapidjson/internal/regex.h
+++ b/include/rapidjson/internal/regex.h
@@ -29,6 +29,7 @@ RAPIDJSON_DIAG_OFF(implicit-fallthrough)
#ifdef __GNUC__
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(effc++)
+RAPIDJSON_DIAG_OFF(implicit-fallthrough)
#endif
#ifdef _MSC_VER
From cba45fe9de6923b858edb0780e257b7257aa4f7b Mon Sep 17 00:00:00 2001
From: Harry Wong <harrywong@live.com>
Date: Thu, 4 May 2017 10:32:45 +0800
Subject: [PATCH 2/2] Onley apply to GCC 7
---
include/rapidjson/internal/regex.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/rapidjson/internal/regex.h b/include/rapidjson/internal/regex.h
index 6d110bdbd..e1a2faae5 100644
--- a/include/rapidjson/internal/regex.h
+++ b/include/rapidjson/internal/regex.h
@@ -29,8 +29,10 @@ RAPIDJSON_DIAG_OFF(implicit-fallthrough)
#ifdef __GNUC__
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(effc++)
+#if __GNUC__ >= 7
RAPIDJSON_DIAG_OFF(implicit-fallthrough)
#endif
+#endif
#ifdef _MSC_VER
RAPIDJSON_DIAG_PUSH

View File

@ -0,0 +1,20 @@
https://bugs.gentoo.org/914583
https://github.com/Tencent/rapidjson/commit/3b2441b87f99ab65f37b141a7b548ebadb607b96
https://github.com/Tencent/rapidjson/issues/718
From 3b2441b87f99ab65f37b141a7b548ebadb607b96 Mon Sep 17 00:00:00 2001
From: Janusz Chorko <janusz.chorko@apdu.pl>
Date: Fri, 26 Aug 2016 21:17:38 +0200
Subject: [PATCH] Removed non-compiling assignment operator. Fixed #718
--- a/include/rapidjson/document.h
+++ b/include/rapidjson/document.h
@@ -316,8 +316,6 @@ struct GenericStringRef {
GenericStringRef(const GenericStringRef& rhs) : s(rhs.s), length(rhs.length) {}
- GenericStringRef& operator=(const GenericStringRef& rhs) { s = rhs.s; length = rhs.length; }
-
//! implicit conversion to plain CharType pointer
operator const Ch *() const { return s; }

View File

@ -0,0 +1,44 @@
--- a/CMakeModules/FindGTestSrc.cmake
+++ b/CMakeModules/FindGTestSrc.cmake
@@ -1,30 +1,9 @@
-
-SET(GTEST_SEARCH_PATH
- "${GTEST_SOURCE_DIR}"
- "${CMAKE_CURRENT_LIST_DIR}/../thirdparty/gtest/googletest")
-
-IF(UNIX)
- IF(RAPIDJSON_BUILD_THIRDPARTY_GTEST)
- LIST(APPEND GTEST_SEARCH_PATH "/usr/src/gtest")
- ELSE()
- LIST(INSERT GTEST_SEARCH_PATH 1 "/usr/src/gtest")
- ENDIF()
-ENDIF()
-
-FIND_PATH(GTEST_SOURCE_DIR
- NAMES CMakeLists.txt src/gtest_main.cc
- PATHS ${GTEST_SEARCH_PATH})
-
-
# Debian installs gtest include directory in /usr/include, thus need to look
# for include directory separately from source directory.
FIND_PATH(GTEST_INCLUDE_DIR
NAMES gtest/gtest.h
- PATH_SUFFIXES include
- HINTS ${GTEST_SOURCE_DIR}
- PATHS ${GTEST_SEARCH_PATH})
+ PATH_SUFFIXES include)
INCLUDE(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GTestSrc DEFAULT_MSG
- GTEST_SOURCE_DIR
GTEST_INCLUDE_DIR)
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -8,7 +8,6 @@
set(gtest_force_shared_crt ON)
endif()
- add_subdirectory(${GTEST_SOURCE_DIR} ${CMAKE_BINARY_DIR}/googletest)
include_directories(SYSTEM ${GTEST_INCLUDE_DIR})
set(TEST_LIBRARIES gtest gtest_main)

View File

@ -0,0 +1,21 @@
https://github.com/Tencent/rapidjson/issues/1808
--- a/test/unittest/CMakeLists.txt
+++ b/test/unittest/CMakeLists.txt
@@ -77,12 +77,15 @@
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
-if(NOT MSVC)
+find_program(VALGRIND_EXECUTABLE valgrind)
+if(VALGRIND_EXECUTABLE)
# Not running SIMD.* unit test cases for Valgrind
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)
+endif(VALGRIND_EXECUTABLE)
+if(NOT MSVC)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_test(NAME symbol_check
COMMAND sh -c "objdump -t -C libnamespacetest.a | grep rapidjson ; test $? -ne 0"

View File

@ -0,0 +1,21 @@
https://github.com/Tencent/rapidjson/issues/1808
--- a/test/unittest/CMakeLists.txt
+++ b/test/unittest/CMakeLists.txt
@@ -78,12 +78,15 @@
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
-if(NOT MSVC)
+find_program(VALGRIND_EXECUTABLE valgrind)
+if(VALGRIND_EXECUTABLE)
# Not running SIMD.* unit test cases for Valgrind
add_test(NAME valgrind_unittest
COMMAND valgrind --suppressions=${CMAKE_SOURCE_DIR}/test/valgrind.supp --leak-check=full --error-exitcode=1 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest --gtest_filter=-SIMD.*
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
+endif(VALGRIND_EXECUTABLE)
+if(NOT MSVC)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_test(NAME symbol_check
COMMAND sh -c "objdump -t -C libnamespacetest.a | grep rapidjson ; test $? -ne 0"

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>candrews@gentoo.org</email>
<name>Craig Andrews</name>
</maintainer>
<upstream>
<bugs-to>https://github.com/miloyip/rapidjson/issues</bugs-to>
<remote-id type="github">miloyip/rapidjson</remote-id>
</upstream>
</pkgmetadata>

View File

@ -0,0 +1,59 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake
DESCRIPTION="A fast JSON parser/generator for C++ with both SAX/DOM style API"
HOMEPAGE="https://rapidjson.org/"
if [[ ${PV} == *9999 ]] ; then
EGIT_REPO_URI="https://github.com/miloyip/rapidjson.git"
EGIT_SUBMODULES=()
inherit git-r3
else
SRC_URI="https://github.com/miloyip/rapidjson/archive/v${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="amd64 arm arm64 ~hppa ~loong ppc ppc64 ~riscv ~s390 ~sparc x86"
S="${WORKDIR}/rapidjson-${PV}"
fi
LICENSE="MIT"
SLOT="0"
IUSE="doc examples test"
RESTRICT="!test? ( test )"
BDEPEND="
doc? ( app-text/doxygen )
test? ( dev-cpp/gtest )
"
PATCHES=(
"${FILESDIR}/${P}-gcc-7.patch"
"${FILESDIR}/${P}-system_gtest.patch"
"${FILESDIR}/${P}-valgrind_optional.patch"
"${FILESDIR}/${P}-gcc14-const.patch"
)
src_prepare() {
cmake_src_prepare
sed -i -e 's| -march=native||g' CMakeLists.txt || die
sed -i -e 's| -Werror||g' CMakeLists.txt example/CMakeLists.txt test/unittest/CMakeLists.txt || die
}
src_configure() {
local mycmakeargs=(
-DDOC_INSTALL_DIR="${EPREFIX}/usr/share/doc/${PF}"
-DLIB_INSTALL_DIR="${EPREFIX}/usr/$(get_libdir)"
-DRAPIDJSON_BUILD_CXX11=OFF # latest gtest requires C++14 or later
-DRAPIDJSON_BUILD_DOC=$(usex doc)
-DRAPIDJSON_BUILD_EXAMPLES=$(usex examples)
-DRAPIDJSON_BUILD_TESTS=$(usex test)
-DRAPIDJSON_BUILD_THIRDPARTY_GTEST=OFF
)
use test && mycmakeargs+=(
-DVALGRIND_EXECUTABLE=
)
cmake_src_configure
}

View File

@ -0,0 +1,61 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake
DESCRIPTION="A fast JSON parser/generator for C++ with both SAX/DOM style API"
HOMEPAGE="https://rapidjson.org/"
if [[ ${PV} == *9999 ]] ; then
EGIT_REPO_URI="https://github.com/miloyip/rapidjson.git"
EGIT_SUBMODULES=()
inherit git-r3
else
SRC_URI="https://github.com/miloyip/rapidjson/archive/v${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="amd64 arm arm64 ~hppa ~loong ppc ppc64 ~riscv ~s390 ~sparc x86"
S="${WORKDIR}/rapidjson-${PV}"
fi
LICENSE="MIT"
SLOT="0"
IUSE="doc examples test"
RESTRICT="!test? ( test )"
BDEPEND="
doc? ( app-text/doxygen )
test? ( dev-cpp/gtest )
"
PATCHES=(
"${FILESDIR}/${P}-gcc-7.patch"
"${FILESDIR}/${P}-system_gtest.patch"
"${FILESDIR}/${P}-valgrind_optional.patch"
"${FILESDIR}/${P}-gcc14-const.patch"
"${FILESDIR}/${P}-cmake4.patch"
"${FILESDIR}/${P}-doc-build.patch"
)
src_prepare() {
cmake_src_prepare
sed -i -e 's| -march=native||g' CMakeLists.txt || die
sed -i -e 's| -Werror||g' CMakeLists.txt example/CMakeLists.txt test/unittest/CMakeLists.txt || die
}
src_configure() {
local mycmakeargs=(
-DDOC_INSTALL_DIR="${EPREFIX}/usr/share/doc/${PF}"
-DLIB_INSTALL_DIR="${EPREFIX}/usr/$(get_libdir)"
-DRAPIDJSON_BUILD_CXX11=OFF # latest gtest requires C++14 or later
-DRAPIDJSON_BUILD_DOC=$(usex doc)
-DRAPIDJSON_BUILD_EXAMPLES=$(usex examples)
-DRAPIDJSON_BUILD_TESTS=$(usex test)
-DRAPIDJSON_BUILD_THIRDPARTY_GTEST=OFF
)
use test && mycmakeargs+=(
-DVALGRIND_EXECUTABLE=
)
cmake_src_configure
}

View File

@ -0,0 +1,59 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake
DESCRIPTION="A fast JSON parser/generator for C++ with both SAX/DOM style API"
HOMEPAGE="https://rapidjson.org/"
if [[ ${PV} == *9999 ]] ; then
EGIT_REPO_URI="https://github.com/miloyip/rapidjson.git"
EGIT_SUBMODULES=()
inherit git-r3
else
SRC_URI="https://github.com/miloyip/rapidjson/archive/v${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86"
S="${WORKDIR}/rapidjson-${PV}"
fi
LICENSE="MIT"
SLOT="0"
IUSE="doc examples test"
RESTRICT="!test? ( test )"
BDEPEND="
doc? ( app-text/doxygen )
test? ( dev-cpp/gtest )
"
PATCHES=(
"${FILESDIR}/${PN}-1.1.0-system_gtest.patch"
"${FILESDIR}/${PN}-1.1.1-valgrind_optional.patch"
)
src_prepare() {
cmake_src_prepare
sed -i -e 's| -march=native||g' CMakeLists.txt || die
sed -i -e 's| -mcpu=native||g' CMakeLists.txt || die
sed -i -e 's| -Werror||g' CMakeLists.txt || die
}
src_configure() {
local mycmakeargs=(
-DDOC_INSTALL_DIR="${EPREFIX}/usr/share/doc/${PF}"
-DLIB_INSTALL_DIR="${EPREFIX}/usr/$(get_libdir)"
-DRAPIDJSON_BUILD_CXX11=OFF # latest gtest requires C++14 or later
-DRAPIDJSON_BUILD_CXX17=ON
-DRAPIDJSON_BUILD_DOC=$(usex doc)
-DRAPIDJSON_BUILD_EXAMPLES=$(usex examples)
-DRAPIDJSON_BUILD_TESTS=$(usex test)
-DRAPIDJSON_BUILD_THIRDPARTY_GTEST=OFF
)
use test && mycmakeargs+=(
-DVALGRIND_EXECUTABLE=
)
cmake_src_configure
}