diff options
author | Matthew Waters <matthew@centricular.com> | 2022-11-22 10:12:50 +1100 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2022-12-09 19:51:04 +0000 |
commit | ec673ad4cdac5fc0201b0d1a9a83ae418bf7cc24 (patch) | |
tree | a79c2f6d79bb7d2404b5ac6b7b6d44dba5527088 | |
parent | e69854edc9c6e28e0fe31c60c3645079a0bf37ba (diff) |
good: add support for building the Qt6 qml plugin
Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/1030>
-rw-r--r-- | cerbero/build/build.py | 2 | ||||
-rw-r--r-- | cerbero/config.py | 11 | ||||
-rw-r--r-- | cerbero/utils/__init__.py | 21 | ||||
-rw-r--r-- | packages/gstreamer-1.0-qt6.package | 14 | ||||
-rw-r--r-- | packages/gstreamer-1.0/gstreamer-1.0.package | 1 | ||||
-rw-r--r-- | recipes/gst-plugins-good-1.0.recipe | 8 |
6 files changed, 54 insertions, 3 deletions
diff --git a/cerbero/build/build.py b/cerbero/build/build.py index 7adaec9c..46604f69 100644 --- a/cerbero/build/build.py +++ b/cerbero/build/build.py @@ -919,6 +919,8 @@ class Meson (Build, ModifyEnvBase) : if self.config.qt5_qmake_path: binaries['qmake'] = [self.config.qt5_qmake_path] binaries['moc'] = [self._get_moc_path(self.config.qt5_qmake_path)] + if self.config.qt6_qmake_path: + binaries['qmake'] = [self.config.qt6_qmake_path] # Try to detect build tools in the remaining env vars build_tool_paths = build_env['PATH'].get() diff --git a/cerbero/config.py b/cerbero/config.py index cb3f3150..a8fc576a 100644 --- a/cerbero/config.py +++ b/cerbero/config.py @@ -27,7 +27,7 @@ from pathlib import PurePath, Path from cerbero.enums import Architecture, Platform, Distro, DistroVersion, License, LibraryType from cerbero.errors import FatalError, ConfigurationError from cerbero.utils import _, system_info, validate_packager, shell -from cerbero.utils import to_unixpath, to_winepath, parse_file, detect_qt5 +from cerbero.utils import to_unixpath, to_winepath, parse_file, detect_qt5, detect_qt6 from cerbero.utils import EnvVar, EnvValue from cerbero.utils import messages as m from cerbero.ide.pkgconfig import PkgConfig @@ -85,7 +85,7 @@ class Variants(object): # Variants that are booleans, and are unset when prefixed with 'no' __disabled_variants = ['x11', 'alsa', 'pulse', 'jack', 'cdparanoia', 'v4l2', 'gi', 'unwind', 'rpi', 'visualstudio', 'mingw', 'uwp', 'qt5', - 'intelmsdk', 'python', 'werror', 'vaapi', 'rust'] + 'intelmsdk', 'python', 'werror', 'vaapi', 'rust', 'qt6'] __enabled_variants = ['debug', 'optimization', 'testspackage'] __bool_variants = __enabled_variants + __disabled_variants # Variants that are `key: (values)`, with the first value in the tuple @@ -200,7 +200,8 @@ class Config (object): 'for_shell', 'package_tarball_compression', 'extra_mirrors', 'extra_bootstrap_packages', 'moltenvk_prefix', 'vs_install_path', 'vs_install_version', 'exe_suffix', - 'rust_prefix', 'rustup_home', 'cargo_home', 'tomllib_path'] + 'rust_prefix', 'rustup_home', 'cargo_home', 'tomllib_path', + 'qt6_qmake_path'] cookbook = None @@ -305,6 +306,10 @@ class Config (object): self.target_arch == Architecture.UNIVERSAL) config.set_property('qt5_qmake_path', qmake5) config.set_property('qt5_pkgconfigdir', qtpkgdir) + # Qt6 + qmake6 = detect_qt6(config.target_platform, config.target_arch, + self.target_arch == Architecture.UNIVERSAL) + config.set_property('qt6_qmake_path', qmake6) # We already called these functions on `self` above if config is not self: config._load_last_defaults() diff --git a/cerbero/utils/__init__.py b/cerbero/utils/__init__.py index 7d492f16..77af5e9a 100644 --- a/cerbero/utils/__init__.py +++ b/cerbero/utils/__init__.py @@ -606,6 +606,27 @@ def detect_qt5(platform, arch, is_universal): m.warning('Unsupported arch {!r} on platform {!r}'.format(arch, platform)) return ret +def detect_qt6(platform, arch, is_universal): + ''' + Returns the path to qmake: + + Returns None if qmake could not be found. + ''' + path = None + qmake6_path = os.environ.get('QMAKE', None) + if not qmake6_path: + return None + try: + qt_version = shell.check_output([qmake6_path, '-query', 'QT_VERSION']).strip() + qt_version = [int(v) for v in qt_version.split('.')] + except CommandError as e: + m.warning('QMAKE={!r} failed to execute:\n{}'.format(str(qmake6_path), str(e))) + qt_version = [0, 0] + if len(qt_version) >= 1 and qt_version[0] != 6: + # QMAKE is not for Qt6 + return None + return qmake6_path + # asyncio.Semaphore classes set their working event loop internally on # creation, so we need to ensure the proper loop has already been set by then. # This is especially important if we create global semaphores that are diff --git a/packages/gstreamer-1.0-qt6.package b/packages/gstreamer-1.0-qt6.package new file mode 100644 index 00000000..12720ef8 --- /dev/null +++ b/packages/gstreamer-1.0-qt6.package @@ -0,0 +1,14 @@ +# vi:si:et:sw=4:sts=4:ts=4:syntax=python:ft=python +# -*- Mode: Python -*- + + +class Package(custom.GStreamer, package.Package): + + name = 'gstreamer-1.0-qt6' + shortdesc = 'GStreamer 1.0 plugins for the Qt6 framework' + longdesc = 'GStreamer 1.0 plugins for the Qt6 framework' + uuid = '1044f0a2-55a6-11ed-b55d-a87eeaa6e497' + deps = ['gstreamer-1.0-core'] + + files = ['gst-plugins-good-1.0:plugins_qt6'] + files_devel = ['gst-plugins-good-1.0:plugins_qt6_devel'] diff --git a/packages/gstreamer-1.0/gstreamer-1.0.package b/packages/gstreamer-1.0/gstreamer-1.0.package index b78e07d8..a6d26abb 100644 --- a/packages/gstreamer-1.0/gstreamer-1.0.package +++ b/packages/gstreamer-1.0/gstreamer-1.0.package @@ -17,6 +17,7 @@ class SDKPackage(custom.GStreamer, package.SDKPackage): ('gstreamer-1.0-playback', False, True), ('gstreamer-1.0-codecs', False, True), ('gstreamer-1.0-qt5', False, True), + ('gstreamer-1.0-qt6', False, True), ('gstreamer-1.0-effects', False, True), ('gstreamer-1.0-net', False, True), ('gstreamer-1.0-visualizers', False, True), diff --git a/recipes/gst-plugins-good-1.0.recipe b/recipes/gst-plugins-good-1.0.recipe index c474c982..4677642e 100644 --- a/recipes/gst-plugins-good-1.0.recipe +++ b/recipes/gst-plugins-good-1.0.recipe @@ -27,6 +27,7 @@ class Recipe(custom.GStreamer): 'oss': 'disabled', 'oss4': 'disabled', 'qt5': 'disabled', # Enabled in prepare() + 'qt6': 'disabled', # Enabled in prepare() 'shout2': 'disabled', 'twolame': 'disabled', 'waveform': 'disabled',} @@ -254,6 +255,13 @@ class Recipe(custom.GStreamer): if can_enable_qt5: self.enable_plugin('qmlgl', 'qt5', 'qt5', option='qt5') + # Enable qt6 plugin if possible and selected + can_enable_qt6 = False + if self.config.target_platform == Platform.LINUX: + can_enable_qt6 = True + if can_enable_qt6: + self.enable_plugin('qml6', 'qt6', 'qt6', option='qt6') + if self.using_msvc(): # plugin is C++, library is Autotools self.disable_plugin('taglib', 'codecs', dep='taglib') |