From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1548279-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 6727E15800A
	for <garchives@archives.gentoo.org>; Mon, 21 Aug 2023 17:31:19 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 4174D2BC018;
	Mon, 21 Aug 2023 17:31:18 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 2851C2BC018
	for <gentoo-commits@lists.gentoo.org>; Mon, 21 Aug 2023 17:31:18 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 6DEE734122C
	for <gentoo-commits@lists.gentoo.org>; Mon, 21 Aug 2023 17:31:17 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id CD4A3FB0
	for <gentoo-commits@lists.gentoo.org>; Mon, 21 Aug 2023 17:31:15 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" <sam@gentoo.org>
Message-ID: <1692638953.1bb07c91ec18d88372147c4da436b7788ee84df6.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/protobuf/files/, dev-libs/protobuf/
X-VCS-Repository: repo/gentoo
X-VCS-Files: dev-libs/protobuf/Manifest dev-libs/protobuf/files/protobuf-23.3-disable-32-bit-tests.patch dev-libs/protobuf/files/protobuf-23.3-static_assert-failure.patch dev-libs/protobuf/protobuf-23.3.ebuild
X-VCS-Directories: dev-libs/protobuf/ dev-libs/protobuf/files/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 1bb07c91ec18d88372147c4da436b7788ee84df6
X-VCS-Branch: master
Date: Mon, 21 Aug 2023 17:31:15 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 9d378b84-70f2-41ab-91d2-38e0ab75edae
X-Archives-Hash: 8cd0a9468b3e2458af177ffce445e53f

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
+}