overlay/www-client/chromium/files/chromium-134-qt5-optional.patch
2025-01-29 00:03:07 +00:00

133 lines
4 KiB
Diff

https://chromium.googlesource.com/chromium/src/+/0d8d0e0943489b59e452b4d0214959821880ad7f
From: Matt Jolly <kangie@gentoo.org>
Date: Tue, 28 Jan 2025 12:00:57 -0800
Subject: [PATCH] UI: make QT5 optional
To build with `use_qt6`, QT5 (`use_qt`) is also required.
This is undesirable for downstreams who are actively working
to drop support for QT5 (e.g. Gentoo).
To resolve this:
- Add `use_qt5`
- Replace most `use_qt` conditionals with this option;
these appear to be from before QT6 support was added.
- Use `use_qt5` to gate some previously unconditional QT5-related
items in chrome/installer/linux
- Remove `use_qt` as an argument, instead set to `use_qt5 || use_qt6`.
This change should not impact the current behaviour; if no options
are selected QT5 and QT6 support will be enabled, using existing logic
unless one is explicitly disabled with `use_qt{x}=false`.
See-also: https://bugs.gentoo.org/926166, https://bugs.gentoo.org/948836
Signed-off-by: Matt Jolly <kangie@gentoo.org>
Fixed: 328182252
Change-Id: I22ec7a068356412d3f9fce68a19aee4f8c89892c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6205488
Reviewed-by: Thomas Anderson <thomasanderson@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1412471}
--- a/chrome/installer/linux/BUILD.gn
+++ b/chrome/installer/linux/BUILD.gn
@@ -77,10 +77,10 @@ if (enable_swiftshader) {
packaging_files += [ "$root_out_dir/vk_swiftshader_icd.json" ]
}
-if (use_qt) {
- # Even though this is a shared library, add it to `packaging_files` instead of
- # `packaging_files_shlibs` to skip the dependency check. This is intentional
- # to prevent a hard dependency on QT for the package.
+# Even though this is a shared library, add it to `packaging_files` instead of
+# `packaging_files_shlibs` to skip the dependency check. This is intentional
+# to prevent a hard dependency on QT for the package.
+if (use_qt5) {
packaging_files += [ "$root_out_dir/libqt5_shim.so" ]
}
if (use_qt6) {
@@ -206,7 +206,7 @@ if (build_with_internal_optimization_guide) {
}
}
-if (use_qt) {
+if (use_qt5) {
strip_binary("strip_qt5_shim") {
binary_input = "$root_out_dir/libqt5_shim.so"
deps = [ "//ui/qt:qt5_shim" ]
@@ -399,7 +399,7 @@ group("installer_deps") {
"//components/optimization_guide/internal:optimization_guide_internal",
]
}
- if (use_qt) {
+ if (use_qt5) {
public_deps += [
":strip_qt5_shim",
"//ui/qt:qt5_shim",
--- a/ui/qt/BUILD.gn
+++ b/ui/qt/BUILD.gn
@@ -101,10 +101,12 @@ template("qt_shim") {
}
}
}
-qt_shim("qt5_shim") {
- qt_version = "5"
- if (!use_sysroot) {
- moc_qt_path = "$moc_qt5_path"
+if (use_qt5) {
+ qt_shim("qt5_shim") {
+ qt_version = "5"
+ if (!use_sysroot) {
+ moc_qt_path = "$moc_qt5_path"
+ }
}
}
if (use_qt6) {
@@ -122,7 +124,10 @@ component("qt") {
defines = [ "IS_QT_IMPL" ]
# qt_shim is in data_deps since we want to load it manually.
- data_deps = [ ":qt5_shim" ]
+ data_deps = []
+ if (use_qt5) {
+ data_deps += [ ":qt5_shim" ]
+ }
if (use_qt6) {
data_deps += [ ":qt6_shim" ]
}
--- a/ui/qt/qt.gni
+++ b/ui/qt/qt.gni
@@ -6,27 +6,20 @@ import("//build/config/cast.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/sysroot.gni")
+# TODO(crbug.com/40260415): Allow QT in MSAN builds once QT is
+# added to the instrumented libraries.
declare_args() {
- # TODO(crbug.com/40260415): Allow QT in MSAN builds once QT is
- # added to the instrumented libraries.
- use_qt = is_linux && !is_castos && !is_msan
+ use_qt5 = use_sysroot && is_linux && !is_castos && !is_msan
+ use_qt6 = use_sysroot && is_linux && !is_castos && !is_msan
}
declare_args() {
- if (!use_sysroot && use_qt) {
+ if (!use_sysroot && use_qt5) {
moc_qt5_path = ""
}
-}
-
-declare_args() {
- use_qt6 = use_qt && use_sysroot
-}
-
-declare_args() {
if (!use_sysroot && use_qt6) {
moc_qt6_path = ""
}
}
-# use_qt6 => use_qt
-assert(!use_qt6 || use_qt)
+use_qt = use_qt5 || use_qt6