[vlc-devel] [PATCH v2 10/13] contrib: protobuf: build protoc from contribs
Steve Lhomme
robux4 at ycbcr.xyz
Tue Mar 24 15:46:28 CET 2020
Similar to how it's done for luac: we have a triplet-protoc in contrib/bin.
The .protoc target is only built when cross-compiling or when using prebuilt.
Otherwise the native build is sufficient.
Since protoc and protobuf depend on the same source they might be extracted at
the same time we make sure protoc is extracted before protobuf. It also needs
to be built before so we can use it with --with-protoc.
---
contrib/src/protobuf/rules.mak | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/contrib/src/protobuf/rules.mak b/contrib/src/protobuf/rules.mak
index 96904f5962..a404aade3b 100644
--- a/contrib/src/protobuf/rules.mak
+++ b/contrib/src/protobuf/rules.mak
@@ -3,8 +3,16 @@ PROTOBUF_VERSION := 3.1.0
PROTOBUF_URL := https://github.com/google/protobuf/releases/download/v$(PROTOBUF_VERSION)/protobuf-cpp-$(PROTOBUF_VERSION).tar.gz
PKGS += protobuf
+PKGS_ALL += protoc
+ifdef HAVE_CROSS_COMPILE
+# we need a native version of protoc, not a cross compiled one
+PKGS += protoc
+PROTOBUF_DEP := .protoc
+endif
+# protoc is needed when using prebuilt packages
+PKGS_PROGS += protoc
ifeq ($(call need_pkg, "protobuf-lite >= 3.1.0 protobuf-lite < 3.2.0"),)
-PKGS_FOUND += protobuf
+PKGS_FOUND += protobuf protoc
else
# check we have a matching protoc to use
PROTOC_ABSPATH = $(shell PATH="$(PATH)" which protoc)
@@ -33,8 +41,9 @@ DEPS_protobuf += pthreads $(DEPS_pthreads)
endif
PROTOBUFVARS := $(HOSTVARS) DIST_LANG="cpp"
+PROTOCVARS := $(BUILDVARS) DIST_LANG="cpp"
-protobuf: protobuf-$(PROTOBUF_VERSION)-cpp.tar.gz .sum-protobuf
+protobuf: protobuf-$(PROTOBUF_VERSION)-cpp.tar.gz .sum-protobuf $(PROTOBUF_DEP)
$(UNPACK)
mv protobuf-$(PROTOBUF_VERSION) protobuf-$(PROTOBUF_VERSION)-cpp
$(APPLY) $(SRC)/protobuf/protobuf-disable-gmock.patch
@@ -45,3 +54,18 @@ protobuf: protobuf-$(PROTOBUF_VERSION)-cpp.tar.gz .sum-protobuf
cd $< && $(PROTOBUFVARS) ./configure $(HOSTCONF) --with-protoc="$(PROTOC)"
cd $< && $(MAKE) && $(MAKE) install
touch $@
+
+.sum-protoc: .sum-protobuf
+ touch $@
+
+protoc: protobuf-$(PROTOBUF_VERSION)-cpp.tar.gz .sum-protoc
+ $(UNPACK)
+ mv protobuf-$(PROTOBUF_VERSION) protobuf-$(PROTOBUF_VERSION)-cpp
+ $(APPLY) $(SRC)/protobuf/protobuf-disable-gmock.patch
+ $(MOVE)
+
+.protoc: protoc
+ $(RECONF)
+ cd $< && $(PROTOCVARS) ./configure $(BUILDCONF)
+ cd $< && $(MAKE) && $(MAKE) install
+ touch $@
--
2.17.1
More information about the vlc-devel
mailing list