diff options
Diffstat (limited to 'dev-cpp/nlohmann_json')
-rw-r--r-- | dev-cpp/nlohmann_json/Manifest | 2 | ||||
-rw-r--r-- | dev-cpp/nlohmann_json/files/nlohmann_json-3.11.2-gcc13.patch | 76 | ||||
-rw-r--r-- | dev-cpp/nlohmann_json/nlohmann_json-3.11.2-r1.ebuild | 69 |
3 files changed, 147 insertions, 0 deletions
diff --git a/dev-cpp/nlohmann_json/Manifest b/dev-cpp/nlohmann_json/Manifest index ecd394065203..c3de3bdfb05a 100644 --- a/dev-cpp/nlohmann_json/Manifest +++ b/dev-cpp/nlohmann_json/Manifest @@ -1,4 +1,6 @@ +AUX nlohmann_json-3.11.2-gcc13.patch 3812 BLAKE2B 2c88e14333ddf47df921c0dd1bc250e478a08e3f59bfcc733dbd95f9209fe1cbd3f735f31844d2b80cef86da32694f993d348e45a0494c9e9d607ba62b83a46f SHA512 8a99f0b18efa8d2f5f6e5cca52e59b28012d5e10ea09f641b21abff3785058191ece7a6bd18d9cdc69d8ce1f12beb7d4f59301277636889b8250011ad2127087 DIST nlohmann_json-3.11.2.tar.gz 8097673 BLAKE2B ebb67966739a330e0cfb8495a6eb58e87732655856a6d4e843072ed5e485cafbb8a75d8803859d0365b814deda7429448ecc473de414de4b23d3a3c455dc2511 SHA512 70097c9bcd7a91254acbd41b8b68a6aaa371fc2dd7011f472917f69f1e2d2986155a0339dad791699d542e4a3be44dc49ae72ff73d0ee0ea4b34183296ce19a0 DIST nlohmann_json-testdata-3.1.0.tar.gz 115036393 BLAKE2B 809be0728a0b9d007fcc752911bdf6f7e548d6e3ec59871ea2b16d87d8248ca4dd2f681a1d0f82c618463294188ad41d6d965b8bdc39c70fdcf4b939d4121e9c SHA512 db6c411b37f2154f5dd1ed90f4e8fa0907f4a736cd0ff79943bcacf9da422285ff142bb6a7dc6022b236090083166ac1ab197be3f480d8dc50b26a91a9477821 +EBUILD nlohmann_json-3.11.2-r1.ebuild 2026 BLAKE2B 79f75c27598bb18e23487893ee68bcb88e975196ee9b4e80e3ce3259ba7fdb0e7d5a0373a0f285fdbd4dc9fa57708ee174f3505c3ba44e77b5fa8c215177141a SHA512 dd4b506d1e6b438a9b59e8d0ddfc3e94c2c97043659b0c7947528b64c89469ecdd2be7604aeb0ae5d2b6f09cb17e3f5c85de96d3b21c69a1056132ab9c020d0a EBUILD nlohmann_json-3.11.2.ebuild 1968 BLAKE2B 0189ac08dad78df6b312780263ef313d6e50cf2687a8b54b68f42289e20bed3e7d7be4778568dd43676fd8baa608b179582656448e71a01826e2ea661cc16752 SHA512 0e6d817be5007b7d82b419cbc1b2a30188e9384d230d1ceb73ca067c63db8ec3f04630cde569466ed3509002c07c9849a14d2e940e58d6b2d59d31de0d1a409d MISC metadata.xml 338 BLAKE2B c5eb95ba7048308eab4753ea01c015781ce85db42d2e50f8ed9e3f7fb6945cfb8b90f5b3216799ad53137ceef6eae4636eea482e86206b19589ddf2e42caaaa1 SHA512 4198102ff79678a8e9be9146fc97991b1b205be3d34ebaece3dcab46a36ee5af904f463fcd0dc2a88fb362aa7a81e8d713af7b55db594a7069efc0276c94ff49 diff --git a/dev-cpp/nlohmann_json/files/nlohmann_json-3.11.2-gcc13.patch b/dev-cpp/nlohmann_json/files/nlohmann_json-3.11.2-gcc13.patch new file mode 100644 index 000000000000..5205e67a3c2c --- /dev/null +++ b/dev-cpp/nlohmann_json/files/nlohmann_json-3.11.2-gcc13.patch @@ -0,0 +1,76 @@ +https://github.com/nlohmann/json/issues/3927 +https://github.com/nlohmann/json/pull/3895 + +From a5b09d50b786638ed9deb09ef13860a3cb64eb6b Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich <slyich@gmail.com> +Date: Tue, 20 Dec 2022 22:08:12 +0000 +Subject: [PATCH] custom allocators: define missing 'rebind' type + +`gcc-13` added an assert to standard headers to make sure custom +allocators have intended implementation of rebind type instead +of inherited rebind. gcc change: + https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=64c986b49558a7 + +Without the fix build fails on this week's `gcc-13` as: + + In file included from <<NIX>>-gcc-13.0.0/include/c++/13.0.0/ext/alloc_traits.h:34, + from <<NIX>>-gcc-13.0.0/include/c++/13.0.0/bits/basic_string.h:39, + from <<NIX>>-gcc-13.0.0/include/c++/13.0.0/string:54, + from <<NIX>>-gcc-13.0.0/include/c++/13.0.0/bits/locale_classes.h:40, + from <<NIX>>-gcc-13.0.0/include/c++/13.0.0/locale:41, + from tests/src/unit-regression2.cpp:19: + <<NIX>>-gcc-13.0.0/include/c++/13.0.0/bits/alloc_traits.h: In instantiation of 'struct std::__allocator_traits_base::__rebind<my_allocator<unsigned char>, unsigned char, void>': + <<NIX>>-gcc-13.0.0/include/c++/13.0.0/bits/alloc_traits.h:94:11: required by substitution of 'template<class _Alloc, class _Up> using std::__alloc_rebind = typename std::__allocator_traits_base::__rebind<_Alloc, _Up>::type [with _Alloc = my_allocator<unsigned char>; _Up = unsigned char]' + <<NIX>>-gcc-13.0.0/include/c++/13.0.0/bits/alloc_traits.h:228:8: required by substitution of 'template<class _Alloc> template<class _Tp> using std::allocator_traits< <template-parameter-1-1> >::rebind_alloc = std::__alloc_rebind<_Alloc, _Tp> [with _Tp = unsigned char; _Alloc = my_allocator<unsigned char>]' + <<NIX>>-gcc-13.0.0/include/c++/13.0.0/ext/alloc_traits.h:126:65: required from 'struct __gnu_cxx::__alloc_traits<my_allocator<unsigned char>, unsigned char>::rebind<unsigned char>' + <<NIX>>-gcc-13.0.0/include/c++/13.0.0/bits/stl_vector.h:88:21: required from 'struct std::_Vector_base<unsigned char, my_allocator<unsigned char> >' + <<NIX>>-gcc-13.0.0/include/c++/13.0.0/bits/stl_vector.h:423:11: required from 'class std::vector<unsigned char, my_allocator<unsigned char> >' + tests/src/unit-regression2.cpp:807:63: required from here + <<NIX>>-gcc-13.0.0/include/c++/13.0.0/bits/alloc_traits.h:70:31: error: static assertion failed: allocator_traits<A>::rebind_alloc<A::value_type> must be A + 70 | _Tp>::value, + | ^~~~~ + +The change adds trivial `rebind` definition with expected return type +and satisfies conversion requirements. +--- a/tests/src/unit-allocator.cpp ++++ b/tests/src/unit-allocator.cpp +@@ -20,11 +20,20 @@ struct bad_allocator : std::allocator<T> + { + using std::allocator<T>::allocator; + ++ bad_allocator() = default; ++ template<class U> bad_allocator(const bad_allocator<U>& /*unused*/) { } ++ + template<class... Args> + void construct(T* /*unused*/, Args&& ... /*unused*/) + { + throw std::bad_alloc(); + } ++ ++ template <class U> ++ struct rebind ++ { ++ using other = bad_allocator<U>; ++ }; + }; + } // namespace + +--- a/tests/src/unit-regression2.cpp ++++ b/tests/src/unit-regression2.cpp +@@ -187,6 +187,15 @@ class my_allocator : public std::allocator<T> + { + public: + using std::allocator<T>::allocator; ++ ++ my_allocator() = default; ++ template<class U> my_allocator(const my_allocator<U>& /*unused*/) { } ++ ++ template <class U> ++ struct rebind ++ { ++ using other = my_allocator<U>; ++ }; + }; + + ///////////////////////////////////////////////////////////////////// + diff --git a/dev-cpp/nlohmann_json/nlohmann_json-3.11.2-r1.ebuild b/dev-cpp/nlohmann_json/nlohmann_json-3.11.2-r1.ebuild new file mode 100644 index 000000000000..a3d79580696a --- /dev/null +++ b/dev-cpp/nlohmann_json/nlohmann_json-3.11.2-r1.ebuild @@ -0,0 +1,69 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +#DOCS_BUILDER="mkdocs" +# Needs unpackaged plantuml-markdown too +# ... but plantuml (Python bindings anyway) need network access to generate bits at runtime. +#DOCS_DEPEND="dev-python/mkdocs-material-extensions dev-python/mkdocs-minify-plugin" +#DOCS_DIR="doc/mkdocs" +inherit cmake + +# Check https://github.com/nlohmann/json/blob/develop/cmake/download_test_data.cmake to find test archive version +TEST_VERSION="3.1.0" +DESCRIPTION="JSON for Modern C++" +HOMEPAGE="https://github.com/nlohmann/json https://nlohmann.github.io/json/" +SRC_URI=" + https://github.com/nlohmann/json/archive/v${PV}.tar.gz -> ${P}.tar.gz + test? ( https://github.com/nlohmann/json_test_data/archive/v${TEST_VERSION}.tar.gz -> ${PN}-testdata-${TEST_VERSION}.tar.gz )" +S="${WORKDIR}/json-${PV}" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86" +IUSE="test" +RESTRICT="!test? ( test )" + +DOCS=( ChangeLog.md README.md ) + +PATCHES=( + "${FILESDIR}"/${PN}-3.11.2-gcc13.patch +) + +src_prepare() { + if use test ; then + ln -s "${WORKDIR}"/json_test_data-${TEST_VERSION} "${S}"/json_test_data || die + fi + + cmake_src_prepare +} + +src_configure() { + # Tests are built by default so we can't group the test logic below + local mycmakeargs=( + -DJSON_MultipleHeaders=ON + -DJSON_BuildTests=$(usex test) + ) + + # Define test data directory here to avoid unused var QA warning, bug #747826 + use test && mycmakeargs+=( -DJSON_TestDataDirectory="${S}"/json_test_data ) + + cmake_src_configure +} + +src_test() { + cd "${BUILD_DIR}"/tests || die + + # git_required: + # Skip certain tests needing git per upstream + # https://github.com/nlohmann/json/issues/2189 + # + # cmake_fetch_content_configure, cmake_fetch_content2_configure: + # Needs network (bug #865027, bug #865105) + local myctestargs=( + -E "(git_required|cmake_fetch_content_configure|cmake_fetch_content2_configure|cmake_fetch_content_build|cmake_fetch_content2_build)" + ) + + cmake_src_test +} |