commit:     1324b66184a067dccbd068191012fd79e38a9ad5
Author:     Aliaksei Urbanski <aliaksei.urbanski <AT> gmail <DOT> com>
AuthorDate: Wed Apr 10 10:07:04 2024 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Mon May 27 16:04:56 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1324b661

dev-libs/protobuf: add 26.1

Release:
  - https://github.com/protocolbuffers/protobuf/releases/tag/v26.1

Bug: https://bugs.gentoo.org/915325
Signed-off-by: Aliaksei Urbanski <aliaksei.urbanski <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/36192
Closes: https://bugs.gentoo.org/932848
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 dev-libs/protobuf/Manifest                         |   1 +
 .../files/protobuf-26.1-disable-32-bit-tests.patch |  37 +++++++
 dev-libs/protobuf/protobuf-26.1.ebuild             | 108 +++++++++++++++++++++
 3 files changed, 146 insertions(+)

diff --git a/dev-libs/protobuf/Manifest b/dev-libs/protobuf/Manifest
index 8695f23be04a..491e8fa19f28 100644
--- a/dev-libs/protobuf/Manifest
+++ b/dev-libs/protobuf/Manifest
@@ -2,3 +2,4 @@ DIST protobuf-21.12.tar.gz 5141166 BLAKE2B 
33500612d103afb817062486a741e8e5503f8
 DIST protobuf-21.9.tar.gz 5110670 BLAKE2B 
a4f5b7f58e1c5904ca990b100a72992f6f56177b28773f8de8c99e4158391d33cfb8aa8575915887fc9ae4294faf81d4ff6b470bc07b394bfd5885a09ba0fafe
 SHA512 
6954b42d21921e630173b7848c056ab95635627d8eddec960f3db2ddda13eedde00520a9b350722e76e2998649eb8ebe10758e1db938b6a91e38ff3295b1b7c1
 DIST protobuf-22.5.tar.gz 4924661 BLAKE2B 
d69c73f4ebfddf45fd94b4f5f898faf00256fe674f2cbc0443c60a88d7a0f47fb96f2f6262879927c6da88095b4ea3ee7fd4c471c100bf42a2bae9edf48c07f1
 SHA512 
058ab2fec5b11007972e6043071056d1944c3b6fe1d31246cddba8eb57686e3b5280f6ad3d58e78940ca63005e74a8de3c72237f9f7c5066548c5a2513ddc584
 DIST protobuf-23.3.tar.gz 5043803 BLAKE2B 
ee2edee230969555c9ef95069c7b1d6c23c3d1f8ea1b2249fb3e9f6fcf63312c6e10e9da65b80629fb08d5fb08d05a19bb9c752c25b892c1e3fd6f18b9279eb3
 SHA512 
646af367dbc61b42e322cf0b335f360e428b272e2b1f5361b2f17c18d3dc9dddd615e1279436028b1a42275a0beadda37c2c934fc27d6c892131cc8d526d8b3b
+DIST protobuf-26.1.tar.gz 5957903 BLAKE2B 
1a7faab2f56aa0995801a80f73a812c7fc38a00af0bf25bdd5eecf7aec27a86a575ea2fb8484787d19c9ac6e46007c9864e79464f529c446f31af732981feed1
 SHA512 
0363ac09f92d8e040491425d444c8dca0b9b430e02d2dff6e2b28a0c2b2bea0d33a47f50bc9e2e2d4e8e22b65a02009a20c0066fb89c75df93a7b703dda42ed4

