dev-libs/protobuf-c: Restore protobuf-2.x compatibility
authorThomas Deutschmann <whissi@gentoo.org>
Sat, 30 Sep 2017 22:19:44 +0000 (00:19 +0200)
committerThomas Deutschmann <whissi@gentoo.org>
Sat, 30 Sep 2017 22:20:10 +0000 (00:20 +0200)
Package-Manager: Portage-2.3.10, Repoman-2.3.3

dev-libs/protobuf-c/files/protobuf-c-1.3.0-restore-protobuf-2-compatibility.patch [new file with mode: 0644]
dev-libs/protobuf-c/protobuf-c-1.3.0-r1.ebuild [new file with mode: 0644]

diff --git a/dev-libs/protobuf-c/files/protobuf-c-1.3.0-restore-protobuf-2-compatibility.patch b/dev-libs/protobuf-c/files/protobuf-c-1.3.0-restore-protobuf-2-compatibility.patch
new file mode 100644 (file)
index 0000000..962341b
--- /dev/null
@@ -0,0 +1,33 @@
+From 4302266b45303094616685c7997a6e6015ddadba Mon Sep 17 00:00:00 2001
+From: Robert Edmonds <edmonds@users.noreply.github.com>
+Date: Mon, 7 Aug 2017 12:31:55 -0400
+Subject: [PATCH] Restore protobuf-2.x compatibility
+
+The change in commit 712154b912de824741381c0bb26c2fbed54515a3 ("Bump
+minimum required header version for proto3 syntax") uses functionality
+only exposed by protobuf-3.x, breaking the build when compiling against
+protobuf-2.x.
+
+Since we still want to support building against protobuf-2.x, this
+commit makes the proto3 syntax check in the file generator dependent on
+building against protobuf-3.x.
+---
+ protoc-c/c_file.cc | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/protoc-c/c_file.cc b/protoc-c/c_file.cc
+index 9851768..0f1d770 100644
+--- a/protoc-c/c_file.cc
++++ b/protoc-c/c_file.cc
+@@ -120,9 +120,11 @@ void FileGenerator::GenerateHeader(io::Printer* printer) {
+   string filename_identifier = FilenameIdentifier(file_->name());
+   int min_header_version = 1000000;
++#if defined(HAVE_PROTO3)
+   if (file_->syntax() == FileDescriptor::SYNTAX_PROTO3) {
+     min_header_version = 1003000;
+   }
++#endif
+   // Generate top of header.
+   printer->Print(
diff --git a/dev-libs/protobuf-c/protobuf-c-1.3.0-r1.ebuild b/dev-libs/protobuf-c/protobuf-c-1.3.0-r1.ebuild
new file mode 100644 (file)
index 0000000..52bb0f3
--- /dev/null
@@ -0,0 +1,42 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit autotools multilib-minimal
+
+MY_PV="${PV/_/-}"
+MY_P="${PN}-${MY_PV}"
+
+DESCRIPTION="Protocol Buffers implementation in C"
+HOMEPAGE="https://github.com/protobuf-c/protobuf-c/"
+SRC_URI="https://github.com/${PN}/${PN}/releases/download/v${MY_PV}/${MY_P}.tar.gz"
+
+LICENSE="BSD-2"
+# Subslot == SONAME version
+SLOT="0/1.0.0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+IUSE="static-libs test"
+
+RDEPEND=">=dev-libs/protobuf-2.6.0:0=[${MULTILIB_USEDEP}]"
+DEPEND="${RDEPEND}
+       test? ( ${AUTOTOOLS_DEPEND} )
+       virtual/pkgconfig[${MULTILIB_USEDEP}]"
+
+PATCHES=( "${FILESDIR}"/${PN}-1.3.0-restore-protobuf-2-compatibility.patch )
+
+S="${WORKDIR}/${MY_P}"
+
+src_prepare() {
+       default
+       if ! use test ; then
+               eapply "${FILESDIR}"/${PN}-1.3.0-no-build-tests.patch
+       fi
+
+       eautoreconf
+}
+
+multilib_src_configure() {
+       ECONF_SOURCE="${S}" \
+       econf "${myeconfargs[@]}"
+}