dev-libs/protobuf: Sync with Gentoo

It's from Gentoo commit 2d25fad95cbaa525c8945d8e582c749d49524f49.

Signed-off-by: Flatcar Buildbot <buildbot@flatcar-linux.org>
This commit is contained in:
Flatcar Buildbot 2026-02-02 07:25:52 +00:00
parent 2699ce7932
commit 2797ade7d8
11 changed files with 210 additions and 9 deletions

View File

@ -6,3 +6,4 @@ DIST protobuf-30.2.tar.gz 9506934 BLAKE2B 3a7d6bfa38500b16b1ce52b244fd9448fe7be2
DIST protobuf-31.1.tar.gz 9583956 BLAKE2B cd15fc6d25bee71681602cf97c19dc04de9900594b0c0648decf418bdcc0cf787315b2238c18cb0b1eaf7b163ddbbfb7853cc5cff635b4841fcb8b20d94825fd SHA512 5bf730e37183defcb29cf4831128f536ad8bcdce2b2b46b297d95f3de4a037b9ff3b6c57df66a039256dcefd828ba9d43c32b01a7a82aa5c881a9ae12cadb643
DIST protobuf-32.1.tar.gz 9676391 BLAKE2B f6c1faa260ecb57c0a1a5d4be7d56e431cac9e325a02b86d9eecd0318a0964618063db218a4720fcb1121614016f112ba00880a5b743a5c34f19f79ea4420735 SHA512 e7f8fe01912ba30cc7ce101beac1cfbd089bcb57b159a57d4d90cabd1b29d978ad322f0607e1b955617f035a6b68d4e7bc940fa4afa67d255a21f513a2c62172
DIST protobuf-33.0.tar.gz 6872665 BLAKE2B 5d456c000117b590dea5b7e721a8b8d00d9e7067ba2156f082e4959a17fcf8d4f2e306f90335aad97e1a94dfd2491544d67cb29670f0022034fde574140a8066 SHA512 2956270a81631895ab6ed8c3c2a22b353a461b0827ee17a1c569b24374307a8e2525a06db6728140bff759a40e47a1d2a291cfb34293b364fe279f10468f3cb9
DIST protobuf-33.1.tar.gz 6865436 BLAKE2B 101bf4a67fe0d08ab5f6b3c984193e8b031c521b374bd1bc134f9c2df90f995af73c7689de03d3b4b2d8ce77fc94392fc552942d158df9d2c65ce3e74ac47d0a SHA512 c0b8bd54fe7bd287b2225c3e50e995bc0160d7c0a7712fd047325361613ffb917f4ab838933b1505b07d404e1adb80ea681503bdfc83ce9846d03f5539b481be

View File

@ -12,7 +12,7 @@ if [[ "${PV}" == *9999 ]]; then
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"
KEYWORDS="~alpha amd64 arm arm64 ~loong ~mips ppc64 ~riscv x86 ~x64-macos"
fi
DESCRIPTION="Google's Protocol Buffers - Extensible mechanism for serializing structured data"

View File

@ -19,7 +19,7 @@ if [[ "${PV}" == *9999 ]]; then
inherit git-r3
else
SRC_URI="https://github.com/protocolbuffers/protobuf/releases/download/v${PV}/${P}.tar.gz"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~x64-macos"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~arm64-macos ~x64-macos"
SLOT="0/$(ver_cut 1-2).0"
fi

View File

@ -19,7 +19,7 @@ if [[ "${PV}" == *9999 ]]; then
inherit git-r3
else
SRC_URI="https://github.com/protocolbuffers/protobuf/releases/download/v${PV}/${P}.tar.gz"
KEYWORDS="~alpha amd64 arm arm64 ~loong ~mips ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~x64-macos"
KEYWORDS="~alpha amd64 arm arm64 ~loong ~mips ppc64 ~riscv ~s390 ~sparc x86 ~arm64-macos ~x64-macos"
SLOT="0/$(ver_cut 1-2).0"
fi

View File

