From c26393df5820d6ad3309ab1f46a7e54f7d1d93c9 Mon Sep 17 00:00:00 2001
From: Amin Bandali <amin.bandali@savoirfairelinux.com>
Date: Mon, 16 May 2022 14:27:25 -0400
Subject: [PATCH] build: Update for Qt 6, add --no-webengine switch, add
 Parabola.

* build.py (QT5_VERSION):
(write_qt_conf): Remove (vestigial and not used anymore).
(PACMAN_BASED_DISTROS): Add parabola.
(ZYPPER_DEPENDENCIES):
(ZYPPER_CLIENT_QT_DEPENDENCIES):
(DNF_DEPENDENCIES):
(DNF_CLIENT_QT_DEPENDENCIES):
(APT_DEPENDENCIES):
(APT_CLIENT_QT_DEPENDENCIES):
(PACMAN_DEPENDENCIES):
(PACMAN_CLIENT_QT_DEPENDENCIES):
(OSX_DEPENDENCIES):
(OSX_DEPENDENCIES_UNLINK): Update dependency list for Qt 6, and move
lrc dependencies into client dependency lists.
(ZYPPER_QT_WEBENGINE):
(DNF_QT_WEBENGINE):
(APT_QT_WEBENGINE):
(PACMAN_QT_WEBENGINE): Move Qt WebEngine pacakge(s) into separate
list, so that they can be conditionally included or excluded.
(run_dependencies): Install daemon dependencies earlier than and
separately from lrc and client dependencies, mainly so that the
installation of daemon dependencies could still succeed on distros
that don't currently have Qt 6 packaged.
(run_dependencies):
(run_install):
(run_uninstall):
(run_run):
(main)
(parse_args): Add new --gnome switch, only use client-gnome when
this switch is given.  Add new --macos switch, only use client-macos
when this switch is given.  Otherwise, default to using client-qt.
Add new --no-webengine switch, disable using Qt WebEngine when this
switch is given.  Remove vestigial --qtver switch not used anymore.
Also, replace a few mentions of "Ring" with "Jami" in strings.
(validate_args): Test for minimum version of Windows 10 and do not
require an exact match/equality.

* scripts/build-windows.py (build_lrc):
(build_client):
(parsed_args): Remove vestigial and unneeded --qtver switch and its
corresponding variable.  Both make-lrc.py and make-client.py scripts
in their corresponding repositories have an up-to-date default Qt
version number, and specifying the version from this script is both
unnecessary and defeats their purpose.

* scripts/install.sh (QT6_MIN_VER): Rename to QT_MIN_VER.
(qt6ver): Remove, not used anymore.
(qt6path): Rename to qtpath.
(sys_qt6ver): Rename to sys_qtver.
(installed_qt6ver): Rename to installed_qtver.
(required_qt6ver): Rename to required_qtver.
(enable_webengine): New variable for tracking whether or not to use
Qt WebEngine.  Defaults to true.
(getopts): Add w option; when given, set enable_webengine to false.
(client_cmake_flags): Set -DWITH_WEBENGINE="${enable_webengine}".

Note: as of the time of this commit, QLibraryInfo from the qt6-base
package in Debian (and Ubuntu) currently has path issues and returns
wrong paths, stemming from '/lib' being a symlink.  This leads to
"Qt WebEngine resources not found" errors as the WebEngine tries to
find its needed resources at a wrong location '/share/qt6/resources'.
The issue has already been reported by others and a proposed patch to
fix it by disabling Qt's relocatable feature is pending review:
https://bugs.launchpad.net/ubuntu/+source/qt6-base/+bug/1970057
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1010575
In the mean time, using './build.py --install --no-webengine' to build
Jami without Qt WebEngine works.  Alternatively, using a custom build
of Qt (such as our libqt-jami) that does not suffer from this issue
would also work, using './build.py --install --qt=/usr/lib/libqt-jami'
where '/usr/lib/libqt-jami' should be the prefix directory where the
custom Qt build is installed.

GitLab: #1434
Change-Id: Ie053522de19b33871a1082ce46f3d36380a8b5aa
---
 build.py                 | 257 ++++++++++++++++++++++++---------------
 scripts/build-windows.py |   6 +-
 scripts/install.sh       |  51 ++++----
 3 files changed, 184 insertions(+), 130 deletions(-)

