From 2479cd95a6561a795f66fff8265d5d3331ecb8c0 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Tue, 6 Jan 2026 11:41:06 +0000 Subject: [PATCH] dev-libs/rapidjson: Import from Gentoo to build sys-fs/overlaybd offline Signed-off-by: James Le Cuirot --- .../workflows/portage-stable-packages-list | 1 + .../dev-libs/rapidjson/Manifest | 1 + .../files/rapidjson-1.1.0-cmake4.patch | 19 ++++++ .../files/rapidjson-1.1.0-doc-build.patch | 41 +++++++++++++ .../files/rapidjson-1.1.0-gcc-7.patch | 46 ++++++++++++++ .../files/rapidjson-1.1.0-gcc14-const.patch | 20 ++++++ .../files/rapidjson-1.1.0-system_gtest.patch | 44 +++++++++++++ .../rapidjson-1.1.0-valgrind_optional.patch | 21 +++++++ .../rapidjson-1.1.1-valgrind_optional.patch | 21 +++++++ .../dev-libs/rapidjson/metadata.xml | 12 ++++ .../rapidjson/rapidjson-1.1.0-r4.ebuild | 59 ++++++++++++++++++ .../rapidjson/rapidjson-1.1.0-r5.ebuild | 61 +++++++++++++++++++ .../dev-libs/rapidjson/rapidjson-9999.ebuild | 59 ++++++++++++++++++ 13 files changed, 405 insertions(+) create mode 100644 sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/Manifest create mode 100644 sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-cmake4.patch create mode 100644 sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-doc-build.patch create mode 100644 sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-gcc-7.patch create mode 100644 sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-gcc14-const.patch create mode 100644 sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-system_gtest.patch create mode 100644 sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-valgrind_optional.patch create mode 100644 sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.1-valgrind_optional.patch create mode 100644 sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/metadata.xml create mode 100644 sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/rapidjson-1.1.0-r4.ebuild create mode 100644 sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/rapidjson-1.1.0-r5.ebuild create mode 100644 sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/rapidjson-9999.ebuild diff --git a/.github/workflows/portage-stable-packages-list b/.github/workflows/portage-stable-packages-list index ac9d6f8e2c..35786e26e3 100644 --- a/.github/workflows/portage-stable-packages-list +++ b/.github/workflows/portage-stable-packages-list @@ -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 diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/Manifest b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/Manifest new file mode 100644 index 0000000000..b922188e51 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/Manifest @@ -0,0 +1 @@ +DIST rapidjson-1.1.0.tar.gz 1019402 BLAKE2B e1564b3cfa020f76437b0a35048a42ff2cd98b5ce285e63f228e158885182e5cecda13407cdf30c03fa39b47cbc579ff0065f6c2682d04b806e8f9ea8d36fc4e SHA512 2e82a4bddcd6c4669541f5945c2d240fb1b4fdd6e239200246d3dd50ce98733f0a4f6d3daa56f865d8c88779c036099c52a9ae85d47ad263686b68a88d832dff diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-cmake4.patch b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-cmake4.patch new file mode 100644 index 0000000000..dc28481a23 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-cmake4.patch @@ -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) diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-doc-build.patch b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-doc-build.patch new file mode 100644 index 0000000000..6e5f70c72c --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-doc-build.patch @@ -0,0 +1,41 @@ +https://github.com/Tencent/rapidjson/commit/bbdf5d1d4b40891c82e5c1946d32dfc841926066 + +From bbdf5d1d4b40891c82e5c1946d32dfc841926066 Mon Sep 17 00:00:00 2001 +From: Christopher Warrington +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 + diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-gcc-7.patch b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-gcc-7.patch new file mode 100644 index 0000000000..925d175a89 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-gcc-7.patch @@ -0,0 +1,46 @@ +From fe19b7b6016d446722621fb407738209d1a911e8 Mon Sep 17 00:00:00 2001 +From: Harry Wong +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 +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 diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-gcc14-const.patch b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-gcc14-const.patch new file mode 100644 index 0000000000..0bc9e73b56 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-gcc14-const.patch @@ -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 +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; } + diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-system_gtest.patch b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-system_gtest.patch new file mode 100644 index 0000000000..a952a076dc --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-system_gtest.patch @@ -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) diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-valgrind_optional.patch b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-valgrind_optional.patch new file mode 100644 index 0000000000..772eabe8c6 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.0-valgrind_optional.patch @@ -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" diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.1-valgrind_optional.patch b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.1-valgrind_optional.patch new file mode 100644 index 0000000000..e05c280008 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/files/rapidjson-1.1.1-valgrind_optional.patch @@ -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" diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/metadata.xml b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/metadata.xml new file mode 100644 index 0000000000..a3be7bec65 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/metadata.xml @@ -0,0 +1,12 @@ + + + + + candrews@gentoo.org + Craig Andrews + + + https://github.com/miloyip/rapidjson/issues + miloyip/rapidjson + + diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/rapidjson-1.1.0-r4.ebuild b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/rapidjson-1.1.0-r4.ebuild new file mode 100644 index 0000000000..e2df1e4023 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/rapidjson-1.1.0-r4.ebuild @@ -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 +} diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/rapidjson-1.1.0-r5.ebuild b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/rapidjson-1.1.0-r5.ebuild new file mode 100644 index 0000000000..75d7d6cc09 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/rapidjson-1.1.0-r5.ebuild @@ -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 +} diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/rapidjson-9999.ebuild b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/rapidjson-9999.ebuild new file mode 100644 index 0000000000..b98b72a191 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/rapidjson/rapidjson-9999.ebuild @@ -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 +}