[vlc-commits] contrib: protobuf: check the protoc version matches the protobuf version

Steve Lhomme git at videolan.org
Tue May 15 18:35:00 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon May 14 13:20:25 2018 +0200| [d45bc25e13898aeb0096b933572a9d4d9f30f590] | committer: Steve Lhomme

contrib: protobuf: check the protoc version matches the protobuf version

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d45bc25e13898aeb0096b933572a9d4d9f30f590
---

 contrib/src/protobuf/rules.mak | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/contrib/src/protobuf/rules.mak b/contrib/src/protobuf/rules.mak
index b63a38cdb6..755867f4ca 100644
--- a/contrib/src/protobuf/rules.mak
+++ b/contrib/src/protobuf/rules.mak
@@ -5,6 +5,21 @@ PROTOBUF_URL := https://github.com/google/protobuf/releases/download/v$(PROTOBUF
 PKGS += protobuf
 ifeq ($(call need_pkg, "protobuf-lite >= 3.1.0 protobuf-lite < 3.2.0"),)
 PKGS_FOUND += protobuf
+else
+ifeq ($(findstring protobuf,$(PKGS_DISABLE)),)
+# check we have a matching protoc to use
+PROTOC = $(shell PATH="$(PATH)" which protoc)
+ifeq ($(PROTOC),)
+$(error protoc not found in PATH $(PATH) - $(SYS_PROTOC) - $(PROTOC))
+else
+# make sure the installed protoc is compatible with the version we want to build
+SYS_PROTOC_VER = $(shell $(PROTOC) --version)
+SYS_PROTOC = $(word $(words $(SYS_PROTOC_VER)) , $(SYS_PROTOC_VER))
+ifneq ($(PROTOBUF_VERSION),$(SYS_PROTOC))
+$(error $(PROTOC) version $(SYS_PROTOC) doesn't match the protobuf $(PROTOBUF_VERSION) we're building)
+endif
+endif
+endif
 endif
 
 $(TARBALLS)/protobuf-$(PROTOBUF_VERSION)-cpp.tar.gz:



More information about the vlc-commits mailing list