diff --git a/build.py b/build.py
index d2d7f0ff..93ab91b8 100755
--- a/build.py
+++ b/build.py
@@ -21,8 +21,6 @@ OSX_DISTRIBUTION_NAME = "osx"
 ANDROID_DISTRIBUTION_NAME = "android"
 WIN32_DISTRIBUTION_NAME = "win32"
 
-QT5_VERSION = "6.2.1"
-
 # vs vars
 win_sdk_default = '10.0.16299.0'
 win_toolset_default = '142'
@@ -40,7 +38,7 @@ DNF_BASED_DISTROS = [
 ]
 
 PACMAN_BASED_DISTROS = [
-    'arch',
+    'arch', 'parabola',
 ]
 
 ZYPPER_BASED_DISTROS = [
@@ -93,20 +91,30 @@ ZYPPER_DEPENDENCIES = [
     'libgnutls-devel', 'msgpack-devel', 'libavcodec-devel', 'libavdevice-devel', 'pcre-devel',
     'alsa-devel', 'libpulse-devel', 'libudev-devel', 'libva-devel', 'libvdpau-devel',
     'libopenssl-devel', 'libavutil-devel',
-    # lrc
-    'libQt5Core-devel', 'libQt5DBus-devel', 'libqt5-linguist-devel',
-    # client gnome / qt
-    'qrencode-devel', 'NetworkManager-devel'
 ]
 
 ZYPPER_CLIENT_GNOME_DEPENDENCIES = [
+    # lrc
+    'qt6-core-devel', 'qt6-dbus-devel', 'qt6-linguist-devel',
+    # client-gnome
     'gtk3-devel', 'clutter-gtk-devel', 'gettext-tools', 'libnotify-devel', 'libappindicator3-devel',
-    'webkit2gtk3-devel', 'libcanberra-gtk3-devel'
+    'webkit2gtk3-devel', 'libcanberra-gtk3-devel',
+    'qrencode-devel', 'NetworkManager-devel'
 ]
 
 ZYPPER_CLIENT_QT_DEPENDENCIES = [
-    'libqt5-qtsvg-devel', 'libqt5-qtwebengine-devel', 'libqt5-qtmultimedia-devel',
-    'libqt5-qtdeclarative-devel', 'libQt5QuickControls2-devel', 'libqt5-qtquickcontrols'
+    # lrc
+    'qt6-core-devel', 'qt6-dbus-devel', 'qt6-linguist-devel',
+    # client-qt
+    'qt6-svg-devel', 'qt6-multimedia-devel', 'qt6-declarative-devel',
+    'qt6-quickcontrols2-devel',
+    'qrencode-devel', 'NetworkManager-devel'
+]
+
+ZYPPER_QT_WEBENGINE = [
+    'qt6-webenginecore-devel',
+    'qt6-webenginequick-devel',
+    'qt6-webenginewidgets-devel'
 ]
 
 DNF_DEPENDENCIES = [
@@ -117,75 +125,112 @@ DNF_DEPENDENCIES = [
     'speex-devel', 'chrpath', 'check', 'astyle', 'uuid-c++-devel', 'gettext-devel',
     'gcc-c++', 'which', 'alsa-lib-devel', 'systemd-devel', 'libuuid-devel',
     'uuid-devel', 'gnutls-devel', 'nettle-devel', 'opus-devel', 'speexdsp-devel',
-    'yaml-cpp-devel', 'qt5-qtbase-devel', 'swig', 'jsoncpp-devel',
+    'yaml-cpp-devel', 'swig', 'jsoncpp-devel',
     'patch', 'libva-devel', 'openssl-devel', 'libvdpau-devel', 'msgpack-devel',
-    'sqlite-devel', 'openssl-static', 'pandoc', 'nasm', 'qrencode-devel', 'NetworkManager-libnm-devel',
+    'sqlite-devel', 'openssl-static', 'pandoc', 'nasm',
     'bzip2'
 ]
 
 DNF_CLIENT_GNOME_DEPENDENCIES = [
+    # lrc
+    'qt6-qtbase-devel',
+    # client-gnome
     'gtk3-devel', 'clutter-devel', 'clutter-gtk-devel', 'libnotify-devel','libappindicator-gtk3-devel',
-    'webkitgtk4-devel', 'libcanberra-devel'
+    'webkitgtk4-devel', 'libcanberra-devel',
+    'qrencode-devel', 'NetworkManager-libnm-devel'
 ]
 
 DNF_CLIENT_QT_DEPENDENCIES = [
-    'qt5-qtsvg-devel', 'qt5-qtwebengine-devel', 'qt5-qtmultimedia-devel', 'qt5-qtdeclarative-devel',
-    'qt5-qtquickcontrols2-devel', 'qt5-qtquickcontrols'
+    # lrc
+    'qt6-qtbase-devel',
+    # client-qt
+    'qt6-qtsvg-devel', 'qt6-qtmultimedia-devel', 'qt6-qtdeclarative-devel',
+    'qrencode-devel', 'NetworkManager-libnm-devel'
 ]
 
+DNF_QT_WEBENGINE = [ 'qt6-qtwebengine-devel' ]
+
 APT_DEPENDENCIES = [
     'autoconf', 'autoconf-archive', 'autopoint', 'automake', 'cmake', 'make', 'dbus', 'doxygen', 'graphviz',
     'g++', 'gettext', 'gnome-icon-theme-symbolic', 'libasound2-dev', 'libavcodec-dev',
     'libavdevice-dev', 'libavformat-dev', 'libboost-dev',
-    'libclutter-gtk-1.0-dev', 'libcppunit-dev', 'libdbus-1-dev',
+    'libcppunit-dev', 'libdbus-1-dev',
     'libdbus-c++-dev', 'libebook1.2-dev', 'libexpat1-dev', 'libgnutls28-dev',
     'libgtk-3-dev', 'libjack-dev', 'libnotify-dev',
     'libopus-dev', 'libpcre3-dev', 'libpulse-dev', 'libssl-dev',
     'libspeex-dev', 'libspeexdsp-dev', 'libswscale-dev', 'libtool',
-    'libudev-dev', 'libyaml-cpp-dev', 'qtbase5-dev', 'libqt5sql5-sqlite', 'sip-tester', 'swig',
+    'libudev-dev', 'libyaml-cpp-dev', 'sip-tester', 'swig',
     'uuid-dev', 'yasm', 'libjsoncpp-dev', 'libva-dev', 'libvdpau-dev', 'libmsgpack-dev',
-    'pandoc', 'nasm', 'libqrencode-dev', 'libnm-dev', 'dpkg-dev'
+    'pandoc', 'nasm', 'dpkg-dev'
 ]
 
 APT_CLIENT_GNOME_DEPENDENCIES = [
-    'libwebkit2gtk-4.0-dev', 'libayatana-appindicator3-dev', 'libcanberra-gtk3-dev'
+    # lrc
+    'qt6-base-dev', 'qt6-tools-dev', 'qt6-tools-dev-tools',
+    'qt6-l10n-tools', 'libqt6sql6-sqlite',
+    # client-gnome
+    'libwebkit2gtk-4.0-dev', 'libayatana-appindicator3-dev', 'libcanberra-gtk3-dev',
+    'libclutter-gtk-1.0-dev', 'libqrencode-dev', 'libnm-dev'
 ]
 
 APT_CLIENT_QT_DEPENDENCIES = [
-    'qtmultimedia5-dev', 'libqt5svg5-dev', 'qtwebengine5-dev', 'qtdeclarative5-dev',
-    'qtquickcontrols2-5-dev', 'qml-module-qtquick2', 'qml-module-qtquick-controls',
-    'qml-module-qtquick-controls2', 'qml-module-qtquick-dialogs',
-    'qml-module-qtquick-layouts', 'qml-module-qtquick-privatewidgets',
-    'qml-module-qtquick-shapes', 'qml-module-qtquick-window2',
-    'qml-module-qtquick-templates2', 'qml-module-qt-labs-platform',
-    'qml-module-qtwebengine', 'qml-module-qtwebchannel'
+    # lrc
+    'qt6-base-dev', 'qt6-tools-dev', 'qt6-tools-dev-tools',
+    'qt6-l10n-tools', 'libqt6sql6-sqlite',
+    # client-qt
+    'libqt6core5compat6-dev', 'libqt6networkauth6-dev',
+    'qt6-multimedia-dev', 'libqt6svg6-dev', 'qt6-declarative-dev',
+    'qml6-module-qt-labs-qmlmodels',
+    'qml6-module-qt5compat-graphicaleffects',
+    'qml6-module-qtqml-workerscript',
+    'qml6-module-qtmultimedia',
+    'qml6-module-qtquick', 'qml6-module-qtquick-controls',
+    'qml6-module-qtquick-dialogs', 'qml6-module-qtquick-layouts',
+    'qml6-module-qtquick-shapes', 'qml6-module-qtquick-window',
+    'qml6-module-qtquick-templates', 'qml6-module-qt-labs-platform',
+    'libqrencode-dev', 'libnm-dev'
 ]
 
+APT_QT_WEBENGINE = [
+    'libqt6webengine6-data', 'libqt6webenginecore6-bin',
+    'qt6-webengine-dev', 'qt6-webengine-dev-tools',
+    'qml6-module-qtwebengine', 'qml6-module-qtwebchannel' ]
+
 PACMAN_DEPENDENCIES = [
     'autoconf', 'autoconf-archive', 'gettext', 'cmake', 'dbus', 'doxygen', 'graphviz',
     'gcc', 'ffmpeg', 'boost', 'cppunit', 'libdbus', 'dbus-c++', 'libe-book', 'expat',
     'jack', 'opus', 'pcre', 'libpulse', 'speex', 'speexdsp', 'libtool', 'yaml-cpp',
-    'qt5-base', 'swig', 'yasm', 'qrencode', 'make', 'patch', 'pkg-config',
-    'automake', 'libva', 'libnm', 'libvdpau', 'openssl', 'pandoc', 'nasm'
+    'swig', 'yasm', 'make', 'patch', 'pkg-config',
+    'automake', 'libva', 'libvdpau', 'openssl', 'pandoc', 'nasm'
 ]
 
 PACMAN_CLIENT_GNOME_DEPENDENCIES = [
+    # lrc
+    'qt6-base',
+    # client-gnome
     'clutter-gtk','gnome-icon-theme-symbolic', 'gtk3', 'libappindicator-gtk3',
-    'libcanberra', 'libnotify', 'webkit2gtk'
+    'libcanberra', 'libnotify', 'webkit2gtk',
+    'qrencode', 'libnm'
 ]
 
 PACMAN_CLIENT_QT_DEPENDENCIES = [
-    'qt5-declarative', 'qt5-graphicaleffects', 'qt5-multimedia', 'qt5-quickcontrols',
-    'qt5-quickcontrols2', 'qt5-svg', 'qt5-tools', 'qt5-webengine'
+    # lrc
+    'qt6-base',
+    # client-qt
+    'qt6-declarative', 'qt6-graphicaleffects', 'qt6-multimedia',
+    'qt6-svg', 'qt6-tools',
+    'qrencode', 'libnm'
 ]
 
+PACMAN_QT_WEBENGINE = [ 'qt6-webengine' ]
+
 OSX_DEPENDENCIES = [
-    'autoconf', 'cmake', 'gettext', 'pkg-config', 'qt5',
+    'autoconf', 'cmake', 'gettext', 'pkg-config', 'qt6',
     'libtool', 'yasm', 'nasm', 'automake'
 ]
 
 OSX_DEPENDENCIES_UNLINK = [
-    'autoconf*', 'cmake*', 'gettext*', 'pkg-config*', 'qt*', 'qt@5.*',
+    'autoconf*', 'cmake*', 'gettext*', 'pkg-config*', 'qt*', 'qt@6.*',
     'libtool*', 'yasm*', 'nasm*', 'automake*', 'gnutls*', 'nettle*', 'msgpack*'
 ]
 
@@ -215,64 +260,70 @@ def run_powersell_cmd(cmd):
     return
 
 
-def write_qt_conf(path, qt5version=QT5_VERSION):
-    # Add a configuration that can be supplied to qmake
-    # e.g. `qmake -qt=5.15 [mode] [options] [files]`
-    if path == '':
-        return
-    with open('/usr/share/qtchooser/' + qt5version + '.conf', 'w+') as fd:
-        fd.write(path.rstrip('/') + '/bin\n')
-        fd.write(path.rstrip('/') + '/lib\n')
-    return
-
-
 def run_dependencies(args):
-    if args.qt is not None:
-        write_qt_conf(args.qt, args.qtver)
-
     if args.distribution == WIN32_DISTRIBUTION_NAME:
         run_powersell_cmd(
             'Set-ExecutionPolicy Unrestricted; .\\scripts\\install-deps-windows.ps1')
 
     elif args.distribution in APT_BASED_DISTROS:
-        if args.qt is None:
-            APT_DEPENDENCIES.extend(APT_CLIENT_GNOME_DEPENDENCIES)
-        else:
-            APT_DEPENDENCIES.extend(APT_CLIENT_QT_DEPENDENCIES)
         execute_script(
             APT_INSTALL_SCRIPT,
-            {"packages": ' '.join(map(shlex.quote, APT_DEPENDENCIES))}
-        )
+            {"packages": ' '.join(map(shlex.quote, APT_DEPENDENCIES))})
+        if not args.gnome:
+            if not args.no_webengine:
+                APT_CLIENT_QT_DEPENDENCIES.extend(APT_QT_WEBENGINE)
+            execute_script(
+                APT_INSTALL_SCRIPT,
+                {"packages": ' '.join(map(shlex.quote, APT_CLIENT_QT_DEPENDENCIES))})
+        else:
+            execute_script(
+                APT_INSTALL_SCRIPT,
+                {"packages": ' '.join(map(shlex.quote, APT_CLIENT_GNOME_DEPENDENCIES))})
 
     elif args.distribution in DNF_BASED_DISTROS:
-        if args.qt is None:
-            DNF_DEPENDENCIES.extend(DNF_CLIENT_GNOME_DEPENDENCIES)
-        else:
-            DNF_DEPENDENCIES.extend(DNF_CLIENT_QT_DEPENDENCIES)
         execute_script(
             RPM_INSTALL_SCRIPT,
-            {"packages": ' '.join(map(shlex.quote, DNF_DEPENDENCIES))}
-        )
+            {"packages": ' '.join(map(shlex.quote, DNF_DEPENDENCIES))})
+        if not args.gnome:
+            if not args.no_webengine:
+                DNF_CLIENT_QT_DEPENDENCIES.extend(DNF_QT_WEBENGINE)
+            execute_script(
+                RPM_INSTALL_SCRIPT,
+                {"packages": ' '.join(map(shlex.quote, DNF_CLIENT_QT_DEPENDENCIES))})
+        else:
+            execute_script(
+                RPM_INSTALL_SCRIPT,
+                {"packages": ' '.join(map(shlex.quote, DNF_CLIENT_GNOME_DEPENDENCIES))})
 
     elif args.distribution in PACMAN_BASED_DISTROS:
