[vlc-commits] [Git][videolan/vlc][master] 13 commits: contrib: protobuf: remove dead patch

Rémi Denis-Courmont (@Courmisch) gitlab at videolan.org
Fri Jan 28 12:49:17 UTC 2022



Rémi Denis-Courmont pushed to branch master at VideoLAN / VLC


Commits:
24e5fb65 by Steve Lhomme at 2022-01-28T10:12:07+00:00
contrib: protobuf: remove dead patch

The patch doesn't apply and is discarded. A similar fix exists in the version
we use.

- - - - -
eeb3c705 by Steve Lhomme at 2022-01-28T10:12:07+00:00
contrib: protobuf: don't configure gmock

It takes a lot of time for something we don't use.

- - - - -
75dc8ba5 by Steve Lhomme at 2022-01-28T10:12:07+00:00
contrib: protobuf: only build for C++ support

- - - - -
d276e3af by Steve Lhomme at 2022-01-28T10:12:07+00:00
contrib: remove unused global PROTOC variable

- - - - -
ff324c26 by Steve Lhomme at 2022-01-28T10:12:07+00:00
contrib: protobuf: add gcc 11.2 compilation fix from tools in contribs

Same patch that is in extra/tools with the original patch header.

- - - - -
e02c5baf by Steve Lhomme at 2022-01-28T10:12:07+00:00
contrib: protobuf: build native protoc from contribs

We check if protoc is in the path with the version we want, otherwise we build
it.

It is extracted "manually" to protoc-VERSION-cpp so it can be built in
parallel with protobuf. They don't use each other.

- - - - -
0f480eca by Steve Lhomme at 2022-01-28T10:12:07+00:00
tools: don't build protoc anymore

It's better handled in contribs were the versions is the same and the system
package detection is better.

So do not force the rebuild of it in snap.

- - - - -
535e284f by Steve Lhomme at 2022-01-28T10:12:07+00:00
packages/CI: force building .protoc when using prebuilt contribs

Since we built protobuf we also need the matching protoc.

This is the same as we do for luac.

+factorize some calls to make .luac .protoc

- - - - -
0298441d by Steve Lhomme at 2022-01-28T10:12:07+00:00
configure: use the protobuf compiler from the contribs if possible

Similar to how we use $host-luac that we build natively.

- - - - -
104ac390 by Steve Lhomme at 2022-01-28T10:12:07+00:00
configure: configure the native build of protoc with HOST name in contribs

Similar to how we force detection of luac there.

We might be using
AC_CHECK_TOOL(PROTOC, protoc, no, [${CONTRIB_DIR}/../bin$PATH_SEPARATOR$PATH])

Which works, but it doesn't keep the full path, so if the PATH is not set in
the environment when using HOST-protoc it doesn't find it. So we either have to
force everyone to add a new item in their PATH or just use the transparent way
that luac is using.

- - - - -
40e27c4b by Steve Lhomme at 2022-01-28T10:12:07+00:00
configure: ensure the protoc version matches the protobuf version

Otherwise it won't compile compatible code.

If protoc is not there we check the version of protobuf we expect so we get the
proper error messages on what's really missing.

- - - - -
fc75a318 by Steve Lhomme at 2022-01-28T10:12:07+00:00
contrib: protobuf: only allow the exact same version of installed protobuf

We don't know exactly which compatibility is allowed or not. It doesn't hurt to
rebuild when we're not sure. And then we can use the PROTOBUF_VERSION variable
consistently.

- - - - -
69a6ac24 by Steve Lhomme at 2022-01-28T10:12:07+00:00
snap: set the --host when compiling VLC

This is the same value set when compiling the contribs.

- - - - -


15 changed files:

- configure.ac
- contrib/src/main.mak
- + contrib/src/protobuf/protobuf-disable-gmock.patch
- + contrib/src/protobuf/protobuf-fix-build.patch
- − contrib/src/protobuf/protobuf-win32.patch
- contrib/src/protobuf/rules.mak
- extras/ci/gitlab-ci.yml
- extras/package/macosx/build.sh
- extras/package/raspberry/build.sh
- extras/package/snap/snapcraft.yaml
- extras/package/win32/build.sh
- extras/tools/bootstrap
- extras/tools/packages.mak
- − extras/tools/protobuf-fix-build.patch
- extras/tools/tools.mak


Changes:

=====================================
configure.ac
=====================================
@@ -569,6 +569,16 @@ AS_IF([test -n "${CONTRIB_DIR}"], [
     ])
   ])
 