@ -16,7 +16,7 @@ if [[ "${PV}" == *9999 ]]; then
inherit git-r3
else
SRC_URI="https://github.com/protocolbuffers/protobuf/releases/download/v${PV}/${P}.tar.gz"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~x64-macos"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~arm64-macos ~x64-macos"
SLOT="0/$(ver_cut 1-2).0"
fi

View File

@ -16,7 +16,7 @@ if [[ "${PV}" == *9999 ]]; then
inherit git-r3
else
SRC_URI="https://github.com/protocolbuffers/protobuf/releases/download/v${PV}/${P}.tar.gz"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~x64-macos"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~arm64-macos ~x64-macos"
SLOT="0/$(ver_cut 1-2).0"
fi

View File

@ -16,7 +16,7 @@ if [[ "${PV}" == *9999 ]]; then
inherit git-r3
else
SRC_URI="https://github.com/protocolbuffers/protobuf/releases/download/v${PV}/${P}.tar.gz"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~x64-macos"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~arm64-macos ~x64-macos"
SLOT="0/$(ver_cut 1-2).0"
fi

View File

@ -16,7 +16,7 @@ if [[ "${PV}" == *9999 ]]; then
inherit git-r3
else
SRC_URI="https://github.com/protocolbuffers/protobuf/releases/download/v${PV}/${P}.tar.gz"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~x64-macos"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~arm64-macos ~x64-macos"
SLOT="0/$(ver_cut 1-2).0"
fi

View File

@ -16,7 +16,7 @@ if [[ "${PV}" == *9999 ]]; then
inherit git-r3
else
SRC_URI="https://github.com/protocolbuffers/protobuf/releases/download/v${PV}/${P}.tar.gz"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~x64-macos"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~arm64-macos ~x64-macos"
SLOT="0/$(ver_cut 1-2).0"
fi

View File