-        if args.qt is None:
-            PACMAN_DEPENDENCIES.extend(PACMAN_CLIENT_GNOME_DEPENDENCIES)
-        else:
-            PACMAN_DEPENDENCIES.extend(PACMAN_CLIENT_QT_DEPENDENCIES)
         execute_script(
             PACMAN_INSTALL_SCRIPT,
-            {"packages": ' '.join(map(shlex.quote, PACMAN_DEPENDENCIES))}
-        )
+            {"packages": ' '.join(map(shlex.quote, PACMAN_DEPENDENCIES))})
+        if not args.gnome:
+            if not args.no_webengine:
+                PACMAN_CLIENT_QT_DEPENDENCIES.extend(PACMAN_QT_WEBENGINE)
+            execute_script(
+                PACMAN_INSTALL_SCRIPT,
+                {"packages": ' '.join(map(shlex.quote, PACMAN_CLIENT_QT_DEPENDENCIES))})
+        else:
+            execute_script(
+                PACMAN_INSTALL_SCRIPT,
+                {"packages": ' '.join(map(shlex.quote, PACMAN_CLIENT_GNOME_DEPENDENCIES))})
 
     elif args.distribution in ZYPPER_BASED_DISTROS:
-        if args.qt is None:
-            ZYPPER_DEPENDENCIES.extend(ZYPPER_CLIENT_GNOME_DEPENDENCIES)
-        else:
-            ZYPPER_DEPENDENCIES.extend(ZYPPER_CLIENT_QT_DEPENDENCIES)
         execute_script(
             ZYPPER_INSTALL_SCRIPT,
-            {"packages": ' '.join(map(shlex.quote, ZYPPER_DEPENDENCIES))}
-        )
+            {"packages": ' '.join(map(shlex.quote, ZYPPER_DEPENDENCIES))})
+        if not args.gnome:
+            if not args.no_webengine:
+                ZYPPER_CLIENT_QT_DEPENDENCIES.extend(ZYPPER_QT_WEBENGINE)
+            execute_script(
+                ZYPPER_INSTALL_SCRIPT,
+                {"packages": ' '.join(map(shlex.quote, ZYPPER_CLIENT_QT_DEPENDENCIES))})
+        else:
+            execute_script(
+                ZYPPER_INSTALL_SCRIPT,
+                {"packages": ' '.join(map(shlex.quote, ZYPPER_CLIENT_GNOME_DEPENDENCIES))})
 
     elif args.distribution == OSX_DISTRIBUTION_NAME:
         execute_script(
@@ -360,8 +411,7 @@ def run_install(args):
             sys.executable, os.path.join(
                 os.getcwd(), "scripts/build-windows.py"),
             "--toolset", args.toolset,
-            "--sdk", args.sdk,
-            "--qtver", args.qtver
+            "--sdk", args.sdk
         ], check=True)
 
     # Unix-like platforms
