commit:     1bb07c91ec18d88372147c4da436b7788ee84df6
Author:     Mark Conway <mark.conway <AT> themobiusproject <DOT> com>
AuthorDate: Mon Jun 26 00:46:57 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug 21 17:29:13 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1bb07c91

dev-libs/protobuf: version bump to 23.3

Upstream's versioning has change which messes with slot numbers.

Closes: https://bugs.gentoo.org/906811
Signed-off-by: Mark Conway <mark.conway <AT> themobiusproject.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/protobuf/Manifest                         |   1 +
 .../files/protobuf-23.3-disable-32-bit-tests.patch |  34 +++++++
 .../protobuf-23.3-static_assert-failure.patch      |  11 +++
 dev-libs/protobuf/protobuf-23.3.ebuild             | 107 +++++++++++++++++++++
 4 files changed, 153 insertions(+)

diff --git a/dev-libs/protobuf/Manifest b/dev-libs/protobuf/Manifest
index 85bcbb4bda71..54444c1352c6 100644
--- a/dev-libs/protobuf/Manifest
+++ b/dev-libs/protobuf/Manifest
@@ -1 +1,2 @@
 DIST protobuf-21.9.tar.gz 5110670 BLAKE2B 
a4f5b7f58e1c5904ca990b100a72992f6f56177b28773f8de8c99e4158391d33cfb8aa8575915887fc9ae4294faf81d4ff6b470bc07b394bfd5885a09ba0fafe
 SHA512 
6954b42d21921e630173b7848c056ab95635627d8eddec960f3db2ddda13eedde00520a9b350722e76e2998649eb8ebe10758e1db938b6a91e38ff3295b1b7c1
+DIST protobuf-23.3.tar.gz 5043803 BLAKE2B 
ee2edee230969555c9ef95069c7b1d6c23c3d1f8ea1b2249fb3e9f6fcf63312c6e10e9da65b80629fb08d5fb08d05a19bb9c752c25b892c1e3fd6f18b9279eb3
 SHA512 
646af367dbc61b42e322cf0b335f360e428b272e2b1f5361b2f17c18d3dc9dddd615e1279436028b1a42275a0beadda37c2c934fc27d6c892131cc8d526d8b3b

diff --git a/dev-libs/protobuf/files/protobuf-23.3-disable-32-bit-tests.patch 
b/dev-libs/protobuf/files/protobuf-23.3-disable-32-bit-tests.patch
new file mode 100644
index 000000000000..1e49bc981d8e
--- /dev/null
+++ b/dev-libs/protobuf/files/protobuf-23.3-disable-32-bit-tests.patch
@@ -0,0 +1,34 @@
+https://github.com/protocolbuffers/protobuf/issues/8460
+--- a/src/google/protobuf/any_test.cc
++++ b/src/google/protobuf/any_test.cc
+@@ -63,6 +63,8 @@ TEST(AnyTest, TestPackAndUnpack) {
+ }
+ 
+ TEST(AnyTest, TestPackFromSerializationExceedsSizeLimit) {
++  // 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/files/protobuf-23.3-static_assert-failure.patch 
b/dev-libs/protobuf/files/protobuf-23.3-static_assert-failure.patch
new file mode 100644
index 000000000000..53ca65814251
--- /dev/null
+++ b/dev-libs/protobuf/files/protobuf-23.3-static_assert-failure.patch
@@ -0,0 +1,11 @@
+https://github.com/protocolbuffers/protobuf/issues/9433
+--- a/src/google/protobuf/descriptor.cc
++++ b/src/google/protobuf/descriptor.cc
+@@ -384,7 +384,6 @@ class FlatAllocatorImpl {
+     ABSL_CHECK(!has_allocated());
+     if (std::is_trivially_destructible<U>::value) {
+       // Trivial types are aligned to 8 bytes.
+-      static_assert(alignof(U) <= 8, "");
+       total_.template Get<char>() += RoundUpTo<8>(array_size * sizeof(U));
+     } else {
+       // Since we can't use `if constexpr`, just make the expression compile

diff --git a/dev-libs/protobuf/protobuf-23.3.ebuild 
b/dev-libs/protobuf/protobuf-23.3.ebuild
new file mode 100644
index 000000000000..d4664ca777c0
--- /dev/null
+++ b/dev-libs/protobuf/protobuf-23.3.ebuild
@@ -0,0 +1,107 @@
+# Copyright 2008-2023 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 ~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)"
+IUSE="emacs examples test zlib"
+RESTRICT="!test? ( test )"
+
+BDEPEND="emacs? ( app-editors/emacs:* )"
+DEPEND="
+       dev-cpp/abseil-cpp:=[${MULTILIB_USEDEP}]
+       zlib? ( sys-libs/zlib[${MULTILIB_USEDEP}] )
+       test? ( >=dev-cpp/gtest-1.9[${MULTILIB_USEDEP}] )
+"
+RDEPEND="
+       emacs? ( app-editors/emacs:* )
+       zlib? ( sys-libs/zlib[${MULTILIB_USEDEP}] )
+"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-23.3-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