[vlc-commits] [Git][videolan/vlc][master] 4 commits: configure: use qtpaths6 instead of qmake6

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri May 17 08:11:45 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
8ce83d83 by Steve Lhomme at 2024-05-17T07:46:28+00:00
configure: use qtpaths6 instead of qmake6

So we don't have to build qmake6.

- - - - -
40d21f1f by Steve Lhomme at 2024-05-17T07:46:28+00:00
buildsystem: qt: read the qpaths as json

So we don't have to parse all the lines.

- - - - -
31938ff1 by Steve Lhomme at 2024-05-17T07:46:28+00:00
configure: clean the x262 check and fix typo

- - - - -
361f4199 by Steve Lhomme at 2024-05-17T07:46:28+00:00
buildsystem: don't check qtpaths is a file

That's assuming we get a full path to the file, it may just be a command in the PATH.
It is fine if that command doesn't exist, we check the error of the subprocess.run() call.

- - - - -


2 changed files:

- buildsystem/check_qml_module.py
- configure.ac


Changes:

=====================================
buildsystem/check_qml_module.py
=====================================
@@ -3,7 +3,6 @@
 
 import json
 import argparse
-import sys
 import os
 import subprocess
 from tempfile import NamedTemporaryFile
@@ -78,43 +77,36 @@ class QmlModuleChecker:
         return ret
 
 
-    def getInstallInfo(self, qmake, qtconf):
-        if not os.path.isfile(qmake):
-            print("qmake not found")
-            return False
-
+    def getInstallInfo(self, qtpaths, qtconf):
+        qtpaths_cmd = [ qtpaths, "--query", "--query-format", "json" ]
         if qtconf:
-            ret = subprocess.run(
-                [ qmake, "-qtconf", qtconf, "-query"],
-                stdout=subprocess.PIPE, stderr=subprocess.PIPE,
-                encoding="utf8"
-            )
-        else:
-            ret = subprocess.run(
-                [ qmake, "-query"],
-                stdout=subprocess.PIPE, stderr=subprocess.PIPE,
-                encoding="utf8"
-            )
+            qtpaths_cmd += [ "--qtconf", qtconf ]
+        ret = subprocess.run(
+            qtpaths_cmd,
+            stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+            encoding="utf8"
+        )
 
         if ret.returncode != 0:
             print(ret.stderr.strip())
             return False
 
-        binpath = None
-        libexec = None
-        qmlpath = None
-        qtmajor = ""
-        for l in ret.stdout.splitlines():
-            l.strip()
-            if l.startswith("QT_HOST_BINS:"):
-                binpath = l.split(":", 1)[1]
-            elif l.startswith("QT_HOST_LIBEXECS:"):
-                libexec = l.split(":", 1)[1]
-            elif l.startswith("QT_INSTALL_QML:"):
-                self.qmlpath = l.split(":", 1)[1]
-            elif l.startswith("QT_VERSION:"):
-                qmlversion = l.split(":", 1)[1]
-                qtmajor = qmlversion.split(".")[0]
+        # Qt 6.6 outputs invalid json, try to fix it
+        qpaths_json = str(ret.stdout)
+        if ',\n}' in qpaths_json:
+            qpaths_json = qpaths_json.replace(',\n}', '\n}')
+        elif ',\r\n}' in qpaths_json:
+            qpaths_json = qpaths_json.replace(',\r\n}', '\r\n}')
+
+        qtjson = json.loads(qpaths_json)
+        binpath = qtjson["QT_HOST_BINS"]
+        libexec = qtjson["QT_HOST_LIBEXECS"]
+        self.qmlpath = qtjson["QT_INSTALL_QML"]
+        qmlversion = qtjson["QT_VERSION"]
+        if qmlversion:
+            qtmajor = qmlversion.split(".")[0]
+        else:
+            qtmajor = ""
 
         if qtmajor == "6":
             self.qt5 = False