@@ -380,33 +430,35 @@ def run_install(args):
         install_args.append('-d')
     if args.no_libwrap:
         install_args.append('-W')
+    if args.no_webengine:
+        install_args.append('-w')
 
     if args.distribution == OSX_DISTRIBUTION_NAME:
         # The `universal_newlines` parameter has been renamed to `text` in
         # Python 3.7+ and triggering automatical binary to text conversion is
         # what it actually does
-        proc = subprocess.run(["brew", "--prefix", "qt5"],
+        proc = subprocess.run(["brew", "--prefix", "qt6"],
                               stdout=subprocess.PIPE, check=True,
                               universal_newlines=True)
 
         environ['CMAKE_PREFIX_PATH'] = proc.stdout.rstrip("\n")
         environ['CONFIGURE_FLAGS'] = '--without-dbus'
-        if args.qt is None:
-            install_args += ("-c", "client-macosx")
-        else:
+        if args.macos is None:
             install_args += ("-c", "client-qt")
-            install_args += ("-q", args.qtver)
-            install_args += ("-Q", args.qt)
+            if args.qt is not None:
+                install_args += ("-Q", args.qt)
+        else:
+            install_args += ("-c", "client-macosx")
     else:
         if args.distribution in ZYPPER_BASED_DISTROS:
             # fix jsoncpp pkg-config bug, remove when jsoncpp package bumped
             environ['JSONCPP_LIBS'] = "-ljsoncpp"
-        if args.qt is None:
-            install_args += ("-c", "client-gnome")
-        else:
+        if not args.gnome:
             install_args += ("-c", "client-qt")
-            install_args += ("-q", args.qtver)
-            install_args += ("-Q", args.qt)
+            if args.qt is not None:
+                install_args += ("-Q", args.qt)
+        else:
+            install_args += ("-c", "client-gnome")
 
     command = ['bash', 'scripts/install.sh'] + install_args
 
@@ -441,7 +493,7 @@ def run_uninstall(args):
     else:
         execute_script(UNINSTALL_DAEMON_SCRIPT)
 
-        CLIENT_SUFFIX = 'qt' if (args.qt is not None) else 'gnome'
+        CLIENT_SUFFIX = 'qt' if (not args.gnome) else 'gnome'
         INSTALL_DIR = '/build-global' if args.global_install else '/build-local'
 
         # Client needs to be uninstalled first
@@ -489,7 +541,7 @@ def run_run(args):
             f.write(str(jamid_process.pid)+'\n')
 
         client_suffix = ""
-        if args.qt is not None:
+        if not args.gnome:
             client_suffix += "qt"
         else:
             client_suffix += "gnome"
@@ -538,7 +590,7 @@ def run_run(args):
 
 
 def run_stop(args):
-    client_suffix = "qt" if (args.qt is not None) else "gnome"
+    client_suffix = "qt" if (not args.gnome) else "gnome"
     STOP_SCRIPT = [
         'xargs kill < jami-' + client_suffix + '.pid',
         'xargs kill < daemon.pid'
@@ -594,7 +646,7 @@ def validate_args(parsed_args):
         sys.exit(1)
 
     # The Qt client support will be added incrementally.
-    if parsed_args.qt is not None:
+    if not parsed_args.gnome:
         supported_qt_distros = [
             'guix',
             OSX_DISTRIBUTION_NAME,
@@ -608,39 +660,39 @@ def validate_args(parsed_args):
                   ), file=sys.stderr)
             sys.exit(1)
 
-    # The windows client can only be built on a Windows 10 host.
+    # On Windows, version 10 or later is needed to build Jami.
     if parsed_args.distribution == WIN32_DISTRIBUTION_NAME:
-        if platform.release() != '10':
-            print('Windows version must be built on Windows 10')
+        if hasattr(sys, 'getwindowsversion') and sys.getwindowsversion()[0] < 10:
+            print('Windows 10 or later is needed to build Jami')
             sys.exit(1)
 
 
 def parse_args():
-    ap = argparse.ArgumentParser(description="Ring build tool")
+    ap = argparse.ArgumentParser(description="Jami build tool")
 
     ga = ap.add_mutually_exclusive_group(required=True)
     ga.add_argument(
         '--init', action='store_true',
-        help='Init Ring repository')
+        help='Init Jami repository')
     ga.add_argument(
         '--dependencies', action='store_true',
-        help='Install ring build dependencies')
+        help='Install Jami build dependencies')
     ga.add_argument(
         '--install', action='store_true',
-        help='Build and install Ring')
+        help='Build and install Jami')
     ga.add_argument(
         '--clean', action='store_true',
         help='Call "git clean" on every repository of the project'
     )
     ga.add_argument(
         '--uninstall', action='store_true',
-        help='Uninstall Ring')
+        help='Uninstall Jami')
     ga.add_argument(
         '--run', action='store_true',
-        help='Run the Ring daemon and client')
+        help='Run the Jami daemon and client')
     ga.add_argument(
         '--stop', action='store_true',
-        help='Stop the Ring processes')
+        help='Stop the Jami processes')
 
     ap.add_argument('--distribution')
     ap.add_argument('--prefix')