+  AS_IF([test -z "$PROTOC"], [
+    AC_MSG_CHECKING([if contribs provide protoc])
+    AS_IF([test -x "${CONTRIB_DIR}/../bin/${host_alias}-protoc${BUILDEXEEXT}"], [
+      PROTOC="${CONTRIB_DIR}/../bin/${host_alias}-protoc${BUILDEXEEXT}"
+      AC_MSG_RESULT([yes])
+    ],[
+      AC_MSG_RESULT([no])
+    ])
+  ])
+
   AS_IF([test "${SYS}" = "darwin"], [
     export LD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$LD_LIBRARY_PATH"
     export DYLD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$DYLD_LIBRARY_PATH"
@@ -3840,10 +3850,16 @@ PKG_ENABLE_MODULES_VLC([CHROMAPRINT], [stream_out_chromaprint], [libchromaprint
 dnl
 dnl  Chromecast streaming support
 dnl
-m4_pushdef([protobuf_lite_version], 2.5.0)
 AC_ARG_VAR(PROTOC, [protobuf compiler])
-AC_CHECK_PROGS(PROTOC, protoc, no)
-PKG_WITH_MODULES([CHROMECAST],[protobuf-lite >= protobuf_lite_version], [
+dnl Intentionally using prefixed binaries for native tool in contribs
+AC_CHECK_TOOL(PROTOC, protoc, no)
+AS_IF([test "x${PROTOC}" != "xno"], [
+    protoc_ver="$(eval ${PROTOC} --version 2>/dev/null | head -1 | sed s/'.* '//)"
+],[
+    protoc_ver="3.1.0"
+])
+m4_pushdef([protobuf_lite_version], ${protoc_ver})
+PKG_WITH_MODULES([CHROMECAST],[protobuf-lite = protobuf_lite_version], [
     AS_IF([test "x${PROTOC}" != "xno"], [
         build_chromecast="yes"
     ], [
@@ -3851,8 +3867,8 @@ PKG_WITH_MODULES([CHROMECAST],[protobuf-lite >= protobuf_lite_version], [
     ])
 ], [
     AS_IF([test "${enable_chromecast}" = "yes"],
-        AC_MSG_ERROR(Library [protobuf-lite >= protobuf_lite_version] needed for [chromecast] was not found),
-        AC_MSG_WARN(Library [protobuf-lite >= protobuf_lite_version] needed for [chromecast] was not found)
+        AC_MSG_ERROR(Library [protobuf-lite = protobuf_lite_version] needed for [chromecast] was not found),
+        AC_MSG_WARN(Library [protobuf-lite = protobuf_lite_version] needed for [chromecast] was not found)
     )
     enable_chromecast="no"
 ], [(Chromecast streaming support)], [auto])


=====================================
contrib/src/main.mak
=====================================
@@ -306,12 +306,6 @@ else
 SHA512SUM = $(error SHA-512 checksumming not found)
 endif
 
-ifeq ($(shell protoc --version >/dev/null 2>&1 || echo FAIL),)
-PROTOC = protoc
-else
-PROTOC ?= $(error Protobuf compiler (protoc) not found)
-endif
-
 #
 # Common helpers
 #


=====================================
contrib/src/protobuf/protobuf-disable-gmock.patch
=====================================
@@ -0,0 +1,11 @@
+--- protobuf/configure.ac.gmock	2016-09-24 04:12:20.000000000 +0200
++++ protobuf/configure.ac	2020-03-24 14:46:28.900969300 +0100
+@@ -183,7 +183,7 @@ AM_CONDITIONAL([OBJC_CONFORMANCE_TEST],
+ #   too.
+ export CFLAGS
+ export CXXFLAGS
+-AC_CONFIG_SUBDIRS([gmock])
++dnl AC_CONFIG_SUBDIRS([gmock])
+ 
+ AC_CONFIG_FILES([Makefile src/Makefile benchmarks/Makefile conformance/Makefile protobuf.pc protobuf-lite.pc])
+ AC_OUTPUT


=====================================
contrib/src/protobuf/protobuf-fix-build.patch
=====================================
@@ -0,0 +1,27 @@
+From 01a05a53f40ca2ac5f0af10c6cc0810bee39b792 Mon Sep 17 00:00:00 2001
+From: Ross Wang <rosswang at google.com>
+Date: Fri, 17 Feb 2017 15:48:08 -0800
+Subject: [PATCH] const FieldDescriptorCompare
+
+Clang now validates that <set> comparators must have a const operator():
+https://reviews.llvm.org/rL291969
+
+Discussion:
+https://groups.google.com/d/msg/protobuf/9W6zFIHaJ-4/9RrfwelpEQAJ
+---
+ src/google/protobuf/compiler/java/java_file.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/google/protobuf/compiler/java/java_file.cc b/src/google/protobuf/compiler/java/java_file.cc
+index cb4503f637..86719f704c 100644
+--- a/src/google/protobuf/compiler/java/java_file.cc
++++ b/src/google/protobuf/compiler/java/java_file.cc
+@@ -65,7 +65,7 @@ namespace java {
+ namespace {
+ 
+ struct FieldDescriptorCompare {
+-  bool operator ()(const FieldDescriptor* f1, const FieldDescriptor* f2) {
++  bool operator ()(const FieldDescriptor* f1, const FieldDescriptor* f2) const {
+     if(f1 == NULL) {
+       return false;
+     }


=====================================
contrib/src/protobuf/protobuf-win32.patch deleted
=====================================
@@ -1,12 +0,0 @@
---- protobuf/src/google/protobuf/stubs/time.h	2018-05-14 12:03:13.005476200 +0200
-+++ protobuf/src/google/protobuf/stubs/time.h.win32	2018-05-14 12:02:22.476842900 +0200
-@@ -54,6 +54,9 @@ bool LIBPROTOBUF_EXPORT SecondsToDateTim
- // Returns false if the DateTime is not valid or is not in the valid range.
- bool LIBPROTOBUF_EXPORT DateTimeToSeconds(const DateTime& time, int64* seconds);
- 
-+#ifdef GetCurrentTime
-+#undef GetCurrentTime  // Windows has macro GetCurrentTime
-+#endif
- void LIBPROTOBUF_EXPORT GetCurrentTime(int64* seconds, int32* nanos);
- 
- // Formats a time string in RFC3339 fromat.


=====================================
contrib/src/protobuf/rules.mak
=====================================
@@ -3,15 +3,24 @@ PROTOBUF_VERSION := 3.1.0
 PROTOBUF_URL := https://github.com/google/protobuf/releases/download/v$(PROTOBUF_VERSION)/protobuf-cpp-$(PROTOBUF_VERSION).tar.gz
 
 ifndef HAVE_TVOS
-PKGS += protobuf
+PKGS += protobuf protoc
 endif # !HAVE_TVOS
-ifeq ($(call need_pkg, "protobuf-lite >= 3.1.0 protobuf-lite < 3.2.0"),)
-PKGS_FOUND += protobuf
+PKGS_ALL += protoc
+ifeq ($(call need_pkg, "protobuf-lite = $(PROTOBUF_VERSION)"),)
+PKGS_FOUND += protobuf protoc
+else
+ifeq ($(shell protoc --version 2>/dev/null | head -1 | sed s/'.* '//),$(PROTOBUF_VERSION))
+PKGS_FOUND += protoc
+endif # protoc
 endif
 
 $(TARBALLS)/protobuf-$(PROTOBUF_VERSION)-cpp.tar.gz:
 	$(call download_pkg,$(PROTOBUF_URL),protobuf)
 
+$(TARBALLS)/protoc-$(PROTOBUF_VERSION)-cpp.tar.gz: $(TARBALLS)/protobuf-$(PROTOBUF_VERSION)-cpp.tar.gz
+	$(RM) -R "$@"
+	cp "$<" "$@"
+
 .sum-protobuf: protobuf-$(PROTOBUF_VERSION)-cpp.tar.gz
 
 DEPS_protobuf = zlib $(DEPS_zlib)
@@ -19,15 +28,37 @@ ifdef HAVE_WIN32
 DEPS_protobuf += pthreads $(DEPS_pthreads)
 endif
 
+PROTOBUFVARS := DIST_LANG="cpp"
+PROTOCVARS := DIST_LANG="cpp"
+
+PROTOCCONF += --enable-static --disable-shared
+
+.sum-protoc: .sum-protobuf
+	touch $@
+
+protoc: protoc-$(PROTOBUF_VERSION)-cpp.tar.gz .sum-protoc
+	$(RM) -Rf $@ $(UNPACK_DIR) && mkdir -p $(UNPACK_DIR)
+	tar xvzfo "$<" -C $(UNPACK_DIR) --strip-components=1
+	$(APPLY) $(SRC)/protobuf/protobuf-disable-gmock.patch
+	$(APPLY) $(SRC)/protobuf/protobuf-fix-build.patch
+	$(MOVE)
+
+.protoc: protoc
+	$(RECONF)
+	cd $< && $(BUILDVARS) $(PROTOCVARS) ./configure $(BUILDTOOLCONF) $(PROTOCCONF)
+	cd $< && $(MAKE) && $(MAKE) install
+	touch $@
+
 protobuf: protobuf-$(PROTOBUF_VERSION)-cpp.tar.gz .sum-protobuf
 	$(UNPACK)
 	mv protobuf-$(PROTOBUF_VERSION) protobuf-$(PROTOBUF_VERSION)-cpp
+	$(APPLY) $(SRC)/protobuf/protobuf-disable-gmock.patch
 	$(APPLY) $(SRC)/protobuf/dont-build-protoc.patch
-	$(APPLY) $(SRC)/protobuf/protobuf-win32.patch
+	$(APPLY) $(SRC)/protobuf/protobuf-fix-build.patch
 	$(MOVE)
 
 .protobuf: protobuf
 	$(RECONF)
-	cd $< && $(HOSTVARS) ./configure $(HOSTCONF)
+	cd $< && $(HOSTVARS) $(PROTOBUFVARS) ./configure $(HOSTCONF)
 	cd $< && $(MAKE) && $(MAKE) install
 	touch $@


=====================================
extras/ci/gitlab-ci.yml
=====================================
@@ -252,6 +252,7 @@ debian:
         if [ -n "$VLC_PREBUILT_CONTRIBS_URL" ]; then
             echo "Building using prebuilt contribs at $VLC_PREBUILT_CONTRIBS_URL"
             make prebuilt PREBUILT_URL="${VLC_PREBUILT_CONTRIBS_URL}"
+            make -j$NCPU --output-sync=recurse .protoc
         else
             make list
             make -j$NCPU --output-sync=recurse fetch


=====================================
extras/package/macosx/build.sh
=====================================
@@ -180,11 +180,10 @@ else
 if [ ! -e "../$HOST_TRIPLET" ]; then
     if [ -n "$VLC_PREBUILT_CONTRIBS_URL" ]; then
         make prebuilt PREBUILT_URL="$VLC_PREBUILT_CONTRIBS_URL"
-        make .luac
     else
         make prebuilt
-        make .luac
     fi
+    make .luac .protoc
 fi
 fi
 spopd


=====================================
extras/package/raspberry/build.sh
=====================================
@@ -130,10 +130,10 @@ if [ "$PREBUILT" != "yes" ]; then
     fi
 elif [ -n "$VLC_PREBUILT_CONTRIBS_URL" ]; then
     make prebuilt PREBUILT_URL="$VLC_PREBUILT_CONTRIBS_URL"
-    make -j$JOBS --output-sync=recurse .luac
+    make -j$JOBS --output-sync=recurse .luac .protoc
 else
     make prebuilt
-    make -j$JOBS --output-sync=recurse .luac
+    make -j$JOBS --output-sync=recurse .luac .protoc
 fi
 cd ../..
 


=====================================
extras/package/snap/snapcraft.yaml
=====================================
@@ -69,7 +69,6 @@ parts:
       sed -i 's|0\.19\.8|0\.19\.7|'  configure.ac
       cd extras/tools
       ./bootstrap
-      make -j $(getconf _NPROCESSORS_ONLN) .protoc
       make -j $(getconf _NPROCESSORS_ONLN) .nasm
       make -j $(getconf _NPROCESSORS_ONLN) .meson
       cd ../../
@@ -83,6 +82,7 @@ parts:
           --disable-chromaprint
       if [ -v VLC_PREBUILT_CONTRIBS_URL ]; then
           make prebuilt PREBUILT_URL="$VLC_PREBUILT_CONTRIBS_URL"
+          make -j $(getconf _NPROCESSORS_ONLN) .protoc
       else
           make list
           make -j $(getconf _NPROCESSORS_ONLN) fetch
@@ -94,6 +94,7 @@ parts:
       ./bootstrap
       ./configure \
           --prefix=$SNAPCRAFT_PART_INSTALL/usr \
+          --host=$TRIPLET \
           --disable-wayland \
           --enable-merge-ffmpeg
       make -j $(getconf _NPROCESSORS_ONLN)


=====================================
extras/package/win32/build.sh
=====================================
@@ -327,12 +327,13 @@ if [ "$PREBUILT" != "yes" ]; then
     if [ "$PACKAGE" = "yes" ]; then
         make package
     fi
-elif [ -n "$VLC_PREBUILT_CONTRIBS_URL" ]; then
-    make prebuilt PREBUILT_URL="$VLC_PREBUILT_CONTRIBS_URL"
-    make .luac
 else
-    make prebuilt
-    make .luac
+    if [ -n "$VLC_PREBUILT_CONTRIBS_URL" ]; then
+        make prebuilt PREBUILT_URL="$VLC_PREBUILT_CONTRIBS_URL"
+    else
+        make prebuilt
+    fi
+    make .luac .protoc
 fi
 cd ../..
 


=====================================
extras/tools/bootstrap
=====================================
@@ -112,22 +112,6 @@ else
 fi
 }
 
-check_majmin() {
-if ! $1 --version >/dev/null 2>&1 && ! $1 -version >/dev/null 2>&1 && ! $1 --version 2>/dev/null
-then
-    echo "$1 not found"
-    NEEDED="$NEEDED $1"
-else
-    # found, need to check version ?
-    if [ -z "$2" ];then
-        FOUND="$FOUND $1"
-    else
-        gotver=`$1 --version | head -1 | sed s/'.* '//`
-        check_version_majmin $1 $gotver $2
-    fi
-fi
-}
-
 check autoconf 2.69
 check automake 1.15
 check m4 1.4.16
@@ -137,7 +121,6 @@ check cmake 3.17.0
 check_tar
 check ragel
 check_sed
-check_majmin protoc 3.1.0
 check ant
 check xz
 check bison 3.0.0


=====================================
extras/tools/packages.mak
=====================================
@@ -42,9 +42,6 @@ SED_URL=$(GNU)/sed/sed-$(SED_VERSION).tar.bz2
 ANT_VERSION=1.9.7
 ANT_URL=$(APACHE)/ant/binaries/apache-ant-$(ANT_VERSION)-bin.tar.bz2
 
-PROTOBUF_VERSION := 3.1.0
-PROTOBUF_URL := https://github.com/google/protobuf/releases/download/v$(PROTOBUF_VERSION)/protobuf-cpp-$(PROTOBUF_VERSION).tar.gz
-
 BISON_VERSION=3.0.4
 BISON_URL=$(GNU)/bison/bison-$(BISON_VERSION).tar.xz
 


=====================================
extras/tools/protobuf-fix-build.patch deleted
=====================================
@@ -1,11 +0,0 @@
---- protobuf/src/google/protobuf/compiler/java/java_file.cc.old	2021-12-13 14:57:55.210153925 +0100
-+++ protobuf/src/google/protobuf/compiler/java/java_file.cc	2021-12-13 14:58:03.734181392 +0100
-@@ -65,7 +65,7 @@
- namespace {
- 
- struct FieldDescriptorCompare {
--  bool operator ()(const FieldDescriptor* f1, const FieldDescriptor* f2) {
-+  bool operator ()(const FieldDescriptor* f1, const FieldDescriptor* f2) const {
-     if(f1 == NULL) {
-       return false;
-     }


=====================================
extras/tools/tools.mak
=====================================
@@ -308,25 +308,6 @@ DISTCLEAN_PKG += apache-ant-$(ANT_VERSION).tar.bz2
 CLEAN_FILE += .buildant
 
 
-# Protobuf Protoc
-
-protobuf-$(PROTOBUF_VERSION).tar.gz:
-	$(call download_pkg,$(PROTOBUF_URL),protobuf)
-
-protobuf: protobuf-$(PROTOBUF_VERSION).tar.gz
-	$(UNPACK)
-	$(APPLY) $(TOOLS)/protobuf-fix-build.patch
-	$(MOVE)
-
-.buildprotoc: protobuf
-	(cd $< && ./configure --prefix="$(PREFIX)" --disable-shared --enable-static --disable-dependency-tracking && $(MAKE) && $(MAKE) install)
-	(find $(PREFIX) -name 'protobuf*.pc' -exec rm -f {} \;)
-	touch $@
-
-CLEAN_PKG += protobuf
-DISTCLEAN_PKG += protobuf-$(PROTOBUF_VERSION).tar.gz
-CLEAN_FILE += .buildprotoc
-
 #
 # GNU bison
 #



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6e505fdf088799821c6883a5af0c78db38632d39...69a6ac247b8400111fb3cbb61f412611005c82c8

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6e505fdf088799821c6883a5af0c78db38632d39...69a6ac247b8400111fb3cbb61f412611005c82c8
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list