[vlc-commits] [Git][videolan/vlc][master] 2 commits: contrib: protobuf: rebuild protoc if the version doesn't match exactly

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Nov 16 12:10:23 UTC 2024



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
956c372b by Steve Lhomme at 2024-11-16T10:34:29+00:00
contrib: protobuf: rebuild protoc if the version doesn't match exactly

The meson build system requires exact versions match for versions below 3.22
even though they are compatible.

- - - - -
0ef4d615 by Steve Lhomme at 2024-11-16T10:34:29+00:00
configure: force protoc exact match for older versions

Before 22.x or 3.22.x:
protoc x.y.z is compatible with protobuf x.y.*

Since 22.x:
protoc x.y is compatible with protobuf x.y.*

Fixes #28865 except for 22.0 which has a protobuf version of "4.22.0"
instead of "22.0.0", so it's not between 22.0 and 22.1.

- - - - -


2 changed files:

- configure.ac
- contrib/src/protobuf/rules.mak


Changes:

=====================================
configure.ac
=====================================
@@ -3947,10 +3947,20 @@ AS_IF([test -n "$PKG_CONFIG"],[
     AC_PATH_PROGS(PROTOC, [protoc], no, ["${CONTRIB_DIR}/../bin:$PATH"])
     AS_IF([test "${PROTOC}" != "no"], [
         dnl silently checks the protoc version matches the protobuf library
-        PROTOBUF_VERSION="$(eval ${PROTOC} --version 2>/dev/null | head -1 | sed s/'.* '// | cut -d '.' -f -2)"
-        protoc_ver_next="${PROTOBUF_VERSION%.*}.$((${PROTOBUF_VERSION##*.}+1))"
+        PROTOC_FULL_VERSION="$(eval ${PROTOC} --version 2>/dev/null | head -1 | sed s/'.* '//)"
+        PROTOC_MAJ_VERSION="$(echo ${PROTOC_FULL_VERSION} | cut -d '.' -f -1)"
+        AS_IF([test "${PROTOC_MAJ_VERSION}" -lt "22" ], [
+            dnl protoc x.y.z is compatible with protobuf x.y.z
+            PROTOBUF_VERSION="$(echo ${PROTOC_FULL_VERSION})"
+            PROTOBUF_TEST="protobuf-lite == ${PROTOBUF_VERSION}"
+        ],[
+            dnl protoc x.y is compatible with protobuf x.y.*
+            PROTOBUF_VERSION="$(echo ${PROTOC_FULL_VERSION} | cut -d '.' -f -2)"
+            PROTOBUF_MAX_VERSION="${PROTOBUF_VERSION%.*}.$((${PROTOBUF_VERSION##*.}+1))"
+            PROTOBUF_TEST="protobuf-lite >= ${PROTOBUF_VERSION} protobuf-lite < ${PROTOBUF_MAX_VERSION}"
+        ])
         AC_MSG_CHECKING([protobuf-lite matches ${PROTOC} version ${PROTOBUF_VERSION}])
-        ($PKG_CONFIG --exists --print-errors "protobuf-lite >= ${PROTOBUF_VERSION} protobuf-lite < ${protoc_ver_next}") 2>&AS_MESSAGE_FD
+        ($PKG_CONFIG --exists --print-errors "${PROTOBUF_TEST}") 2>&AS_MESSAGE_FD
         ac_status=$?
         AS_IF([test $ac_status = 0],[
             protoc_matching=yes


=====================================
contrib/src/protobuf/rules.mak
=====================================
@@ -21,7 +21,7 @@ endif
 PKGS.tools.protoc.config-tool = protoc
 PKGS.tools.protoc.path = $(BUILDBINDIR)/protoc
 
-ifeq ($(call system_tool_majmin, protoc --version),$(PROTOBUF_MAJPACKAGE).$(PROTOBUF_MAJVERSION))
+ifeq ($(call system_tool_version, protoc --version, cat),$(PROTOBUF_PACKAGE))
 PKGS_FOUND += protoc
 endif
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0d71a71377fb71b63cead302ac114d212546aad8...0ef4d6151ce7a4443d88269fcb6f78bc0a442e98

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0d71a71377fb71b63cead302ac114d212546aad8...0ef4d6151ce7a4443d88269fcb6f78bc0a442e98
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list