@@ -651,13 +703,16 @@ def parse_args():
     ap.add_argument('--background', default=False, action='store_true')
     ap.add_argument('--no-priv-install', dest='priv_install',
                     default=True, action='store_false')
+    ap.add_argument('--gnome', default=False, action='store_true')
+    ap.add_argument('--macos', default=False, action='store_true')
     ap.add_argument('--qt', nargs='?', const='', type=str,
                     help='Build the Qt client with the Qt path supplied')
-    ap.add_argument('--qtver', default=QT5_VERSION,
-                    help='Sets the Qt version to build with')
     ap.add_argument('--no-libwrap', dest='no_libwrap',
                     default=False, action='store_true',
                     help='Disable libwrap. Also set --disable-shared option to daemon configure')
+    ap.add_argument('--no-webengine', dest='no_webengine',
+                    default=False, action='store_true',
+                    help='Do not use Qt WebEngine.')
 
     dist = choose_distribution()
 
@@ -723,7 +778,7 @@ def main():
     elif parsed_args.run:
         if (parsed_args.distribution == 'guix'
                 and 'GUIX_ENVIRONMENT' not in os.environ):
-            if parsed_args.qt is not None:
+            if not parsed_args.gnome:
                 print('FIXME: Qt fails loading QML modules due to '
                       'https://issues.guix.gnu.org/47655')
             # Relaunch this script, this time in a pure Guix environment.
