Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: www-client/firefox/
Date: Sat, 05 Sep 2020 17:30:38
Message-Id: 1599326561.536162ea4da4848722c1b1ad54b5904b13c54406.whissi@gentoo
1 commit: 536162ea4da4848722c1b1ad54b5904b13c54406
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Sat Sep 5 17:17:59 2020 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Sat Sep 5 17:22:41 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=536162ea
7
8 www-client/firefox: fix GTK functions stub
9
10 Unbreak Flash.
11
12 Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1661715
13 Package-Manager: Portage-3.0.4, Repoman-3.0.1
14 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
15
16 www-client/firefox/Manifest | 1 +
17 www-client/firefox/firefox-80.0.1-r1.ebuild | 933 ++++++++++++++++++++++++++++
18 2 files changed, 934 insertions(+)
19
20 diff --git a/www-client/firefox/Manifest b/www-client/firefox/Manifest
21 index b44f40bea64..87d14ed9b43 100644
22 --- a/www-client/firefox/Manifest
23 +++ b/www-client/firefox/Manifest
24 @@ -159,6 +159,7 @@ DIST firefox-80.0-nn-NO.xpi 562633 BLAKE2B b529c4764a15a88915ec7c30711467c0741b8
25 DIST firefox-80.0-oc.xpi 584396 BLAKE2B b279c3302fa988a8816100c575d650140b2c43a71a295a520b132bcb37df47d8cb456da2aea103bb6dcde7f310c456b357282820eb637da9f059b1082ca1f6fa SHA512 e1c7674269b1939530304dfcf707f06ecef95c31050276b713fefd554c15f2d266a8866605edd732a0cdba6477bc38dbd5109ef4e8c43aa116541ae5c685afc2
26 DIST firefox-80.0-pa-IN.xpi 613993 BLAKE2B 0f543b581c0d9928b2119c4e091968542865830cbb6258999a29018cb7e4d025b8fd6bcf8c21bf6e7b760a37fed07f0bea088debdf157026188dffc02d65366b SHA512 e80d10daf882dcbe01add70105081be50feb26178ee2ab6cf576afb4c2e4fa9f9868b694016ec006e7f6134e1f6ef40d8f9875661a479f57498d3bb451f0378c
27 DIST firefox-80.0-patches-02.tar.xz 26280 BLAKE2B 11445bae206ed9e8cbadb7f9c2a2ca143c50d4924e663e3b83533f5b6b2aab4e1c760c9c21e1c7ed7d324443ce5df50d1f6b1284184ddaaacbe6c040c5835dee SHA512 51ea389c14757636eea87d9cdb64015072b85ca79e86c68a299568b2a02a8225116c40f0b6306bb15cb73ea9ba18e1767d5e0c21e0aa6dd202cf6ae3d74c304a
28 +DIST firefox-80.0-patches-03.tar.xz 26756 BLAKE2B c15615123acc531b99cfdfb3211e22f268afa416b0bd0da7a0e6a1411245d46175051cbb548d37503903f136a013b308e6c839424060124900f2c5e39d641c90 SHA512 1db6abf91dc1a51892c74452ad703193aba6dfbbce05b631dd030af6d0952f91578658fd865557d78bff157464bd64a71d16c23562720803da567cc24f9285fc
29 DIST firefox-80.0-pl.xpi 588790 BLAKE2B 690ea2bce21714412ebc64fe353354efccd96041721ff4d6d73282900bd69c349a264c61923d3026ff5c39412e04a1be59a864a2b2607c6602b94dc255516824 SHA512 5f4b739b379fdb019fab043277f32b798cc317caae96b11f76228d5c2045907ad44f0b40649b42d66b5b2b1970fb6201fc47393eb4e2bbd86422d1ad4335b62c
30 DIST firefox-80.0-pt-BR.xpi 569559 BLAKE2B d3964f5460e4eb24797fda4bfa4c101103634056fc5df39ea362114f27407a0f5fa1d4a4724391c8b6b8249ce2a0619c2a3fe914c111450c0b5f3860ad291afe SHA512 821aaed6238d01a583bd71dff1d014ff3fa8b2caa5c4478b12e54b011dce561b0ca88239774c8e59479b4488993c4dd2877e68c7e658b310fc490c826cf48d35
31 DIST firefox-80.0-pt-PT.xpi 579329 BLAKE2B 774aab81cb5e10c053c1b383bd10941c62352af26098c742c323eeceab3a509bd8d6ae582545cc7dfd7fe5dbc9804227ba338fd004eaa0681a17be7f050ecdbe SHA512 639bf10dab4fe118ccc58c2d42b0ea4bd78be3edb9d77ce142c7a3a4a84e8ad55dd50ca56db7a7a94570186fdd2ded88bd99d727dd8d9dabfc30259f006643a0
32
33 diff --git a/www-client/firefox/firefox-80.0.1-r1.ebuild b/www-client/firefox/firefox-80.0.1-r1.ebuild
34 new file mode 100644
35 index 00000000000..1c590e9cadc
36 --- /dev/null
37 +++ b/www-client/firefox/firefox-80.0.1-r1.ebuild
38 @@ -0,0 +1,933 @@
39 +# Copyright 1999-2020 Gentoo Authors
40 +# Distributed under the terms of the GNU General Public License v2
41 +
42 +EAPI="6"
43 +VIRTUALX_REQUIRED="pgo"
44 +WANT_AUTOCONF="2.1"
45 +MOZ_ESR=""
46 +
47 +PYTHON_COMPAT=( python3_{7,8,9} )
48 +PYTHON_REQ_USE='ncurses,sqlite,ssl,threads(+)'
49 +
50 +# This list can be updated with scripts/get_langs.sh from the mozilla overlay
51 +MOZ_LANGS=( ach af an ar ast az be bg bn br bs ca cak cs cy da de dsb
52 +el en en-CA en-GB en-US eo es-AR es-CL es-ES es-MX et eu fa ff fi fr
53 +fy-NL ga-IE gd gl gn gu-IN he hi-IN hr hsb hu hy-AM ia id is it ja ka
54 +kab kk km kn ko lij lt lv mk mr ms my nb-NO nl nn-NO oc pa-IN pl pt-BR
55 +pt-PT rm ro ru si sk sl son sq sr sv-SE ta te th tr uk ur uz vi xh
56 +zh-CN zh-TW )
57 +
58 +# Convert the ebuild version to the upstream mozilla version, used by mozlinguas
59 +MOZ_PV="${PV/_alpha/a}" # Handle alpha for SRC_URI
60 +MOZ_PV="${MOZ_PV/_beta/b}" # Handle beta for SRC_URI
61 +MOZ_PV="${MOZ_PV%%_rc*}" # Handle rc for SRC_URI
62 +
63 +if [[ ${MOZ_ESR} == 1 ]] ; then
64 + # ESR releases have slightly different version numbers
65 + MOZ_PV="${MOZ_PV}esr"
66 +fi
67 +
68 +# Patch version
69 +PATCH="${PN}-80.0-patches-03"
70 +
71 +MOZ_HTTP_URI="https://archive.mozilla.org/pub/${PN}/releases"
72 +MOZ_SRC_URI="${MOZ_HTTP_URI}/${MOZ_PV}/source/${PN}-${MOZ_PV}.source.tar.xz"
73 +
74 +if [[ "${PV}" == *_rc* ]]; then
75 + MOZ_HTTP_URI="https://archive.mozilla.org/pub/${PN}/candidates/${MOZ_PV}-candidates/build${PV##*_rc}"
76 + MOZ_LANGPACK_PREFIX="linux-i686/xpi/"
77 + MOZ_SRC_URI="${MOZ_HTTP_URI}/source/${PN}-${MOZ_PV}.source.tar.xz -> $P.tar.xz"
78 +fi
79 +
80 +LLVM_MAX_SLOT=10
81 +
82 +inherit check-reqs eapi7-ver flag-o-matic toolchain-funcs eutils \
83 + gnome2-utils llvm mozcoreconf-v6 pax-utils xdg-utils \
84 + autotools mozlinguas-v2 multiprocessing virtualx
85 +
86 +DESCRIPTION="Firefox Web Browser"
87 +HOMEPAGE="https://www.mozilla.com/firefox"
88 +
89 +KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
90 +
91 +SLOT="0"
92 +LICENSE="MPL-2.0 GPL-2 LGPL-2.1"
93 +IUSE="bindist clang cpu_flags_x86_avx2 dbus debug eme-free geckodriver
94 + +gmp-autoupdate hardened hwaccel jack lto cpu_flags_arm_neon
95 + +openh264 pgo pulseaudio screencast +screenshot selinux +system-av1
96 + +system-harfbuzz +system-icu +system-jpeg +system-libevent
97 + +system-libvpx +system-webp test wayland wifi"
98 +
99 +REQUIRED_USE="pgo? ( lto )
100 + screencast? ( wayland )"
101 +
102 +RESTRICT="!bindist? ( bindist )
103 + !test? ( test )"
104 +
105 +PATCH_URIS=( https://dev.gentoo.org/~{whissi,polynomial-c,axs}/mozilla/patchsets/${PATCH}.tar.xz )
106 +SRC_URI="${SRC_URI}
107 + ${MOZ_SRC_URI}
108 + ${PATCH_URIS[@]}"
109 +
110 +CDEPEND="
111 + >=dev-libs/nss-3.55
112 + >=dev-libs/nspr-4.26
113 + dev-libs/atk
114 + dev-libs/expat
115 + >=x11-libs/cairo-1.10[X]
116 + >=x11-libs/gtk+-2.18:2
117 + >=x11-libs/gtk+-3.4.0:3[X]
118 + x11-libs/gdk-pixbuf
119 + >=x11-libs/pango-1.22.0
120 + >=media-libs/libpng-1.6.35:0=[apng]
121 + >=media-libs/mesa-10.2:*
122 + media-libs/fontconfig
123 + >=media-libs/freetype-2.4.10
124 + kernel_linux? ( !pulseaudio? ( media-libs/alsa-lib ) )
125 + virtual/freedesktop-icon-theme
126 + >=x11-libs/pixman-0.19.2
127 + >=dev-libs/glib-2.26:2
128 + >=sys-libs/zlib-1.2.3
129 + >=dev-libs/libffi-3.0.10:=
130 + media-video/ffmpeg
131 + x11-libs/libX11
132 + x11-libs/libXcomposite
133 + x11-libs/libXdamage
134 + x11-libs/libXext
135 + x11-libs/libXfixes
136 + x11-libs/libXrender
137 + x11-libs/libXt
138 + dbus? (
139 + sys-apps/dbus
140 + dev-libs/dbus-glib
141 + )
142 + screencast? ( media-video/pipewire:0/0.3 )
143 + system-av1? (
144 + >=media-libs/dav1d-0.3.0:=
145 + >=media-libs/libaom-1.0.0:=
146 + )
147 + system-harfbuzz? (
148 + >=media-libs/harfbuzz-2.6.8:0=
149 + >=media-gfx/graphite2-1.3.13
150 + )
151 + system-icu? ( >=dev-libs/icu-67.1:= )
152 + system-jpeg? ( >=media-libs/libjpeg-turbo-1.2.1 )
153 + system-libevent? ( >=dev-libs/libevent-2.0:0=[threads] )
154 + system-libvpx? ( >=media-libs/libvpx-1.8.2:0=[postproc] )
155 + system-webp? ( >=media-libs/libwebp-1.1.0:0= )
156 + wifi? (
157 + kernel_linux? (
158 + sys-apps/dbus
159 + dev-libs/dbus-glib
160 + net-misc/networkmanager
161 + )
162 + )
163 + jack? ( virtual/jack )
164 + selinux? ( sec-policy/selinux-mozilla )"
165 +
166 +RDEPEND="${CDEPEND}
167 + jack? ( virtual/jack )
168 + openh264? ( media-libs/openh264:*[plugin] )
169 + pulseaudio? (
170 + || (
171 + media-sound/pulseaudio
172 + >=media-sound/apulse-0.1.12-r4
173 + )
174 + )
175 + selinux? ( sec-policy/selinux-mozilla )"
176 +
177 +DEPEND="${CDEPEND}
178 + app-arch/zip
179 + app-arch/unzip
180 + >=dev-util/cbindgen-0.14.3
181 + >=net-libs/nodejs-10.19.0
182 + >=sys-devel/binutils-2.30
183 + sys-apps/findutils
184 + virtual/pkgconfig
185 + >=virtual/rust-1.43.0
186 + || (
187 + (
188 + sys-devel/clang:10
189 + !clang? ( sys-devel/llvm:10 )
190 + clang? (
191 + =sys-devel/lld-10*
192 + sys-devel/llvm:10[gold]
193 + pgo? ( =sys-libs/compiler-rt-sanitizers-10*[profile] )
194 + )
195 + )
196 + (
197 + sys-devel/clang:9
198 + !clang? ( sys-devel/llvm:9 )
199 + clang? (
200 + =sys-devel/lld-9*
201 + sys-devel/llvm:9[gold]
202 + pgo? ( =sys-libs/compiler-rt-sanitizers-9*[profile] )
203 + )
204 + )
205 + (
206 + sys-devel/clang:8
207 + !clang? ( sys-devel/llvm:8 )
208 + clang? (
209 + =sys-devel/lld-8*
210 + sys-devel/llvm:8[gold]
211 + pgo? ( =sys-libs/compiler-rt-sanitizers-8*[profile] )
212 + )
213 + )
214 + (
215 + sys-devel/clang:7
216 + !clang? ( sys-devel/llvm:7 )
217 + clang? (
218 + =sys-devel/lld-7*
219 + sys-devel/llvm:7[gold]
220 + pgo? ( =sys-libs/compiler-rt-sanitizers-7*[profile] )
221 + )
222 + )
223 + )
224 + pulseaudio? (
225 + || (
226 + media-sound/pulseaudio
227 + >=media-sound/apulse-0.1.12-r4[sdk]
228 + )
229 + )
230 + wayland? ( >=x11-libs/gtk+-3.11:3[wayland] )
231 + amd64? ( >=dev-lang/yasm-1.1 virtual/opengl )
232 + x86? ( >=dev-lang/yasm-1.1 virtual/opengl )
233 + !system-av1? (
234 + amd64? ( >=dev-lang/nasm-2.13 )
235 + x86? ( >=dev-lang/nasm-2.13 )
236 + )"
237 +
238 +S="${WORKDIR}/firefox-${PV%_*}"
239 +
240 +BUILD_OBJ_DIR="${S}/ff"
241 +
242 +# allow GMP_PLUGIN_LIST to be set in an eclass or
243 +# overridden in the enviromnent (advanced hackers only)
244 +if [[ -z $GMP_PLUGIN_LIST ]] ; then
245 + GMP_PLUGIN_LIST=( gmp-gmpopenh264 gmp-widevinecdm )
246 +fi
247 +
248 +llvm_check_deps() {
249 + if ! has_version --host-root "sys-devel/clang:${LLVM_SLOT}" ; then
250 + ewarn "sys-devel/clang:${LLVM_SLOT} is missing! Cannot use LLVM slot ${LLVM_SLOT} ..." >&2
251 + return 1
252 + fi
253 +
254 + if use clang ; then
255 + if ! has_version --host-root "=sys-devel/lld-${LLVM_SLOT}*" ; then
256 + ewarn "=sys-devel/lld-${LLVM_SLOT}* is missing! Cannot use LLVM slot ${LLVM_SLOT} ..." >&2
257 + return 1
258 + fi
259 +
260 + if use pgo ; then
261 + if ! has_version --host-root "=sys-libs/compiler-rt-sanitizers-${LLVM_SLOT}*" ; then
262 + ewarn "=sys-libs/compiler-rt-sanitizers-${LLVM_SLOT}* is missing! Cannot use LLVM slot ${LLVM_SLOT} ..." >&2
263 + return 1
264 + fi
265 + fi
266 + fi
267 +
268 + einfo "Will use LLVM slot ${LLVM_SLOT}!" >&2
269 +}
270 +
271 +pkg_pretend() {
272 + if [[ ${MERGE_TYPE} != binary ]] ; then
273 + if use pgo ; then
274 + if ! has usersandbox $FEATURES ; then
275 + die "You must enable usersandbox as X server can not run as root!"
276 + fi
277 + fi
278 +
279 + # Ensure we have enough disk space to compile
280 + if use pgo || use lto || use debug || use test ; then
281 + CHECKREQS_DISK_BUILD="11G"
282 + else
283 + CHECKREQS_DISK_BUILD="5G"
284 + fi
285 +
286 + check-reqs_pkg_pretend
287 + fi
288 +}
289 +
290 +pkg_setup() {
291 + moz_pkgsetup
292 +
293 + if [[ ${MERGE_TYPE} != binary ]] ; then
294 + # Ensure we have enough disk space to compile
295 + if use pgo || use lto || use debug || use test ; then
296 + CHECKREQS_DISK_BUILD="11G"
297 + else
298 + CHECKREQS_DISK_BUILD="5G"
299 + fi
300 +
301 + check-reqs_pkg_setup
302 +
303 + # Avoid PGO profiling problems due to enviroment leakage
304 + # These should *always* be cleaned up anyway
305 + unset DBUS_SESSION_BUS_ADDRESS \
306 + DISPLAY \
307 + ORBIT_SOCKETDIR \
308 + SESSION_MANAGER \
309 + XDG_CACHE_HOME \
310 + XDG_SESSION_COOKIE \
311 + XAUTHORITY
312 +
313 + addpredict /proc/self/oom_score_adj
314 +
315 + llvm_pkg_setup
316 + fi
317 +
318 + if ! use bindist ; then
319 + einfo
320 + elog "You are enabling official branding. You may not redistribute this build"
321 + elog "to any users on your network or the internet. Doing so puts yourself into"
322 + elog "a legal problem with Mozilla Foundation."
323 + elog "You can disable it by emerging ${PN} _with_ the bindist USE-flag."
324 + fi
325 +}
326 +
327 +src_unpack() {
328 + default
329 +
330 + # Unpack language packs
331 + mozlinguas_src_unpack
332 +}
333 +
334 +src_prepare() {
335 + use pgo && rm "${WORKDIR}"/firefox/0032-LTO-Only-enable-LTO-for-Rust-when-complete-build-use.patch
336 + eapply "${WORKDIR}/firefox"
337 +
338 + # Make LTO respect MAKEOPTS
339 + sed -i \
340 + -e "s/multiprocessing.cpu_count()/$(makeopts_jobs)/" \
341 + "${S}"/build/moz.configure/lto-pgo.configure \
342 + || die "sed failed to set num_cores"
343 +
344 + # Make ICU respect MAKEOPTS
345 + sed -i \
346 + -e "s/multiprocessing.cpu_count()/$(makeopts_jobs)/" \
347 + "${S}"/intl/icu_sources_data.py \
348 + || die "sed failed to set num_cores"
349 +
350 + # sed-in toolchain prefix
351 + sed -i \
352 + -e "s/objdump/${CHOST}-objdump/" \
353 + "${S}"/python/mozbuild/mozbuild/configure/check_debug_ranges.py \
354 + || die "sed failed to set toolchain prefix"
355 +
356 + # Allow user to apply any additional patches without modifing ebuild
357 + eapply_user
358 +
359 + einfo "Removing pre-built binaries ..."
360 + find "${S}"/third_party -type f \( -name '*.so' -o -name '*.o' \) -print -delete || die
361 +
362 + # Enable gnomebreakpad
363 + if use debug ; then
364 + sed -i -e "s:GNOME_DISABLE_CRASH_DIALOG=1:GNOME_DISABLE_CRASH_DIALOG=0:g" \
365 + "${S}"/build/unix/run-mozilla.sh || die "sed failed!"
366 + fi
367 +
368 + # Drop -Wl,--as-needed related manipulation for ia64 as it causes ld sefgaults, bug #582432
369 + if use ia64 ; then
370 + sed -i \
371 + -e '/^OS_LIBS += no_as_needed/d' \
372 + -e '/^OS_LIBS += as_needed/d' \
373 + "${S}"/widget/gtk/mozgtk/gtk2/moz.build \
374 + "${S}"/widget/gtk/mozgtk/gtk3/moz.build \
375 + || die "sed failed to drop --as-needed for ia64"
376 + fi
377 +
378 + # Fix sandbox violations during make clean, bug 372817
379 + sed -e "s:\(/no-such-file\):${T}\1:g" \
380 + -i "${S}"/config/rules.mk \
381 + -i "${S}"/nsprpub/configure{.in,} \
382 + || die
383 +
384 + # Don't exit with error when some libs are missing which we have in
385 + # system.
386 + sed '/^MOZ_PKG_FATAL_WARNINGS/s@= 1@= 0@' \
387 + -i "${S}"/browser/installer/Makefile.in || die
388 +
389 + # Don't error out when there's no files to be removed:
390 + sed 's@\(xargs rm\)$@\1 -f@' \
391 + -i "${S}"/toolkit/mozapps/installer/packager.mk || die
392 +
393 + # Keep codebase the same even if not using official branding
394 + sed '/^MOZ_DEV_EDITION=1/d' \
395 + -i "${S}"/browser/branding/aurora/configure.sh || die
396 +
397 + # rustfmt, a tool to format Rust code, is optional and not required to build Firefox.
398 + # However, when available, an unsupported version can cause problems, bug #669548
399 + sed -i -e "s@check_prog('RUSTFMT', add_rustup_path('rustfmt')@check_prog('RUSTFMT', add_rustup_path('rustfmt_do_not_use')@" \
400 + "${S}"/build/moz.configure/rust.configure || die
401 +
402 + # Autotools configure is now called old-configure.in
403 + # This works because there is still a configure.in that happens to be for the
404 + # shell wrapper configure script
405 + eautoreconf old-configure.in
406 +
407 + # Must run autoconf in js/src
408 + cd "${S}"/js/src || die
409 + eautoconf old-configure.in
410 +
411 + # Clear checksums that present a problem
412 + sed -i 's/\("files":{\)[^}]*/\1/' "${S}"/third_party/rust/target-lexicon-0.9.0/.cargo-checksum.json || die
413 +}
414 +
415 +src_configure() {
416 + MEXTENSIONS="default"
417 + # Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
418 + # Note: These are for Gentoo Linux use ONLY. For your own distribution, please
419 + # get your own set of keys.
420 + _google_api_key=AIzaSyDEAOvatFo0eTgsV_ZlEzx0ObmepsMzfAc
421 +
422 + # Add information about TERM to output (build.log) to aid debugging
423 + # blessings problems
424 + if [[ -n "${TERM}" ]] ; then
425 + einfo "TERM is set to: \"${TERM}\""
426 + else
427 + einfo "TERM is unset."
428 + fi
429 +
430 + if use clang && ! tc-is-clang ; then
431 + # Force clang
432 + einfo "Enforcing the use of clang due to USE=clang ..."
433 + CC=${CHOST}-clang
434 + CXX=${CHOST}-clang++
435 + strip-unsupported-flags
436 + elif ! use clang && ! tc-is-gcc ; then
437 + # Force gcc
438 + einfo "Enforcing the use of gcc due to USE=-clang ..."
439 + CC=${CHOST}-gcc
440 + CXX=${CHOST}-g++
441 + strip-unsupported-flags
442 + fi
443 +
444 + ####################################
445 + #
446 + # mozconfig, CFLAGS and CXXFLAGS setup
447 + #
448 + ####################################
449 +
450 + mozconfig_init
451 + # common config components
452 + mozconfig_annotate 'system_libs' \
453 + --with-system-zlib
454 +
455 + # Must pass release in order to properly select linker
456 + mozconfig_annotate 'Enable by Gentoo' --enable-release
457 +
458 + # libclang.so is not properly detected work around issue
459 + mozconfig_annotate '' --with-libclang-path="$(llvm-config --libdir)"
460 +
461 + if use pgo ; then
462 + if ! has userpriv $FEATURES ; then
463 + eerror "Building firefox with USE=pgo and FEATURES=-userpriv is not supported!"
464 + fi
465 + fi
466 +
467 + # Don't let user's LTO flags clash with upstream's flags
468 + filter-flags -flto*
469 +
470 + if use lto ; then
471 + local show_old_compiler_warning=
472 +
473 + if use clang ; then
474 + # At this stage CC is adjusted and the following check will
475 + # will work
476 + if [[ $(clang-major-version) -lt 7 ]] ; then
477 + show_old_compiler_warning=1
478 + fi
479 +
480 + # Upstream only supports lld when using clang
481 + mozconfig_annotate "forcing ld=lld due to USE=clang and USE=lto" --enable-linker=lld
482 + else
483 + if [[ $(gcc-major-version) -lt 8 ]] ; then
484 + show_old_compiler_warning=1
485 + fi
486 +
487 + if ! use cpu_flags_x86_avx2 ; then
488 + local _gcc_version_with_ipa_cdtor_fix="8.3"
489 + local _current_gcc_version="$(gcc-major-version).$(gcc-minor-version)"
490 +
491 + if ver_test "${_current_gcc_version}" -lt "${_gcc_version_with_ipa_cdtor_fix}" ; then
492 + # due to a GCC bug, GCC will produce AVX2 instructions
493 + # even if the CPU doesn't support AVX2, https://gcc.gnu.org/ml/gcc-patches/2018-12/msg01142.html
494 + einfo "Disable IPA cdtor due to bug in GCC and missing AVX2 support -- triggered by USE=lto"
495 + append-ldflags -fdisable-ipa-cdtor
496 + else
497 + einfo "No GCC workaround required, GCC version is already patched!"
498 + fi
499 + else
500 + einfo "No GCC workaround required, system supports AVX2"
501 + fi
502 +
503 + # Linking only works when using ld.gold when LTO is enabled
504 + mozconfig_annotate "forcing ld=gold due to USE=lto" --enable-linker=gold
505 + fi
506 +
507 + if [[ -n "${show_old_compiler_warning}" ]] ; then
508 + # Checking compiler's major version uses CC variable. Because we allow
509 + # user to control used compiler via USE=clang flag, we cannot use
510 + # initial value. So this is the earliest stage where we can do this check
511 + # because pkg_pretend is not called in the main phase function sequence
512 + # environment saving is not guaranteed so we don't know if we will have
513 + # correct compiler until now.
514 + ewarn ""
515 + ewarn "USE=lto requires up-to-date compiler (>=gcc-8 or >=clang-7)."
516 + ewarn "You are on your own -- expect build failures. Don't file bugs using that unsupported configuration!"
517 + ewarn ""
518 + sleep 5
519 + fi
520 +
521 + mozconfig_annotate '+lto' --enable-lto=thin
522 +
523 + if use pgo ; then
524 + mozconfig_annotate '+pgo' MOZ_PGO=1
525 + fi
526 + else
527 + # Avoid auto-magic on linker
528 + if use clang ; then
529 + # This is upstream's default
530 + mozconfig_annotate "forcing ld=lld due to USE=clang" --enable-linker=lld
531 + elif tc-ld-is-gold ; then
532 + mozconfig_annotate "linker is set to gold" --enable-linker=gold
533 + else
534 + mozconfig_annotate "linker is set to bfd" --enable-linker=bfd
535 + fi
536 + fi
537 +
538 + # It doesn't compile on alpha without this LDFLAGS
539 + use alpha && append-ldflags "-Wl,--no-relax"
540 +
541 + # Add full relro support for hardened
542 + use hardened && append-ldflags "-Wl,-z,now"
543 +
544 + # Modifications to better support ARM, bug 553364
545 + if use cpu_flags_arm_neon ; then
546 + mozconfig_annotate '' --with-fpu=neon
547 +
548 + if ! tc-is-clang ; then
549 + # thumb options aren't supported when using clang, bug 666966
550 + mozconfig_annotate '' --with-thumb=yes
551 + mozconfig_annotate '' --with-thumb-interwork=no
552 + fi
553 + fi
554 +
555 + if [[ ${CHOST} == armv*h* ]] ; then
556 + mozconfig_annotate '' --with-float-abi=hard
557 + if ! use system-libvpx ; then
558 + sed -i -e "s|softfp|hard|" \
559 + "${S}"/media/libvpx/moz.build
560 + fi
561 + fi
562 +
563 + mozconfig_use_enable !bindist official-branding
564 +
565 + mozconfig_use_enable debug
566 + mozconfig_use_enable debug tests
567 + if ! use debug ; then
568 + mozconfig_annotate 'disabled by Gentoo' --disable-debug-symbols
569 + else
570 + mozconfig_annotate 'enabled by Gentoo' --enable-debug-symbols
571 + fi
572 + # These are enabled by default in all mozilla applications
573 + mozconfig_annotate '' --with-system-nspr
574 + mozconfig_annotate '' --with-system-nss
575 + mozconfig_annotate '' --x-includes="${SYSROOT}${EPREFIX}"/usr/include \
576 + --x-libraries="${SYSROOT}${EPREFIX}"/usr/$(get_libdir)
577 + mozconfig_annotate '' --prefix="${EPREFIX}"/usr
578 + mozconfig_annotate '' --libdir="${EPREFIX}"/usr/$(get_libdir)
579 + mozconfig_annotate '' --disable-crashreporter
580 + mozconfig_annotate 'Gentoo default' --with-system-png
581 + mozconfig_annotate '' --enable-system-ffi
582 + mozconfig_annotate '' --with-intl-api
583 + mozconfig_annotate '' --enable-system-pixman
584 + # Instead of the standard --build= and --host=, mozilla uses --host instead
585 + # of --build, and --target intstead of --host.
586 + # Note, mozilla also has --build but it does not do what you think it does.
587 + # Set both --target and --host as mozilla uses python to guess values otherwise
588 + mozconfig_annotate '' --target="${CHOST}"
589 + mozconfig_annotate '' --host="${CBUILD:-${CHOST}}"
590 + mozconfig_annotate '' --with-toolchain-prefix="${CHOST}-"
591 + if use system-libevent ; then
592 + mozconfig_annotate '' --with-system-libevent="${SYSROOT}${EPREFIX}"/usr
593 + fi
594 +
595 + if ! use x86 && [[ ${CHOST} != armv*h* ]] ; then
596 + mozconfig_annotate '' --enable-rust-simd
597 + fi
598 +
599 + # use the gtk3 toolkit (the only one supported at this point)
600 + # TODO: Will this result in automagic dependency on x11-libs/gtk+[wayland]?
601 + if use wayland ; then
602 + mozconfig_annotate '' --enable-default-toolkit=cairo-gtk3-wayland
603 + else
604 + mozconfig_annotate '' --enable-default-toolkit=cairo-gtk3
605 + fi
606 +
607 + mozconfig_use_with system-av1
608 + mozconfig_use_with system-harfbuzz
609 + mozconfig_use_with system-harfbuzz system-graphite2
610 + mozconfig_use_with system-icu
611 + mozconfig_use_with system-jpeg
612 + mozconfig_use_with system-libvpx
613 + mozconfig_use_with system-webp
614 + mozconfig_use_enable pulseaudio
615 + # force the deprecated alsa sound code if pulseaudio is disabled
616 + if use kernel_linux && ! use pulseaudio ; then
617 + mozconfig_annotate '-pulseaudio' --enable-alsa
618 + fi
619 +
620 + # Disable built-in ccache support to avoid sandbox violation, #665420
621 + # Use FEATURES=ccache instead!
622 + mozconfig_annotate '' --without-ccache
623 + sed -i -e 's/ccache_stats = None/return None/' \
624 + python/mozbuild/mozbuild/controller/building.py || \
625 + die "Failed to disable ccache stats call"
626 +
627 + mozconfig_use_enable dbus
628 +
629 + mozconfig_use_enable wifi necko-wifi
630 +
631 + mozconfig_use_enable geckodriver
632 +
633 + # enable JACK, bug 600002
634 + mozconfig_use_enable jack
635 +
636 + mozconfig_use_enable screencast pipewire
637 +
638 + # Enable/Disable eme support
639 + use eme-free && mozconfig_annotate '+eme-free' --disable-eme
640 +
641 + # Setup api key for location services and safebrowsing, https://bugzilla.mozilla.org/show_bug.cgi?id=1531176#c34
642 + echo -n "${_google_api_key}" > "${S}"/google-api-key
643 + mozconfig_annotate '' --with-google-location-service-api-keyfile="${S}/google-api-key"
644 + mozconfig_annotate '' --with-google-safebrowsing-api-keyfile="${S}/google-api-key"
645 +
646 + mozconfig_annotate '' --enable-extensions="${MEXTENSIONS}"
647 +
648 + # allow elfhack to work in combination with unstripped binaries
649 + # when they would normally be larger than 2GiB.
650 + append-ldflags "-Wl,--compress-debug-sections=zlib"
651 +
652 + if use clang ; then
653 + # https://bugzilla.mozilla.org/show_bug.cgi?id=1482204
654 + # https://bugzilla.mozilla.org/show_bug.cgi?id=1483822
655 + # toolkit/moz.configure Elfhack section: target.cpu in ('arm', 'x86', 'x86_64')
656 + local disable_elf_hack=
657 + if use amd64 ; then
658 + disable_elf_hack=yes
659 + elif use x86 ; then
660 + disable_elf_hack=yes
661 + elif use arm ; then
662 + disable_elf_hack=yes
663 + fi
664 +
665 + if [[ -n ${disable_elf_hack} ]] ; then
666 + mozconfig_annotate 'elf-hack is broken when using Clang' --disable-elf-hack
667 + fi
668 + fi
669 +
670 + echo "mk_add_options MOZ_OBJDIR=${BUILD_OBJ_DIR}" >> "${S}"/.mozconfig
671 + echo "mk_add_options XARGS=/usr/bin/xargs" >> "${S}"/.mozconfig
672 +
673 + # Finalize and report settings
674 + mozconfig_final
675 +
676 + mkdir -p "${S}"/third_party/rust/libloading/.deps
677 +
678 + # workaround for funky/broken upstream configure...
679 + SHELL="${SHELL:-${EPREFIX}/bin/bash}" MOZ_NOSPAM=1 \
680 + ./mach configure || die
681 +}
682 +
683 +src_compile() {
684 + local _virtx=
685 + if use pgo ; then
686 + _virtx=virtx
687 +
688 + # Reset and cleanup environment variables used by GNOME/XDG
689 + gnome2_environment_reset
690 +
691 + addpredict /root
692 + fi
693 +
694 + GDK_BACKEND=x11 \
695 + MOZ_MAKE_FLAGS="${MAKEOPTS} -O" \
696 + SHELL="${SHELL:-${EPREFIX}/bin/bash}" \
697 + MOZ_NOSPAM=1 \
698 + ${_virtx} \
699 + ./mach build --verbose \
700 + || die
701 +}
702 +
703 +src_install() {
704 + cd "${BUILD_OBJ_DIR}" || die
705 +
706 + # Pax mark xpcshell for hardened support, only used for startupcache creation.
707 + pax-mark m "${BUILD_OBJ_DIR}"/dist/bin/xpcshell
708 +
709 + # Add our default prefs for firefox
710 + cp "${FILESDIR}"/gentoo-default-prefs.js-3 \
711 + "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \
712 + || die
713 +
714 + # set dictionary path, to use system hunspell
715 + echo "pref(\"spellchecker.dictionary_path\", \"${EPREFIX}/usr/share/myspell\");" \
716 + >>"${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" || die
717 +
718 + # force the graphite pref if system-harfbuzz is enabled, since the pref cant disable it
719 + if use system-harfbuzz ; then
720 + echo "sticky_pref(\"gfx.font_rendering.graphite.enabled\",true);" \
721 + >>"${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" || die
722 + fi
723 +
724 + # force cairo as the canvas renderer on platforms without skia support
725 + if [[ $(tc-endian) == "big" ]] ; then
726 + echo "sticky_pref(\"gfx.canvas.azure.backends\",\"cairo\");" \
727 + >>"${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" || die
728 + echo "sticky_pref(\"gfx.content.azure.backends\",\"cairo\");" \
729 + >>"${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" || die
730 + fi
731 +
732 + # Augment this with hwaccel prefs
733 + if use hwaccel ; then
734 + cat "${FILESDIR}"/gentoo-hwaccel-prefs.js-1 >> \
735 + "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \
736 + || die
737 + fi
738 +
739 + if ! use screenshot ; then
740 + echo "pref(\"extensions.screenshots.disabled\", true);" >> \
741 + "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \
742 + || die
743 + fi
744 +
745 + echo "pref(\"extensions.autoDisableScopes\", 3);" >> \
746 + "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \
747 + || die
748 +
749 + if ! use gmp-autoupdate ; then
750 + local plugin
751 + for plugin in "${GMP_PLUGIN_LIST[@]}" ; do
752 + echo "pref(\"media.${plugin}.autoupdate\", false);" >> \
753 + "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \
754 + || die
755 + done
756 + fi
757 +
758 + cd "${S}"
759 + MOZ_MAKE_FLAGS="${MAKEOPTS}" SHELL="${SHELL:-${EPREFIX}/bin/bash}" MOZ_NOSPAM=1 \
760 + DESTDIR="${D}" ./mach install || die
761 +
762 + if use geckodriver ; then
763 + cp "${BUILD_OBJ_DIR}"/dist/bin/geckodriver "${ED%/}"${MOZILLA_FIVE_HOME} || die
764 + pax-mark m "${ED%/}"${MOZILLA_FIVE_HOME}/geckodriver
765 +
766 + dosym ${MOZILLA_FIVE_HOME}/geckodriver /usr/bin/geckodriver
767 + fi
768 +
769 + # Install language packs
770 + MOZEXTENSION_TARGET="distribution/extensions" MOZ_INSTALL_L10N_XPIFILE="1" mozlinguas_src_install
771 +
772 + local size sizes icon_path icon name
773 + if use bindist ; then
774 + sizes="16 32 48"
775 + icon_path="${S}/browser/branding/aurora"
776 + # Firefox's new rapid release cycle means no more codenames
777 + # Let's just stick with this one...
778 + icon="aurora"
779 + name="Aurora"
780 +
781 + # Override preferences to set the MOZ_DEV_EDITION defaults, since we
782 + # don't define MOZ_DEV_EDITION to avoid profile debaucles.
783 + # (source: browser/app/profile/firefox.js)
784 + cat >>"${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" <<PROFILE_EOF
785 +pref("app.feedback.baseURL", "https://input.mozilla.org/%LOCALE%/feedback/firefoxdev/%VERSION%/");
786 +sticky_pref("lightweightThemes.selectedThemeID", "firefox-devedition@×××××××.org");
787 +sticky_pref("browser.devedition.theme.enabled", true);
788 +sticky_pref("devtools.theme", "dark");
789 +PROFILE_EOF
790 +
791 + else
792 + sizes="16 22 24 32 48 64 128 256"
793 + icon_path="${S}/browser/branding/official"
794 + icon="${PN}"
795 + name="Mozilla Firefox"
796 + fi
797 +
798 + # Disable built-in auto-update because we update firefox through package manager
799 + insinto ${MOZILLA_FIVE_HOME}/distribution/
800 + newins "${FILESDIR}"/disable-auto-update.policy.json policies.json
801 +
802 + # Install icons and .desktop for menu entry
803 + for size in ${sizes} ; do
804 + insinto "/usr/share/icons/hicolor/${size}x${size}/apps"
805 + newins "${icon_path}/default${size}.png" "${icon}.png"
806 + done
807 + # Install a 48x48 icon into /usr/share/pixmaps for legacy DEs
808 + newicon "${icon_path}/default48.png" "${icon}.png"
809 +
810 + local display_protocols="auto X11" use_wayland="false"
811 + if use wayland ; then
812 + display_protocols+=" Wayland"
813 + use_wayland="true"
814 + fi
815 +
816 + local app_name desktop_filename display_protocol exec_command
817 + for display_protocol in ${display_protocols} ; do
818 + app_name="${name} on ${display_protocol}"
819 + desktop_filename="${PN}-${display_protocol,,}.desktop"
820 +
821 + case ${display_protocol} in
822 + Wayland)
823 + exec_command='firefox-wayland --name firefox-wayland'
824 + newbin "${FILESDIR}"/firefox-wayland.sh firefox-wayland
825 + ;;
826 + X11)
827 + if ! use wayland ; then
828 + # Exit loop here because there's no choice so
829 + # we don't need wrapper/.desktop file for X11.
830 + continue
831 + fi
832 +
833 + exec_command='firefox-x11 --name firefox-x11'
834 + newbin "${FILESDIR}"/firefox-x11.sh firefox-x11
835 + ;;
836 + *)
837 + app_name="${name}"
838 + desktop_filename="${PN}.desktop"
839 + exec_command='firefox'
840 + ;;
841 + esac
842 +
843 + newmenu "${FILESDIR}/icon/${PN}-r2.desktop" "${desktop_filename}"
844 + sed -i \
845 + -e "s:@NAME@:${app_name}:" \
846 + -e "s:@EXEC@:${exec_command}:" \
847 + -e "s:@ICON@:${icon}:" \
848 + "${ED%/}/usr/share/applications/${desktop_filename}" || die
849 + done
850 +
851 + rm "${ED%/}"/usr/bin/firefox || die
852 + newbin "${FILESDIR}"/firefox.sh firefox
853 +
854 + local wrapper
855 + for wrapper in \
856 + "${ED%/}"/usr/bin/firefox \
857 + "${ED%/}"/usr/bin/firefox-x11 \
858 + "${ED%/}"/usr/bin/firefox-wayland \
859 + ; do
860 + [[ ! -f "${wrapper}" ]] && continue
861 +
862 + sed -i \
863 + -e "s:@PREFIX@:${EPREFIX%/}/usr:" \
864 + -e "s:@DEFAULT_WAYLAND@:${use_wayland}:" \
865 + "${wrapper}" || die
866 + done
867 +
868 + # Don't install llvm-symbolizer from sys-devel/llvm package
869 + [[ -f "${ED%/}${MOZILLA_FIVE_HOME}/llvm-symbolizer" ]] && \
870 + rm "${ED%/}${MOZILLA_FIVE_HOME}/llvm-symbolizer"
871 +
872 + # firefox and firefox-bin are identical
873 + rm "${ED%/}"${MOZILLA_FIVE_HOME}/firefox-bin || die
874 + dosym firefox ${MOZILLA_FIVE_HOME}/firefox-bin
875 +
876 + # Required in order to use plugins and even run firefox on hardened.
877 + pax-mark m "${ED%/}"${MOZILLA_FIVE_HOME}/{firefox,plugin-container}
878 +}
879 +
880 +pkg_preinst() {
881 + # if the apulse libs are available in MOZILLA_FIVE_HOME then apulse
882 + # doesn't need to be forced into the LD_LIBRARY_PATH
883 + if use pulseaudio && has_version ">=media-sound/apulse-0.1.12-r4" ; then
884 + einfo "APULSE found - Generating library symlinks for sound support"
885 + local lib
886 + pushd "${ED}"${MOZILLA_FIVE_HOME} &>/dev/null || die
887 + for lib in ../apulse/libpulse{.so{,.0},-simple.so{,.0}} ; do
888 + # a quickpkg rolled by hand will grab symlinks as part of the package,
889 + # so we need to avoid creating them if they already exist.
890 + if [[ ! -L ${lib##*/} ]] ; then
891 + ln -s "${lib}" ${lib##*/} || die
892 + fi
893 + done
894 + popd &>/dev/null || die
895 + fi
896 +}
897 +
898 +pkg_postinst() {
899 + xdg_desktop_database_update
900 + xdg_icon_cache_update
901 +
902 + if ! use gmp-autoupdate ; then
903 + elog "USE='-gmp-autoupdate' has disabled the following plugins from updating or"
904 + elog "installing into new profiles:"
905 + local plugin
906 + for plugin in "${GMP_PLUGIN_LIST[@]}" ; do
907 + elog "\t ${plugin}"
908 + done
909 + elog
910 + fi
911 +
912 + if use pulseaudio && has_version ">=media-sound/apulse-0.1.12-r4" ; then
913 + elog "Apulse was detected at merge time on this system and so it will always be"
914 + elog "used for sound. If you wish to use pulseaudio instead please unmerge"
915 + elog "media-sound/apulse."
916 + elog
917 + fi
918 +
919 + local show_doh_information show_normandy_information
920 +
921 + if [[ -z "${REPLACING_VERSIONS}" ]] ; then
922 + # New install; Tell user that DoH is disabled by default
923 + show_doh_information=yes
924 + show_normandy_information=yes
925 + else
926 + local replacing_version
927 + for replacing_version in ${REPLACING_VERSIONS} ; do
928 + if ver_test "${replacing_version}" -lt 70 ; then
929 + # Tell user only once about our DoH default
930 + show_doh_information=yes
931 + fi
932 +
933 + if ver_test "${replacing_version}" -lt 74.0-r2 ; then
934 + # Tell user only once about our Normandy default
935 + show_normandy_information=yes
936 + fi
937 + done
938 + fi
939 +
940 + if [[ -n "${show_doh_information}" ]] ; then
941 + elog
942 + elog "Note regarding Trusted Recursive Resolver aka DNS-over-HTTPS (DoH):"
943 + elog "Due to privacy concerns (encrypting DNS might be a good thing, sending all"
944 + elog "DNS traffic to Cloudflare by default is not a good idea and applications"
945 + elog "should respect OS configured settings), \"network.trr.mode\" was set to 5"
946 + elog "(\"Off by choice\") by default."
947 + elog "You can enable DNS-over-HTTPS in ${PN^}'s preferences."
948 + fi
949 +
950 + # bug 713782
951 + if [[ -n "${show_normandy_information}" ]] ; then
952 + elog
953 + elog "Upstream operates a service named Normandy which allows Mozilla to"
954 + elog "push changes for default settings or even install new add-ons remotely."
955 + elog "While this can be useful to address problems like 'Armagadd-on 2.0' or"
956 + elog "revert previous decisions to disable TLS 1.0/1.1, privacy and security"
957 + elog "concerns prevail, which is why we have switched off the use of this"
958 + elog "service by default."
959 + elog
960 + elog "To re-enable this service set"
961 + elog
962 + elog " app.normandy.enabled=true"
963 + elog
964 + elog "in about:config."
965 + fi
966 +}
967 +
968 +pkg_postrm() {
969 + xdg_desktop_database_update
970 + xdg_icon_cache_update
971 +}