Diff qtwebengine-5.15.10_p20230815 with a qtwebengine-6.5.2-r1

/usr/portage/dev-qt/qtwebengine/qtwebengine-6.5.2-r1.ebuild 2023-10-09 14:52:30.416368373 +0300
1
# Copyright 1999-2023 Gentoo Authors
1
# Copyright 2021-2023 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4 4
EAPI=8
5 5

  
6
PATCHSET="${P}-patchset"
6
# py3.12: uses imp and distutils among potentially more issues, refer to
7
# www-client/chromium for when adding/backporting support may be viable
7 8
PYTHON_COMPAT=( python3_{10..11} )
8 9
PYTHON_REQ_USE="xml(+)"
9
inherit check-reqs estack flag-o-matic multiprocessing python-any-r1 qt5-build toolchain-funcs
10
inherit check-reqs flag-o-matic multiprocessing optfeature
11
inherit prefix python-any-r1 qt6-build toolchain-funcs
10 12

  
11
DESCRIPTION="Library for rendering dynamic web content in Qt5 C++ and QML applications"
12
HOMEPAGE="https://www.qt.io/"
13
DESCRIPTION="Library for rendering dynamic web content in Qt6 C++ and QML applications"
14
SRC_URI+="
15
	https://dev.gentoo.org/~ionen/distfiles/${PN}-6.5-patchset-1.tar.xz
16
"
13 17

  
14
if [[ ${QT5_BUILD_TYPE} == release ]]; then
15
	KEYWORDS="amd64 ~arm ~arm64 ~ppc64 ~x86"
16
	if [[ ${PV} == ${QT5_PV}_p* ]]; then
17
		SRC_URI="https://dev.gentoo.org/~asturm/distfiles/${P}.tar.xz"
18
		S="${WORKDIR}/${P}"
19
		QT5_BUILD_DIR="${S}_build"
20
	fi
21
else
22
	EGIT_BRANCH="5.15"
23
	EGIT_REPO_URI=(
24
		"https://code.qt.io/qt/${QT5_MODULE}.git"
25
		"https://github.com/qt/${QT5_MODULE}.git"
26
	)
27
	inherit git-r3
18
if [[ ${QT6_BUILD_TYPE} == release ]]; then
19
	KEYWORDS="amd64"