@ -0,0 +1,200 @@
# Copyright 2008-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake-multilib dot-a elisp-common flag-o-matic multilib toolchain-funcs
# NOTE from https://github.com/protocolbuffers/protobuf/blob/main/cmake/dependencies.cmake
ABSEIL_MIN_VER="20250127.0"
if [[ "${PV}" == *9999 ]]; then
EGIT_REPO_URI="https://github.com/protocolbuffers/protobuf.git"
EGIT_SUBMODULES=( '-*' )
SLOT="0/9999"
inherit git-r3
else
SRC_URI="https://github.com/protocolbuffers/protobuf/releases/download/v${PV}/${P}.tar.gz"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~arm64-macos ~x64-macos"
SLOT="0/$(ver_cut 1-2).0"
fi
DESCRIPTION="Google's Protocol Buffers - Extensible mechanism for serializing structured data"
HOMEPAGE="https://protobuf.dev/"
LICENSE="BSD"
IUSE="conformance debug emacs examples +libprotoc +libupb +protobuf +protoc test zlib"
# Require protobuf for the time being
REQUIRED_USE="
protobuf
protobuf? ( protoc )
examples? ( protobuf )
libprotoc? ( protobuf )
libupb? ( protobuf )
protoc? ( libupb )
"
RESTRICT="!test? ( test )"
BDEPEND="
emacs? ( app-editors/emacs:* )
"
COMMON_DEPEND="
>=dev-cpp/abseil-cpp-${ABSEIL_MIN_VER}:=[${MULTILIB_USEDEP}]
zlib? ( virtual/zlib:=[${MULTILIB_USEDEP}] )
"
DEPEND="
${COMMON_DEPEND}
conformance? ( dev-libs/jsoncpp[${MULTILIB_USEDEP}] )
test? (
|| (
dev-cpp/abseil-cpp[test-helpers(-)]
dev-cpp/abseil-cpp[test]
)
dev-cpp/gtest[${MULTILIB_USEDEP}]
)
"
RDEPEND="
${COMMON_DEPEND}
${BDEPEND}
"
PATCHES=(
"${FILESDIR}/${PN}-23.3-static_assert-failure.patch"
"${FILESDIR}/${PN}-30.0-findJsonCpp.patch"
)
DOCS=( CONTRIBUTORS.txt README.md )
src_prepare() {
cmake_src_prepare
cp "${FILESDIR}/FindJsonCpp.cmake" "${S}/cmake" || die
}
multilib_src_configure() {
# bug #963340 (seems to only happen when upgrading from older pb,
# possibly w/o tests too).
use libupb && filter-lto
# Currently, the only static library is libupb (and there is no
# USE=static-libs), so optimize away the fat-lto build time penalty.
use libupb && lto-guarantee-fat
local mycmakeargs=(
-Dprotobuf_BUILD_CONFORMANCE="$(usex test "$(usex conformance)")"
-Dprotobuf_BUILD_LIBPROTOC="$(usex libprotoc)"
-Dprotobuf_BUILD_LIBUPB="$(usex libupb)"
-Dprotobuf_BUILD_PROTOBUF_BINARIES="$(usex protobuf)"
-Dprotobuf_BUILD_PROTOC_BINARIES="$(usex protoc)"
-Dprotobuf_BUILD_SHARED_LIBS="yes"
-Dprotobuf_BUILD_TESTS="$(usex test)"
-Dprotobuf_DISABLE_RTTI="no"
-Dprotobuf_INSTALL="yes"
-Dprotobuf_TEST_XML_OUTDIR="$(usex test)"
-Dprotobuf_WITH_ZLIB="$(usex zlib)"
-Dprotobuf_VERBOSE="$(usex debug)"
-DCMAKE_MODULE_PATH="${S}/cmake"
-Dprotobuf_LOCAL_DEPENDENCIES_ONLY="yes"
# -Dprotobuf_FORCE_FETCH_DEPENDENCIES="no"
)
if use protobuf ; then
if use examples ; then
mycmakeargs+=(
-Dprotobuf_BUILD_EXAMPLES="$(usex examples)"
-Dprotobuf_INSTALL_EXAMPLES="$(usex examples)"
)
fi
fi
cmake_src_configure
}
src_compile() {
cmake-multilib_src_compile
if use emacs; then
elisp-compile editors/protobuf-mode.el
fi
}
# we override here to inject env vars
multilib_src_test() {
local -x TEST_TMPDIR="${T%/}/TEST_TMPDIR_${ABI}"
mkdir -p -m 770 "${TEST_TMPDIR}" || die
ln -srf "${S}/src" "${BUILD_DIR}/include" || die
cmake_src_test "${_cmake_args[@]}"
}
src_test() {
local -x srcdir="${S}/src"
local GTEST_SKIP_TESTS=(
"PackedTest/12.DecodeEmptyPackedField"
)
if tc-is-lto; then
# Do headstands for LTO # 942985
GTEST_SKIP_TESTS+=(
"FileDescriptorSetSource/EncodeDecodeTest*"
"LazilyBuildDependenciesTest.GeneratedFile"
"PythonGeneratorTest/PythonGeneratorTest.PythonWithCppFeatures/*"
)
fi
if [[ ! -v GTEST_FILTER ]]; then
local -x GTEST_FILTER
fi
[[ -n ${GTEST_RUN_TESTS[*]} ]] && GTEST_FILTER+="$(IFS=':' ; echo "${GTEST_SKIP_TESTS[*]}")"
[[ -n ${GTEST_SKIP_TESTS[*]} ]] && GTEST_FILTER+="${GTEST_FILTER+:}-$(IFS=':' ; echo "${GTEST_SKIP_TESTS[*]}")"
cmake-multilib_src_test
}
multilib_src_install_all() {
use libupb && strip-lto-bytecode
find "${ED}" -name "*.la" -delete || die
if [[ ! -f "${ED}/usr/$(get_libdir)/libprotobuf$(get_libname "${SLOT#*/}")" ]]; then
eerror "No matching library found with SLOT variable, currently set: ${SLOT}\n" \
"Expected value: ${ED}/usr/$(get_libdir)/libprotobuf$(get_libname "${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

@ -16,7 +16,7 @@ if [[ "${PV}" == *9999 ]]; then
inherit git-r3
else
SRC_URI="https://github.com/protocolbuffers/protobuf/releases/download/v${PV}/${P}.tar.gz"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~x64-macos"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~arm64-macos ~x64-macos"
SLOT="0/$(ver_cut 1-2).0"
fi