@@ -148,12 +140,12 @@ class KeyValue(argparse.Action):
 def main():
     parser = argparse.ArgumentParser("check for qml runtime dependencies")
     parser.add_argument(
-        "--qmake", type=str, required=True,
-        help="native qmake path")
+        "--qtpaths", type=str, required=True,
+        help="native qtpaths path")
 
     parser.add_argument(
         "--qtconf", type=str, required=False,
-        help="qmake qtconf path")
+        help="qtpaths qtconf path")
 
     parser.add_argument(
         "--modules", nargs="+", action=KeyValue, required=True,
@@ -162,7 +154,7 @@ def main():
     args = parser.parse_args()
 
     moduleChecker = QmlModuleChecker()
-    if not moduleChecker.getInstallInfo(args.qmake, args.qtconf):
+    if not moduleChecker.getInstallInfo(args.qtpaths, args.qtconf):
         exit(-1)
 
     with NamedTemporaryFile(mode="w+", suffix=".qml") as f:


=====================================
configure.ac
=====================================
@@ -3055,17 +3055,17 @@ dnl H262 encoder plugin (lib262)
 dnl
 AC_ARG_ENABLE([x262],
   AS_HELP_STRING([--enable-x262], [H262 encoding support with static libx262 (default disabled)]))
-if test "${enable_x262}" != "no"; then
+AS_IF([test "${enable_x262}" != "no"], [
     PKG_CHECK_MODULES(X262, x262, [
         VLC_ADD_PLUGIN([x262])
         VLC_ADD_LIBS([x262],[${X262_LIBS}])
         VLC_ADD_CFLAGS([x262],[${X262_CFLAGS}])
-    ], [
-       if test "${enable_x262}" = "yes"; then
-        AC_MSG_ERROR([x262 module doesn't work without staticly compiled libx262.a])
-       fi
+    ],[
+       AS_IF([test "${enable_x262}" = "yes"], [
+        AC_MSG_ERROR([x262 module does not work without statically compiled libx262.a])
+       ])
     ])
-fi
+])
 
 dnl x265 encoder
 PKG_ENABLE_MODULES_VLC([X265],, [x265], [HEVC/H.265 encoder], [auto])
@@ -4018,7 +4018,7 @@ AS_IF([test "${enable_qt}" != "no"], [
       ])
 
       dnl check native in contribs and keep the full path if found there
-      AC_PATH_PROGS(QMAKE6, [qmake6], qmake6, ["${QT_BIN_DIRECTORY}"])
+      AC_PATH_PROGS(QTPATHS6, [qtpaths6], qtpaths6, ["${QT_BIN_DIRECTORY}"])
       AC_PATH_PROGS(MOC, [moc], moc, ["${QT_LIBEXEC_DIRECTORY}"])
       AC_PATH_PROGS(RCC, [rcc], rcc, ["${QT_LIBEXEC_DIRECTORY}"])
       AC_PATH_PROGS(UIC, [uic], uic, ["${QT_LIBEXEC_DIRECTORY}"])
@@ -4029,9 +4029,9 @@ AS_IF([test "${enable_qt}" != "no"], [
       ])
 
       AC_CHECK_PROGS(PYTHON3, [python3], [no])
-      AC_MSG_CHECKING([if required Qt plugins are installed with ${QMAKE6} and conf ${QT_CONF}])
+      AC_MSG_CHECKING([if required Qt plugins are installed with ${QTPATHS6} and conf ${QT_CONF}])
       AS_IF([test "$PYTHON3" != "no" && ${PYTHON3} ${srcdir}/buildsystem/check_qml_module.py \
-            --qmake "${QMAKE6}" \
+            --qtpaths "${QTPATHS6}" \
             --qtconf "${QT_CONF}" \
             --modules \
             QtQml.Models="" \
@@ -4050,7 +4050,7 @@ AS_IF([test "${enable_qt}" != "no"], [
 
       PKG_CHECK_MODULES([QT_QUICK_TEST], [Qt6QuickTest >= ${QT_MINIMUM_VERSION}], [
           AS_IF([test "$PYTHON3" != "no" && ${PYTHON3} ${srcdir}/buildsystem/check_qml_module.py \
-            --qmake "${QMAKE6}" \
+            --qtpaths "${QTPATHS6}" \
             --qtconf "${QT_CONF}" \
             --modules QtTest="" \
             >&AS_MESSAGE_FD ], [



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/929aace30d6956dc4823959352ba51e3dc7a8692...361f419997a2f325c3534d34fdc4b0d24cc4a85a

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/929aace30d6956dc4823959352ba51e3dc7a8692...361f419997a2f325c3534d34fdc4b0d24cc4a85a
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