diff --git a/scripts/build-windows.py b/scripts/build-windows.py
index 97c8c417..78e5e7a0 100644
--- a/scripts/build-windows.py
+++ b/scripts/build-windows.py
@@ -24,13 +24,13 @@ def build_daemon(parsed_args):
 
 def build_lrc(parsed_args):
     make_cmd = os.path.dirname(this_dir) + '\\lrc\\make-lrc.py'
-    execute_cmd('python ' + make_cmd + ' -q ' + parsed_args.qtver)
+    execute_cmd('python ' + make_cmd)
 
 
 def build_client(parsed_args):
     os.chdir('./client-qt')
     execute_cmd('python make-client.py init')
-    execute_cmd('python make-client.py' + ' -q ' + parsed_args.qtver)
+    execute_cmd('python make-client.py')
 
 
 def parse_args():
@@ -40,8 +40,6 @@ def parse_args():
                     help='Windows use only, specify Visual Studio toolset version')
     ap.add_argument('--sdk', default='', type=str,
                     help='Windows use only, specify Windows SDK version')
-    ap.add_argument('--qtver', default='5.15.0',
-                    help='Sets the Qt version to build with')
 
     parsed_args = ap.parse_args()
 
diff --git a/scripts/install.sh b/scripts/install.sh
index 8d75b6f4..2f5bb251 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -11,23 +11,24 @@ export OSTYPE
   # -p: number of processors to use
   # -u: disable use of privileges (sudo) during install
   # -W: disable libwrap and shared library
