3 |
3 |
|
4 |
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
inherit autotools elisp-common flag-o-matic multilib-minimal toolchain-funcs
|
|
6 |
inherit cmake-multilib elisp-common toolchain-funcs
|
7 |
7 |
|
8 |
8 |
if [[ "${PV}" == *9999 ]]; then
|
9 |
9 |
inherit git-r3
|
... | ... | |
12 |
12 |
EGIT_SUBMODULES=()
|
13 |
13 |
else
|
14 |
14 |
SRC_URI="https://github.com/protocolbuffers/protobuf/archive/v${PV}.tar.gz -> ${P}.tar.gz"
|
15 |
|
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~x64-macos"
|
|
15 |
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~loong ~mips ~ppc64 ~riscv ~x86 ~amd64-linux ~x86-linux ~x64-macos"
|
16 |
16 |
fi
|
17 |
17 |
|
18 |
18 |
DESCRIPTION="Google's Protocol Buffers - Extensible mechanism for serializing structured data"
|
19 |
|
HOMEPAGE="
|
20 |
|
https://developers.google.com/protocol-buffers/
|
21 |
|
"
|
|
19 |
HOMEPAGE="https://protobuf.dev/"
|
22 |
20 |
|
23 |
21 |
LICENSE="BSD"
|
24 |
|
SLOT="0/32"
|
25 |
|
IUSE="emacs examples static-libs test zlib"
|
|
22 |
SLOT="0/3.$(ver_cut 1-2).0"
|
|
23 |
IUSE="emacs examples test zlib"
|
26 |
24 |
RESTRICT="!test? ( test )"
|
27 |
25 |
|
28 |
26 |
BDEPEND="emacs? ( app-editors/emacs:* )"
|
29 |
|
DEPEND="test? ( >=dev-cpp/gtest-1.9[${MULTILIB_USEDEP}] )
|
30 |
|
zlib? ( sys-libs/zlib[${MULTILIB_USEDEP}] )"
|
31 |
|
RDEPEND="emacs? ( app-editors/emacs:* )
|
32 |
|
zlib? ( sys-libs/zlib[${MULTILIB_USEDEP}] )"
|
|
27 |
DEPEND="
|
|
28 |
zlib? ( sys-libs/zlib[${MULTILIB_USEDEP}] )
|
|
29 |
test? ( >=dev-cpp/gtest-1.9[${MULTILIB_USEDEP}] )
|
|
30 |
"
|
|
31 |
RDEPEND="
|
|
32 |
emacs? ( app-editors/emacs:* )
|
|
33 |
zlib? ( sys-libs/zlib[${MULTILIB_USEDEP}] )
|
|
34 |
"
|
33 |
35 |
|
34 |
36 |
PATCHES=(
|
35 |
|
"${FILESDIR}/${PN}-3.19.0-disable_no-warning-test.patch"
|
36 |
|
"${FILESDIR}/${PN}-3.19.0-system_libraries.patch"
|
37 |
|
"${FILESDIR}/${PN}-3.20.2-protoc_input_output_files.patch"
|
38 |
|
"${FILESDIR}/${PN}-21.9-disable-32-bit-tests.patch"
|
|
37 |
"${FILESDIR}/${PN}-23.3-disable-32-bit-tests.patch"
|
|
38 |
"${FILESDIR}/${PN}-23.3-static_assert-failure.patch"
|
39 |
39 |
)
|
40 |
40 |
|
41 |
|
DOCS=(CHANGES.txt CONTRIBUTORS.txt README.md)
|
42 |
|
|
43 |
|
src_prepare() {
|
44 |
|
default
|
45 |
|
|
46 |
|
# https://github.com/protocolbuffers/protobuf/issues/7413
|
47 |
|
sed -e "/^AC_PROG_CXX_FOR_BUILD$/d" -i configure.ac || die
|
48 |
|
|
49 |
|
# https://github.com/protocolbuffers/protobuf/issues/8082
|
50 |
|
sed -e "/^TEST_F(IoTest, LargeOutput) {$/,/^}$/d" -i src/google/protobuf/io/zero_copy_stream_unittest.cc || die
|
51 |
|
|
52 |
|
# https://github.com/protocolbuffers/protobuf/issues/8459
|
53 |
|
sed \
|
54 |
|
-e "/^TEST(ArenaTest, BlockSizeSmallerThanAllocation) {$/a\\ if (sizeof(void*) == 4) {\n GTEST_SKIP();\n }" \
|
55 |
|
-e "/^TEST(ArenaTest, SpaceAllocated_and_Used) {$/a\\ if (sizeof(void*) == 4) {\n GTEST_SKIP();\n }" \
|
56 |
|
-i src/google/protobuf/arena_unittest.cc || die
|
57 |
|
|
58 |
|
# https://github.com/protocolbuffers/protobuf/issues/8460
|
59 |
|
sed -e "/^TEST(AnyTest, TestPackFromSerializationExceedsSizeLimit) {$/a\\ if (sizeof(void*) == 4) {\n GTEST_SKIP();\n }" -i src/google/protobuf/any_test.cc || die
|
60 |
|
|
61 |
|
# https://github.com/protocolbuffers/protobuf/issues/9433
|
62 |
|
sed -e "/^[[:space:]]*static_assert(alignof(U) <= 8, \"\");$/d" -i src/google/protobuf/descriptor.cc || die
|
63 |
|
|
64 |
|
eautoreconf
|
65 |
|
}
|
|
41 |
DOCS=( CONTRIBUTORS.txt README.md )
|
66 |
42 |
|
67 |
43 |
src_configure() {
|
68 |
|
append-cppflags -DGOOGLE_PROTOBUF_NO_RTTI
|
69 |
|
|
70 |
44 |
if tc-ld-is-gold; then
|
71 |
45 |
# https://sourceware.org/bugzilla/show_bug.cgi?id=24527
|
72 |
46 |
tc-ld-disable-gold
|
73 |
47 |
fi
|
74 |
48 |
|
75 |
|
multilib-minimal_src_configure
|
|
49 |
cmake-multilib_src_configure
|
76 |
50 |
}
|
77 |
51 |
|
78 |
52 |
multilib_src_configure() {
|
79 |
|
local options=(
|
80 |
|
$(use_enable static-libs static)
|
81 |
|
$(use_with zlib)
|
|
53 |
local mycmakeargs=(
|
|
54 |
-Dprotobuf_DISABLE_RTTI=ON
|
|
55 |
-Dprotobuf_BUILD_EXAMPLES=$(usex examples)
|
|
56 |
-Dprotobuf_WITH_ZLIB=$(usex zlib)
|
|
57 |
-Dprotobuf_BUILD_TESTS=$(usex test)
|
82 |
58 |
)
|
|
59 |
use test && mycmakeargs+=(-Dprotobuf_USE_EXTERNAL_GTEST=ON)
|
83 |
60 |
|
84 |
|
if tc-is-cross-compiler; then
|
85 |
|
# Build system uses protoc when building, so protoc copy runnable on host is needed.
|
86 |
|
mkdir -p "${WORKDIR}/build" || die
|
87 |
|
pushd "${WORKDIR}/build" > /dev/null || die
|
88 |
|
ECONF_SOURCE="${S}" econf_build "${options[@]}"
|
89 |
|
options+=(--with-protoc="$(pwd)/src/protoc")
|
90 |
|
popd > /dev/null || die
|
91 |
|
fi
|
92 |
|
|
93 |
|
ECONF_SOURCE="${S}" econf "${options[@]}"
|
|
61 |
cmake_src_configure
|
94 |
62 |
}
|
95 |
63 |
|
96 |
64 |
src_compile() {
|
97 |
|
multilib-minimal_src_compile
|
|
65 |
cmake-multilib_src_compile
|
98 |
66 |
|
99 |
67 |
if use emacs; then
|
100 |
68 |
elisp-compile editors/protobuf-mode.el
|
101 |
69 |
fi
|
102 |
70 |
}
|
103 |
71 |
|
104 |
|
multilib_src_compile() {
|
105 |
|
if tc-is-cross-compiler; then
|
106 |
|
emake -C "${WORKDIR}/build/src" protoc
|
107 |
|
fi
|
108 |
|
|
109 |
|
default
|
110 |
|
}
|
111 |
|
|
112 |
|
multilib_src_test() {
|
113 |
|
emake check
|
114 |
|
}
|
115 |
|
|
116 |
72 |
multilib_src_install_all() {
|
117 |
73 |
find "${ED}" -name "*.la" -delete || die
|
118 |
74 |
|