dev-libs/protobuf: Sync with Gentoo

It's from Gentoo commit 79bf402140741157a301a70ef9f89fecdbd646e7.
This commit is contained in:
Flatcar Buildbot 2023-09-04 07:10:30 +00:00 committed by Krzesimir Nowak
parent 65f5b26219
commit 2acb0ac1d1
5 changed files with 260 additions and 0 deletions

View File

@ -1 +1,3 @@
DIST protobuf-21.12.tar.gz 5141166 BLAKE2B 33500612d103afb817062486a741e8e5503f82c42c70054d47d1899e6bb79f3fdde2666cad5b8eff6e1bc539c3b0cdf9f2b125ce7e5d3a459a69e84d67ab535e SHA512 2dc8f552388438268d8b9f7a9e84c6abf1736be3d5031438c789c317410c9f4b5cedd25bf7da6d67b3ba32ca890869f9ddaab2284d6ac0e734a5b135ffbb1346
DIST protobuf-21.9.tar.gz 5110670 BLAKE2B a4f5b7f58e1c5904ca990b100a72992f6f56177b28773f8de8c99e4158391d33cfb8aa8575915887fc9ae4294faf81d4ff6b470bc07b394bfd5885a09ba0fafe SHA512 6954b42d21921e630173b7848c056ab95635627d8eddec960f3db2ddda13eedde00520a9b350722e76e2998649eb8ebe10758e1db938b6a91e38ff3295b1b7c1
DIST protobuf-23.3.tar.gz 5043803 BLAKE2B ee2edee230969555c9ef95069c7b1d6c23c3d1f8ea1b2249fb3e9f6fcf63312c6e10e9da65b80629fb08d5fb08d05a19bb9c752c25b892c1e3fd6f18b9279eb3 SHA512 646af367dbc61b42e322cf0b335f360e428b272e2b1f5361b2f17c18d3dc9dddd615e1279436028b1a42275a0beadda37c2c934fc27d6c892131cc8d526d8b3b

View File

@ -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;

View File

@ -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

View File

@ -0,0 +1,105 @@
# 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/3.$(ver_cut 1-2).0"
IUSE="emacs examples test zlib"
RESTRICT="!test? ( test )"
BDEPEND="emacs? ( app-editors/emacs:* )"
DEPEND="
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)
)
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
}

View File

@ -0,0 +1,108 @@
# 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).0"
IUSE="emacs examples test zlib"
RESTRICT="!test? ( test )"
BDEPEND="emacs? ( app-editors/emacs:* )"
DEPEND="
>=dev-cpp/abseil-cpp-20230125.3:=[${MULTILIB_USEDEP}]
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}/${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
}