+  # -w: do not use Qt WebEngine
 
 set -ex
 
 # Qt_MIN_VER required for client-qt
-QT6_MIN_VER="6.2"
+QT_MIN_VER="6.2"
 
 debug=
 global=false
 static=''
 client=''
-qt6ver=''
-qt6path=''
+qtpath=''
 proc='1'
 priv_install=true
 enable_libwrap=true
+enable_webengine=true
 
-while getopts gsc:dq:Q:P:p:uW OPT; do
+while getopts gsc:dQ:P:p:uWw OPT; do
   case "$OPT" in
     g)
       global='true'
@@ -41,11 +42,8 @@ while getopts gsc:dq:Q:P:p:uW OPT; do
     d)
       debug=true
     ;;
-    q)
-      qt6ver="${OPTARG}"
-    ;;
     Q)
-      qt6path="${OPTARG}"
+      qtpath="${OPTARG}"
     ;;
     P)
       prefix="${OPTARG}"
@@ -59,6 +57,9 @@ while getopts gsc:dq:Q:P:p:uW OPT; do
     W)
       enable_libwrap='false'
     ;;
+    w)
+      enable_webengine='false'
+    ;;
     \?)
       exit 1
     ;;
@@ -124,28 +125,27 @@ make -j"${proc}" V=1
 make_install "${global}" "${priv_install}"
 
 # For the client-qt, verify system's version if no path provided