diff --git a/dev-libs/protobuf/files/protobuf-26.1-disable-32-bit-tests.patch 
b/dev-libs/protobuf/files/protobuf-26.1-disable-32-bit-tests.patch
new file mode 100644
index 000000000000..dfbda168d58e
--- /dev/null
+++ b/dev-libs/protobuf/files/protobuf-26.1-disable-32-bit-tests.patch
@@ -0,0 +1,37 @@
+https://github.com/protocolbuffers/protobuf/issues/8460
+--- a/src/google/protobuf/any_test.cc
++++ b/src/google/protobuf/any_test.cc
+@@ -40,9 +40,8 @@ TEST(AnyTest, TestPackAndUnpack) {
+ }
+ 
+ TEST(AnyTest, TestPackFromSerializationExceedsSizeLimit) {
+-#if defined(_MSC_VER) && defined(_M_IX86)
+-  GTEST_SKIP() << "This toolchain can't allocate that much memory.";
+-#endif
++  // Filter out this test on 32-bit architectures.
++  if(sizeof(void*) < 8) return;
+   protobuf_unittest::TestAny submessage;
+   submessage.mutable_text()->resize(INT_MAX, 'a');
+   protobuf_unittest::TestAny message;
+
+https://github.com/protocolbuffers/protobuf/issues/8459
+--- a/src/google/protobuf/arena_unittest.cc
++++ b/src/google/protobuf/arena_unittest.cc
+@@ -1373,6 +1373,8 @@ TEST(ArenaTest, MessageLiteOnArena) {
+ uint64_t Align8(uint64_t n) { return (n + 7) & -8; }
+ 
+ TEST(ArenaTest, SpaceAllocated_and_Used) {
++  // Filter out this test on 32-bit architectures.
++  if(sizeof(void*) < 8) return;
+   Arena arena_1;
+   EXPECT_EQ(0, arena_1.SpaceAllocated());
+   EXPECT_EQ(0, arena_1.SpaceUsed());
+@@ -1453,6 +1455,8 @@ TEST(ArenaTest, Alignment) {
+ }
+ 
+ TEST(ArenaTest, BlockSizeSmallerThanAllocation) {
++  // Filter out this test on 32-bit architectures.
++  if(sizeof(void*) < 8) return;
+   for (size_t i = 0; i <= 8; ++i) {
+     ArenaOptions opt;
+     opt.start_block_size = opt.max_block_size = i;

diff --git a/dev-libs/protobuf/protobuf-26.1.ebuild 
b/dev-libs/protobuf/protobuf-26.1.ebuild
new file mode 100644
index 000000000000..8b99e882da51
--- /dev/null
+++ b/dev-libs/protobuf/protobuf-26.1.ebuild
@@ -0,0 +1,108 @@
+# Copyright 2008-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake-multilib elisp-common toolchain-funcs
+
+if [[ "${PV}" == *9999 ]]; then
+       inherit git-r3
+
+       EGIT_REPO_URI="https://github.com/protocolbuffers/protobuf.git";
+       EGIT_SUBMODULES=()
+else
+       
SRC_URI="https://github.com/protocolbuffers/protobuf/archive/v${PV}.tar.gz -> 
${P}.tar.gz"
+       KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~loong ~mips ~ppc64 ~riscv ~sparc 
~x86 ~amd64-linux ~x86-linux ~x64-macos"
+fi
+
+DESCRIPTION="Google's Protocol Buffers - Extensible mechanism for serializing 
structured data"
+HOMEPAGE="https://protobuf.dev/";
+
+LICENSE="BSD"
+SLOT="0/$(ver_cut 1-2).0"
+IUSE="emacs examples test zlib"
+RESTRICT="!test? ( test )"
+
+BDEPEND="emacs? ( app-editors/emacs:* )"
+DEPEND="
+       >=dev-cpp/abseil-cpp-20230125.3:=[${MULTILIB_USEDEP},test?]
+       zlib? ( sys-libs/zlib[${MULTILIB_USEDEP}] )
+       test? ( >=dev-cpp/gtest-1.9[${MULTILIB_USEDEP}] )
+"
+RDEPEND="
+       >=dev-cpp/abseil-cpp-20230125.3:=[${MULTILIB_USEDEP}]
+       emacs? ( app-editors/emacs:* )
+       zlib? ( sys-libs/zlib[${MULTILIB_USEDEP}] )
+"
+
+PATCHES=(
+       "${FILESDIR}/${P}-disable-32-bit-tests.patch"
+       "${FILESDIR}/${PN}-23.3-static_assert-failure.patch"
+)
+
+DOCS=( CONTRIBUTORS.txt README.md )
+
+src_configure() {
+       if tc-ld-is-gold; then
+               # https://sourceware.org/bugzilla/show_bug.cgi?id=24527
+               tc-ld-disable-gold
+       fi
+
+       cmake-multilib_src_configure
+}
+
+multilib_src_configure() {
+       local mycmakeargs=(
+               -Dprotobuf_DISABLE_RTTI=ON
+               -Dprotobuf_BUILD_EXAMPLES=$(usex examples)
+               -Dprotobuf_WITH_ZLIB=$(usex zlib)
+               -Dprotobuf_BUILD_TESTS=$(usex test)
+               -Dprotobuf_ABSL_PROVIDER=package
+       )
+       use test && mycmakeargs+=(-Dprotobuf_USE_EXTERNAL_GTEST=ON)
+
+       cmake_src_configure
+}
+
+src_compile() {
+       cmake-multilib_src_compile
+
+       if use emacs; then
+               elisp-compile editors/protobuf-mode.el
+       fi
+}
+
+multilib_src_install_all() {
+       find "${ED}" -name "*.la" -delete || die
+
+       if [[ ! -f "${ED}/usr/$(get_libdir)/libprotobuf.so.${SLOT#*/}" ]]; then
+               eerror "No matching library found with SLOT variable, currently 
set: ${SLOT}\n" \
+                       "Expected value: 
${ED}/usr/$(get_libdir)/libprotobuf.so.${SLOT#*/}"
+               die "Please update SLOT variable"
+       fi
+
+       insinto /usr/share/vim/vimfiles/syntax
+       doins editors/proto.vim
+       insinto /usr/share/vim/vimfiles/ftdetect
+       doins "${FILESDIR}/proto.vim"
+
+       if use emacs; then
+               elisp-install ${PN} editors/protobuf-mode.el*
+               elisp-site-file-install "${FILESDIR}/70${PN}-gentoo.el"
+       fi
+
+       if use examples; then
+               DOCS+=(examples)
+               docompress -x /usr/share/doc/${PF}/examples
+       fi
+
+       einstalldocs
+}
+
+pkg_postinst() {
+       use emacs && elisp-site-regen
+}
+
+pkg_postrm() {
+       use emacs && elisp-site-regen
+}

Reply via email to