28 20
fi
29 21

  
30
# ppc64 patchset based on https://github.com/chromium-ppc64le releases
31
SRC_URI+=" https://dev.gentoo.org/~asturm/distfiles/${PATCHSET}.tar.xz
32
	ppc64? ( https://dev.gentoo.org/~gyakovlev/distfiles/${PN}-5.15.2-r1-chromium87-ppc64le.tar.xz )"
33

  
34
IUSE="alsa bindist designer geolocation +jumbo-build kerberos pulseaudio screencast +system-icu widgets"
35
REQUIRED_USE="designer? ( widgets )"
22
IUSE="
23
	+alsa bindist custom-cflags designer geolocation +jumbo-build kerberos
24
	opengl pulseaudio qml screencast +system-icu vulkan +widgets
25
"
26
REQUIRED_USE="
27
	designer? ( qml widgets )
28
"
36 29

  
30
# dlopen: krb5, pciutils, udev
37 31
RDEPEND="
38 32
	app-arch/snappy:=
39
	dev-libs/glib:2
40
	dev-libs/nspr
41
	dev-libs/nss
42 33
	dev-libs/expat
43 34
	dev-libs/libevent:=
44 35
	dev-libs/libxml2[icu]
45 36
	dev-libs/libxslt
46
	dev-libs/re2:=
47
	=dev-qt/qtcore-${QT5_PV}*
48
	=dev-qt/qtdeclarative-${QT5_PV}*
49
	=dev-qt/qtgui-${QT5_PV}*
50
	=dev-qt/qtnetwork-${QT5_PV}*
51
	=dev-qt/qtprintsupport-${QT5_PV}*
52
	=dev-qt/qtwebchannel-${QT5_PV}*[qml]
37
	dev-libs/nspr
38
	dev-libs/nss
39
	~dev-qt/qtbase-${PV}:6[gui,opengl=,vulkan?,widgets?]
40
	~dev-qt/qtwebchannel-${PV}:6[qml?]
53 41
	media-libs/fontconfig
54 42
	media-libs/freetype
55 43
	media-libs/harfbuzz:=
56 44
	media-libs/lcms:2
57 45
	media-libs/libjpeg-turbo:=
58
	media-libs/libpng:0=
59
	>=media-libs/libvpx-1.5:=[svc(+)]
46
	media-libs/libpng:=
47
	media-libs/libvpx:=
60 48
	media-libs/libwebp:=
49
	media-libs/openjpeg:2=
61 50
	media-libs/opus
62 51
	sys-apps/dbus
63 52
	sys-apps/pciutils
64
	sys-libs/zlib[minizip]
53
	sys-libs/zlib:=[minizip]
65 54
	virtual/libudev
66
	x11-libs/libdrm
67 55
	x11-libs/libX11
68 56
	x11-libs/libXcomposite
69
	x11-libs/libXcursor
70 57
	x11-libs/libXdamage
71 58
	x11-libs/libXext
72 59
	x11-libs/libXfixes
73
	x11-libs/libXi
74
	x11-libs/libxkbfile
75 60
	x11-libs/libXrandr
76
	x11-libs/libXrender
77
	x11-libs/libXScrnSaver
78 61
	x11-libs/libXtst
62
	x11-libs/libxcb:=
63
	x11-libs/libxkbcommon
64
	x11-libs/libxkbfile
79 65
	alsa? ( media-libs/alsa-lib )
80
	designer? ( =dev-qt/designer-${QT5_PV}* )
81
	geolocation? ( =dev-qt/qtpositioning-${QT5_PV}* )
66
	designer? ( ~dev-qt/qttools-${PV}:6[designer] )
67
	geolocation? ( ~dev-qt/qtpositioning-${PV}:6 )
82 68
	kerberos? ( virtual/krb5 )
83
	pulseaudio? ( media-libs/libpulse )
84
	screencast? ( media-video/pipewire:= )
85
	system-icu? ( >=dev-libs/icu-69.1:= )
86
	widgets? (
87
		=dev-qt/qtdeclarative-${QT5_PV}*[widgets]
88
		=dev-qt/qtwidgets-${QT5_PV}*
69
	pulseaudio? ( media-libs/libpulse[glib] )
70
	qml? ( ~dev-qt/qtdeclarative-${PV}:6 )
71
	screencast? (
72
		dev-libs/glib:2
73
		media-libs/mesa[gbm(+)]
74
		media-video/pipewire:=
75
		x11-libs/libdrm
89 76
	)
77
	system-icu? ( dev-libs/icu:= )
78
	widgets? ( ~dev-qt/qtdeclarative-${PV}:6[widgets] )
90 79
"
91
DEPEND="${RDEPEND}
80
DEPEND="
81
	${RDEPEND}
92 82
	media-libs/libglvnd
83
	x11-base/xorg-proto
84
	x11-libs/libxshmfence
85
	screencast? ( media-libs/libepoxy[egl(+)] )
86
	test? (
87
		widgets? ( app-text/poppler[cxx(+)] )
88
	)
93 89
"
94
BDEPEND="${PYTHON_DEPS}
90
BDEPEND="
91
	$(python_gen_any_dep 'dev-python/html5lib[${PYTHON_USEDEP}]')
95 92
	dev-util/gperf
96
	dev-util/ninja
97
	dev-util/re2c
98 93
	net-libs/nodejs[ssl]
99 94
	sys-devel/bison
100 95
	sys-devel/flex
101
	ppc64? ( >=dev-util/gn-0.1807 )
102 96
"
103 97

  
104
PATCHES=( "${WORKDIR}/${PATCHSET}" )
98
PATCHES=( "${WORKDIR}"/patches/${PN} )
99
[[ ${PV} == 6.9999 ]] || # keep for 6.x.9999
100
	PATCHES+=( "${WORKDIR}"/patches/chromium )
101

  
102
PATCHES+=(
103
	# add extras as needed here, may merge in set if carries across versions
104
	"${FILESDIR}"/${PN}-6.5.2-libcxx17.patch
105
	"${FILESDIR}"/${PN}-6.5.2-cstdint.patch
106
)
105 107

  
106
qtwebengine_check-reqs() {
107
	# bug #307861
108
	eshopts_push -s extglob
109
	if is-flagq '-g?(gdb)?([1-9])'; then
110
		ewarn "You have enabled debug info (probably have -g or -ggdb in your CFLAGS/CXXFLAGS)."
111
		ewarn "You may experience really long compilation times and/or increased memory usage."
112
		ewarn "If compilation fails, please try removing -g/-ggdb before reporting a bug."
113
	fi
114
	eshopts_pop
108
python_check_deps() {
109
	python_has_version "dev-python/html5lib[${PYTHON_USEDEP}]"
110
}
115 111

  
112
qtwebengine_check-reqs() {
116 113
	[[ ${MERGE_TYPE} == binary ]] && return
117 114

  
118
	# (check-reqs added for bug #570534)
119
	#
120
	# Estimate the amount of RAM required
121
	# Multiplier is *10 because Bash doesn't do floating point maths.
122
	# Let's crudely assume ~2GB per compiler job for GCC.
123
	local multiplier=20
124

  
125
	# And call it ~1.5GB for Clang.
126
	if tc-is-clang ; then
127
		multiplier=15
115
	if is-flagq '-g?(gdb)?([1-9])'; then #307861
116
		ewarn
117
		ewarn "Used CFLAGS/CXXFLAGS seem to enable debug info (-g or -ggdb), which"
118
		ewarn "is non-trivial with ${PN}. May experience extended compilation"
119
		ewarn "times, increased disk/memory usage, and potentially link failure."
120
		ewarn
121
		ewarn "If run into issues, please try disabling before reporting a bug."
128 122
	fi
129 123

  
130
	local CHECKREQS_DISK_BUILD="7G"
131
	local CHECKREQS_DISK_USR="150M"
132
	if ! has "distcc" ${FEATURES} ; then
133
		# bug #830661
134
		# Not super realistic to come up with good estimates for distcc right now
135
		local CHECKREQS_MEMORY=$(($(makeopts_jobs)*multiplier/10))G
124
	local CHECKREQS_DISK_BUILD=7G
125
	local CHECKREQS_DISK_USR=220M
126

  
127
	if ! has distcc ${FEATURES}; then #830661
128
		# assume ~2GB per job or 1.5GB if clang, possible with less
129
		# depending on free memory and *FLAGS, but prefer being safe as
130
		# users having OOM issues with qtwebengine been rather common
131
		tc-is-clang && : 15 || : 20
132
		local CHECKREQS_MEMORY=$(($(makeopts_jobs)*_/10))G
136 133
	fi
137 134

  
138
	check-reqs_${EBUILD_PHASE_FUNC}
135
	check-reqs_${EBUILD_PHASE_FUNC} #570534
139 136
}
140 137

  
141 138
pkg_pretend() {
......
147 144
	python-any-r1_pkg_setup
148 145
}
149 146

  
150
src_unpack() {
151
	case ${QT5_BUILD_TYPE} in
152
		live)    git-r3_src_unpack ;&
153
		release) default ;;
154
	esac
155
}
156

  
157 147
src_prepare() {
158
	if [[ ${PV} == ${QT5_PV}_p* ]]; then
159
		# This is made from git, and for some reason will fail w/o .git directories.
160
		mkdir -p .git src/3rdparty/chromium/.git || die
161
	fi
162
	# We need to make sure this integrates well into Qt 5.15.3 installation.
163
	# Otherwise revdeps fail w/o heavy changes. This is the simplest way to do it.
164
	# See also: https://www.qt.io/blog/building-qt-webengine-against-other-qt-versions
165
	sed -E "/^MODULE_VERSION/s/5\.15\.[0-9]+/${QT5_PV}/" -i .qmake.conf || die
166

  
167
	# QTBUG-88657 - jumbo-build could still make trouble
168
	if ! use jumbo-build; then
169
		sed -i -e 's|use_jumbo_build=true|use_jumbo_build=false|' \
170
			src/buildtools/config/common.pri || die
171
	fi
148
	qt6-build_src_prepare
172 149

  
173
	# bug 620444 - ensure local headers are used
174
	find "${S}" -type f -name "*.pr[fio]" | \
175
		xargs sed -i -e 's|INCLUDEPATH += |&$${QTWEBENGINE_ROOT}_build/include $${QTWEBENGINE_ROOT}/include |' || die
176

  
177
	if use system-icu; then
178
		# Sanity check to ensure that bundled copy of ICU is not used.
179
		# Whole src/3rdparty/chromium/third_party/icu directory cannot be deleted because
180
		# src/3rdparty/chromium/third_party/icu/BUILD.gn is used by build system.
181
		# If usage of headers of bundled copy of ICU occurs, then lists of shim headers in
182
		# shim_headers("icui18n_shim") and shim_headers("icuuc_shim") in
183
		# src/3rdparty/chromium/third_party/icu/BUILD.gn should be updated.
184
		local file
185
		while read file; do
186
			echo "#error This file should not be used!" > "${file}" || die
187
		done < <(find src/3rdparty/chromium/third_party/icu -type f "(" -name "*.c" -o -name "*.cpp" -o -name "*.h" ")" 2>/dev/null)
188
	fi
150
	# for www-plugins/chrome-binary-plugins (widevine) search paths on prefix
151
	hprefixify -w /Gentoo/ src/core/content_client_qt.cpp
189 152

  
190
	# src/3rdparty/gn fails with libc++ due to passing of `-static-libstdc++`
191
	if tc-is-clang ; then
192
		if has_version 'sys-devel/clang[default-libcxx(-)]' || has_version 'sys-devel/clang-common[default-libcxx(-)]' ; then
193
			eapply "${FILESDIR}/${PN}-5.15.2_p20210521-clang-libc++.patch"
194
		fi
195
	fi
153
	# store chromium versions, only used in postinst for a warning
154
	local chromium
155
	mapfile -t chromium < CHROMIUM_VERSION || die
156
	[[ ${chromium[1]} =~ ^Based.*:[^0-9]+([0-9.]+$) ]] &&
157
		QT6_CHROMIUM_VER=${BASH_REMATCH[1]} || die
158
	[[ ${chromium[2]} =~ ^Patched.+:[^0-9]+([0-9.]+$) ]] &&
159
		QT6_CHROMIUM_PATCHES_VER=${BASH_REMATCH[1]} || die
160
}
196 161

  
197
	qt_use_disable_config alsa webengine-alsa src/buildtools/config/linux.pri
198
	qt_use_disable_config pulseaudio webengine-pulseaudio src/buildtools/config/linux.pri
162
src_configure() {
163
	local mycmakeargs=(
164
		-DQT_FEATURE_qtpdf_build=OFF # TODO?
165
		-DQT_FEATURE_qtpdf_quick_build=OFF
166
		-DQT_FEATURE_qtpdf_widgets_build=OFF
167

  
168
		-DQT_FEATURE_qtwebengine_build=ON
169
		$(qt_feature qml qtwebengine_quick_build)
170
		$(qt_feature widgets qtwebengine_widgets_build)
171

  
172
		$(cmake_use_find_package designer Qt6Designer)
173

  
174
		$(qt_feature alsa webengine_system_alsa)
175
		$(qt_feature !bindist webengine_proprietary_codecs)
176
		$(qt_feature geolocation webengine_geolocation)
177
		$(qt_feature jumbo-build webengine_jumbo_build)
178
		$(qt_feature kerberos webengine_kerberos)
179
		$(qt_feature pulseaudio webengine_system_pulseaudio)
180
		$(qt_feature screencast webengine_webrtc_pipewire)
181
		$(qt_feature system-icu webengine_system_icu)
182
		$(qt_feature vulkan webengine_vulkan)
183
		-DQT_FEATURE_webengine_embedded_build=OFF
184
		-DQT_FEATURE_webengine_extensions=ON
185
		-DQT_FEATURE_webengine_ozone_x11=ON # needed, cannot do optional X yet
186
		-DQT_FEATURE_webengine_pepper_plugins=ON
187
		-DQT_FEATURE_webengine_printing_and_pdf=ON
188
		-DQT_FEATURE_webengine_spellchecker=ON
189
		-DQT_FEATURE_webengine_webchannel=ON
190
		-DQT_FEATURE_webengine_webrtc=ON
191

  
192
		# needs a modified ffmpeg to be usable, and even then it may not
193
		# cooperate with new major ffmpeg versions (bug #831487)
194
		-DQT_FEATURE_webengine_system_ffmpeg=OFF
195

  
196
		# preemptively using bundled to avoid complications, may revisit
197
		# (see discussions in https://github.com/gentoo/gentoo/pull/32281)
198
		-DQT_FEATURE_webengine_system_re2=OFF
199

  
200
		# not necessary to pass these (default), but in case detection fails
201
		$(printf -- '-DQT_FEATURE_webengine_system_%s=ON ' \
202
			freetype glib harfbuzz lcms2 libevent libjpeg \
203
			libopenjpeg2 libpci libpng libvpx libwebp libxml \
204
			minizip opus poppler snappy zlib)
199 205

  
200
	qt_use_disable_mod designer webenginewidgets src/plugins/plugins.pro
206
		# TODO: fixup gn cross, or package dev-qt/qtwebengine-gn with =ON
207
		-DINSTALL_GN=OFF
208
	)
201 209

  
202
	qt_use_disable_mod widgets widgets src/src.pro
210
	local mygnargs=(
211
		# prefer no dlopen where possible
212
		link_pulseaudio=true
213
		rtc_link_pipewire=true
214
	)
203 215

  
204
	qt5-build_src_prepare
216
	if use !custom-cflags; then
217
		strip-flags # fragile
205 218

  
206
	# we need to generate ppc64 stuff because upstream does not ship it yet
207
	if use ppc64; then
208
		einfo "Patching for ppc64le and generating build files"
209
		eapply "${FILESDIR}/qtwebengine-5.15.2-enable-ppc64.patch"
210
		pushd src/3rdparty/chromium > /dev/null || die
211
		eapply -p0 "${WORKDIR}/${PN}-ppc64le"
212
		popd > /dev/null || die
213
		pushd src/3rdparty/chromium/third_party/libvpx > /dev/null || die
214
		mkdir -vp source/config/linux/ppc64 || die
215
		mkdir -p source/libvpx/test || die
216
		touch source/libvpx/test/test.mk || die
217
		# clang-format is used to re-format sources
218
		# but we'd rather make it a no-op than introduce a clang dependency
219
		# https://bugs.gentoo.org/849458
220
		clang-format() { : ; }
221
		export -f clang-format || die
222
		./generate_gni.sh || die
223
		popd >/dev/null || die
219
		if is-flagq '-g?(gdb)?([2-9])'; then #914475
220
			replace-flags '-g?(gdb)?([2-9])' -g1
221
			ewarn "-g2+/-ggdb* *FLAGS replaced with -g1 (enable USE=custom-cflags to keep)"
222
		fi
224 223
	fi
224

  
225
	export NINJA NINJAFLAGS=$(get_NINJAOPTS)
226
	[[ ${NINJA_VERBOSE^^} == OFF ]] || NINJAFLAGS+=" -v"
227

  
228
	local -x EXTRA_GN="${mygnargs[*]} ${EXTRA_GN}"
229
	einfo "Extra Gn args: ${EXTRA_GN}"
230

  
231
	qt6-build_src_configure
225 232
}
226 233

  
227
src_configure() {
228
	export NINJA_PATH=/usr/bin/ninja
229
	export NINJAFLAGS="${NINJAFLAGS:--j$(makeopts_jobs "${MAKEOPTS}" 999) -l$(makeopts_loadavg "${MAKEOPTS}" 0) -v}"
234
src_test() {
235
	if [[ ${EUID} == 0 ]]; then
236
		# almost every tests fail, so skip entirely
237
		ewarn "Skipping tests due to running as root (chromium refuses this configuration)."
238
		return
239
	fi
230 240

  
231
	local myqmakeargs=(
232
		--
233
		-no-build-qtpdf
234
		-printing-and-pdf
235
		-system-opus
236
		-system-webp
237
		$(qt_use alsa)
238
		$(qt_use !bindist proprietary-codecs)
239
		$(qt_use geolocation webengine-geolocation)
240
		$(qt_use kerberos webengine-kerberos)
241
		$(qt_use pulseaudio)
242
		$(usex screencast -webengine-webrtc-pipewire '')
243
		-qt-ffmpeg # bug 831487
244
		$(qt_use system-icu webengine-icu)
241
	local CMAKE_SKIP_TESTS=(
242
		# fails with network sandbox
243
		tst_loadsignals
244
		tst_qquickwebengineview
245
		tst_qwebengineview
246
		# certs verfication seems flaky and gives expiration warnings
247
		tst_qwebengineclientcertificatestore
245 248
	)
246
	qt5-build_src_configure
247
}
248 249

  
249
src_install() {
250
	qt5-build_src_install
250
	# prevent using the system's qtwebengine
251
	# (use glob to avoid unnecessary complications with arch dir)
252
	local resources=( "${BUILD_DIR}/src/core/${CMAKE_BUILD_TYPE}/"* )
253
	[[ -d ${resources[0]} ]] || die "invalid resources path: ${resources[0]}"
254
	local -x QTWEBENGINEPROCESS_PATH=${BUILD_DIR}${QT6_LIBEXECDIR#"${QT6_PREFIX}"}/QtWebEngineProcess
255
	local -x QTWEBENGINE_LOCALES_PATH=${resources[0]}/qtwebengine_locales
256
	local -x QTWEBENGINE_RESOURCES_PATH=${resources[0]}
251 257

  
252
	# bug 601472
253
	if [[ ! -f ${D}${QT5_LIBDIR}/libQt5WebEngine.so ]]; then
254
		die "${CATEGORY}/${PF} failed to build anything. Please report to https://bugs.gentoo.org/"
255
	fi
258
	# random failures in several tests without -j1
259
	qt6-build_src_test -j1
256 260
}
257 261

  
258
pkg_preinst() {
259
	elog "This version of Qt WebEngine is based on Chromium version 87.0.4280.144,"
260
	elog "with additional security fixes from newer versions. Extensive as it is, the"
262
pkg_postinst() {
263
	# plugin may also be found in $HOME if provided by chrome or firefox
264
	use amd64 &&
265
		optfeature "Widevine DRM support (protected media playback)" \
266
			www-plugins/chrome-binary-plugins
267

  
268
	elog
269
	elog "This version of Qt WebEngine is based on Chromium version ${QT6_CHROMIUM_VER}, with"
270
	elog "additional security fixes up to ${QT6_CHROMIUM_PATCHES_VER}. Extensive as it is, the"
261 271
	elog "list of backports is impossible to evaluate, but always bound to be behind"
262 272
	elog "Chromium's release schedule."
273
	elog
263 274
	elog "In addition, various online services may deny service based on an outdated"
264 275
	elog "user agent version (and/or other checks). Google is already known to do so."
265 276
	elog
266
	elog "tldr: Your web browsing experience will be compromised."
277
	elog "tl;dr your web browsing experience will be compromised."
267 278
}
Thank you!