-if [ "${client}" = "client-qt" ] && [ -z "$qt6path" ]; then
-    sys_qt6ver=""
-    if command -v qmake &> /dev/null; then
-        sys_qt6ver=$(qmake -v)
+if [ "${client}" = "client-qt" ] && [ -z "$qtpath" ]; then
+    sys_qtver=""
+    if command -v qmake6 &> /dev/null; then
+        sys_qtver=$(qmake6 -v)
     elif command -v qmake-qt6 &> /dev/null; then
-        sys_qt6ver=$(qmake-qt6 -v)   # Fedora
-    elif command -v qmake6 &> /dev/null; then
-        sys_qt6ver=$(qmake6 -v) # macOS
+        sys_qtver=$(qmake-qt6 -v) # Fedora
+    elif command -v qmake &> /dev/null; then
+        sys_qtver=$(qmake -v)
     else
         echo "No valid Qt found"; exit 1;
     fi
 
-    sys_qt6ver=${sys_qt6ver#*Qt version}
-    sys_qt6ver=${sys_qt6ver%\ in\ *}
+    sys_qtver=${sys_qtver#*Qt version}
+    sys_qtver=${sys_qtver%\ in\ *}
 
-    installed_qt6ver=$(echo "$sys_qt6ver" | cut -d'.' -f 2)
-    required_qt6ver=$(echo $QT6_MIN_VER | cut -d'.' -f 2)
+    installed_qtver=$(echo "$sys_qtver" | cut -d'.' -f 2)
+    required_qtver=$(echo $QT_MIN_VER | cut -d'.' -f 2)
 
-    if [[ $installed_qt6ver -ge $required_qt6ver ]] ; then
-        # Disable qt6path and qt6ver in order to use system's Qt
-        qt6path=""
-        qt6ver=""
+    if [[ $installed_qtver -ge $required_qtver ]] ; then
+        # Set qtpath to empty in order to use system's Qt.
+        qtpath=""
     else
         echo "No valid Qt found"; exit 1;
     fi
@@ -156,7 +156,7 @@ cd "${TOP}/lrc"
 mkdir -p "${BUILDDIR}"
 cd "${BUILDDIR}"
 # Compute LRC CMake flags
-lrc_cmake_flags=(-DCMAKE_PREFIX_PATH="${qt6path}"
+lrc_cmake_flags=(-DCMAKE_PREFIX_PATH="${qtpath}"
                  -DCMAKE_BUILD_TYPE="${BUILD_TYPE}"
                  -DENABLE_LIBWRAP="${enable_libwrap}"
                  $static)
@@ -177,9 +177,10 @@ mkdir -p "${BUILDDIR}"
 cd "${BUILDDIR}"
 
 client_cmake_flags=(-DCMAKE_BUILD_TYPE="${BUILD_TYPE}"
-                    -DCMAKE_PREFIX_PATH="${qt6path}")
+                    -DCMAKE_PREFIX_PATH="${qtpath}")
 
 if [ "${client}" = "client-qt" ]; then
+    client_cmake_flags+=(-DWITH_WEBENGINE="${enable_webengine}")
     if [ "${global}" = "true" ]; then
         client_cmake_flags+=(${prefix:+"-DCMAKE_INSTALL_PREFIX=$prefix"}
                              $static)
-- 
GitLab