1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
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
|