Gentoo Archives: gentoo-commits

From: Joonas Niilola <juippis@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: www-client/firefox/
Date: Sat, 25 Jun 2022 12:37:09
Message-Id: 1656160620.5002557af8f045a640befccc136269da2bfb7c8c.juippis@gentoo
1 commit: 5002557af8f045a640befccc136269da2bfb7c8c
2 Author: Joonas Niilola <juippis <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jun 25 12:36:37 2022 +0000
4 Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org>
5 CommitDate: Sat Jun 25 12:37:00 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5002557a
7
8 www-client/firefox: drop 101.0.1, 101.0.1-r10
9
10 Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>
11
12 www-client/firefox/Manifest | 2 -
13 www-client/firefox/firefox-101.0.1-r10.ebuild | 1292 -------------------------
14 www-client/firefox/firefox-101.0.1.ebuild | 1276 ------------------------
15 3 files changed, 2570 deletions(-)
16
17 diff --git a/www-client/firefox/Manifest b/www-client/firefox/Manifest
18 index b3ddbf1092bb..63040f37c56e 100644
19 --- a/www-client/firefox/Manifest
20 +++ b/www-client/firefox/Manifest
21 @@ -1,5 +1,3 @@
22 -DIST firefox-101-patches-05j.tar.xz 37268 BLAKE2B 714eb1ea764f24c21b1610363abb5af7eff2047ed0a2248796ac65fa0e4274d905944de343c6ccb64a7cc25379a4676138e22b500d3c0da2cfdae6b7fbffb784 SHA512 a019fb9f1bf2b8550cdb904fb9fccf73c82718284b53d88fdad2a87e4fea303f78bbf25b85d57427164625030e28e94fe731a8b0a6ee4252e13bcc781a398412
23 -DIST firefox-101-patches-05jwl.tar.xz 39392 BLAKE2B 4c47e6c024d19cb904918489fd145ff14d89bd855d573b50af6ee03700677373f237a83ad31d2a5b4abbd85fb8aba2e5be0be743a2cbd10229d31af6c3c3eb4b SHA512 db8d6d302d89bdc9b6f7ea433ecc02d95e8767dc3e13e301539f4d35586c1473c17c48424a4fad70954e21063d93c10e91effc29d17d1c1595de079dcb47fc46
24 DIST firefox-101-patches-09j.tar.xz 40532 BLAKE2B e41984b7266deb87d520fb2de214fe6e10e75c8b249312adb69f08873076931dcc469e57b44365245f4d46613fd26385137f49a3883e6cd4e2ac4783efa2114a SHA512 300a225ab4e002cd769589c2fbd149ac09a9e1bc916c92c08d3f38ddec9b5a75e6f4d0cbafb7dcd88c5f8a3653b80c7c0eb92ddff63fe2a505ed43819588669e
25 DIST firefox-101.0.1-ach.xpi 443457 BLAKE2B 68a1ebdccbce17eeac8824e63e034f0db706a091b4dea9ce1c14d0b769ad404e36004e89a838ef68bfbc44336125bb3494ade8b076ce38e70ea15b78f394f8e5 SHA512 9ee130d4e96bb73ec2ec01bd75faa2687bcb620727f44e199ee17db3e523254e0a0e8bd8d1813f4eebeb80e575ba20b312677d23a4994aadc6a4d4fb9bbfa5b8
26 DIST firefox-101.0.1-af.xpi 413389 BLAKE2B d531c87e3df019cd5ff8e497cb3e74f000d238b65329d4eff72fbe80c2e3052abbaa19bac17d9383df1a2d88e60fa20c9511b1c12ca3fc06fb986db4902da772 SHA512 c9ddeb4ddd6dd8704c17f5dd8bf8ebdb881d88ad1bb1e01737b70ba0efd3374fda0829123afcbfbf98b770be4c281a714fbab2ee30d6fceff3eacbfa398df9db
27
28 diff --git a/www-client/firefox/firefox-101.0.1-r10.ebuild b/www-client/firefox/firefox-101.0.1-r10.ebuild
29 deleted file mode 100644
30 index 0dee9d411efe..000000000000
31 --- a/www-client/firefox/firefox-101.0.1-r10.ebuild
32 +++ /dev/null
33 @@ -1,1292 +0,0 @@
34 -# Copyright 1999-2022 Gentoo Authors
35 -# Distributed under the terms of the GNU General Public License v2
36 -
37 -EAPI="8"
38 -
39 -FIREFOX_PATCHSET="firefox-101-patches-05jwl.tar.xz"
40 -
41 -LLVM_MAX_SLOT=14
42 -
43 -PYTHON_COMPAT=( python3_{8..10} )
44 -PYTHON_REQ_USE="ncurses,sqlite,ssl"
45 -
46 -WANT_AUTOCONF="2.1"
47 -
48 -VIRTUALX_REQUIRED="pgo"
49 -
50 -MOZ_ESR=
51 -
52 -MOZ_PV=${PV}
53 -MOZ_PV_SUFFIX=
54 -if [[ ${PV} =~ (_(alpha|beta|rc).*)$ ]] ; then
55 - MOZ_PV_SUFFIX=${BASH_REMATCH[1]}
56 -
57 - # Convert the ebuild version to the upstream Mozilla version
58 - MOZ_PV="${MOZ_PV/_alpha/a}" # Handle alpha for SRC_URI
59 - MOZ_PV="${MOZ_PV/_beta/b}" # Handle beta for SRC_URI
60 - MOZ_PV="${MOZ_PV%%_rc*}" # Handle rc for SRC_URI
61 -fi
62 -
63 -if [[ -n ${MOZ_ESR} ]] ; then
64 - # ESR releases have slightly different version numbers
65 - MOZ_PV="${MOZ_PV}esr"
66 -fi
67 -
68 -MOZ_PN="${PN%-bin}"
69 -MOZ_P="${MOZ_PN}-${MOZ_PV}"
70 -MOZ_PV_DISTFILES="${MOZ_PV}${MOZ_PV_SUFFIX}"
71 -MOZ_P_DISTFILES="${MOZ_PN}-${MOZ_PV_DISTFILES}"
72 -
73 -inherit autotools check-reqs desktop flag-o-matic gnome2-utils linux-info \
74 - llvm multiprocessing pax-utils python-any-r1 toolchain-funcs \
75 - virtualx xdg
76 -
77 -MOZ_SRC_BASE_URI="https://archive.mozilla.org/pub/${MOZ_PN}/releases/${MOZ_PV}"
78 -
79 -if [[ ${PV} == *_rc* ]] ; then
80 - MOZ_SRC_BASE_URI="https://archive.mozilla.org/pub/${MOZ_PN}/candidates/${MOZ_PV}-candidates/build${PV##*_rc}"
81 -fi
82 -
83 -PATCH_URIS=(
84 - https://dev.gentoo.org/~{juippis,polynomial-c,whissi,slashbeast}/mozilla/patchsets/${FIREFOX_PATCHSET}
85 -)
86 -
87 -SRC_URI="${MOZ_SRC_BASE_URI}/source/${MOZ_P}.source.tar.xz -> ${MOZ_P_DISTFILES}.source.tar.xz
88 - ${PATCH_URIS[@]}"
89 -
90 -DESCRIPTION="Firefox Web Browser"
91 -HOMEPAGE="https://www.mozilla.com/firefox"
92 -
93 -KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
94 -
95 -SLOT="rapid"
96 -LICENSE="MPL-2.0 GPL-2 LGPL-2.1"
97 -
98 -IUSE="+clang cpu_flags_arm_neon dbus debug eme-free hardened hwaccel"
99 -IUSE+=" jack libproxy lto +openh264 pgo pulseaudio sndio selinux"
100 -IUSE+=" +system-av1 +system-harfbuzz +system-icu +system-jpeg +system-libevent +system-libvpx system-png system-python-libs +system-webp"
101 -IUSE+=" wayland wifi"
102 -
103 -# Firefox-only IUSE
104 -IUSE+=" geckodriver +gmp-autoupdate screencast +X"
105 -
106 -REQUIRED_USE="debug? ( !system-av1 )
107 - pgo? ( lto )
108 - wayland? ( dbus )
109 - wifi? ( dbus )"
110 -
111 -# Firefox-only REQUIRED_USE flags
112 -REQUIRED_USE+=" || ( X wayland )"
113 -REQUIRED_USE+=" pgo? ( X )"
114 -REQUIRED_USE+=" screencast? ( wayland )"
115 -
116 -BDEPEND="${PYTHON_DEPS}
117 - app-arch/unzip
118 - app-arch/zip
119 - >=dev-util/cbindgen-0.24.0
120 - >=net-libs/nodejs-10.23.1
121 - virtual/pkgconfig
122 - >=virtual/rust-1.59.0
123 - || (
124 - (
125 - sys-devel/clang:14
126 - sys-devel/llvm:14
127 - clang? (
128 - =sys-devel/lld-14*
129 - pgo? ( =sys-libs/compiler-rt-sanitizers-14*[profile] )
130 - )
131 - )
132 - (
133 - sys-devel/clang:13
134 - sys-devel/llvm:13
135 - clang? (
136 - =sys-devel/lld-13*
137 - pgo? ( =sys-libs/compiler-rt-sanitizers-13*[profile] )
138 - )
139 - )
140 - (
141 - sys-devel/clang:12
142 - sys-devel/llvm:12
143 - clang? (
144 - =sys-devel/lld-12*
145 - pgo? ( =sys-libs/compiler-rt-sanitizers-12*[profile] )
146 - )
147 - )
148 - )
149 - amd64? ( >=dev-lang/nasm-2.14 )
150 - x86? ( >=dev-lang/nasm-2.14 )"
151 -
152 -COMMON_DEPEND="
153 - dev-libs/glib:2
154 - dev-libs/atk
155 - dev-libs/expat
156 - dev-libs/libffi:=
157 - >=dev-libs/nss-3.78
158 - >=dev-libs/nspr-4.32
159 - media-libs/alsa-lib
160 - media-libs/fontconfig
161 - media-libs/freetype
162 - media-libs/mesa
163 - media-video/ffmpeg
164 - sys-libs/zlib
165 - virtual/freedesktop-icon-theme
166 - x11-libs/cairo
167 - x11-libs/gdk-pixbuf
168 - x11-libs/pango
169 - x11-libs/pixman
170 - dbus? (
171 - dev-libs/dbus-glib
172 - sys-apps/dbus
173 - )
174 - jack? ( virtual/jack )
175 - libproxy? ( net-libs/libproxy )
176 - selinux? ( sec-policy/selinux-mozilla )
177 - sndio? ( >=media-sound/sndio-1.8.0-r1 )
178 - screencast? ( media-video/pipewire:= )
179 - system-av1? (
180 - >=media-libs/dav1d-0.9.3:=
181 - >=media-libs/libaom-1.0.0:=
182 - )
183 - system-harfbuzz? (
184 - >=media-gfx/graphite2-1.3.13
185 - >=media-libs/harfbuzz-2.8.1:0=
186 - )
187 - system-icu? ( >=dev-libs/icu-71.1:= )
188 - system-jpeg? ( >=media-libs/libjpeg-turbo-1.2.1 )
189 - system-libevent? ( >=dev-libs/libevent-2.0:0=[threads] )
190 - system-libvpx? ( >=media-libs/libvpx-1.8.2:0=[postproc] )
191 - system-png? ( >=media-libs/libpng-1.6.35:0=[apng] )
192 - system-webp? ( >=media-libs/libwebp-1.1.0:0= )
193 - wayland? (
194 - x11-libs/gtk+:3[wayland]
195 - x11-libs/libdrm
196 - x11-libs/libxkbcommon[wayland]
197 - )
198 - wifi? (
199 - kernel_linux? (
200 - dev-libs/dbus-glib
201 - net-misc/networkmanager
202 - sys-apps/dbus
203 - )
204 - )
205 - X? (
206 - virtual/opengl
207 - x11-libs/cairo[X]
208 - x11-libs/gtk+:3[X]
209 - x11-libs/libX11
210 - x11-libs/libXcomposite
211 - x11-libs/libXdamage
212 - x11-libs/libXext
213 - x11-libs/libXfixes
214 - x11-libs/libxkbcommon[X]
215 - x11-libs/libXrandr
216 - x11-libs/libXtst
217 - x11-libs/libxcb:=
218 - )"
219 -
220 -RDEPEND="${COMMON_DEPEND}
221 - !www-client/firefox:0
222 - !www-client/firefox:esr
223 - jack? ( virtual/jack )
224 - openh264? ( media-libs/openh264:*[plugin] )
225 - pulseaudio? (
226 - || (
227 - media-sound/pulseaudio
228 - >=media-sound/apulse-0.1.12-r4
229 - )
230 - )
231 - selinux? ( sec-policy/selinux-mozilla )"
232 -
233 -DEPEND="${COMMON_DEPEND}
234 - pulseaudio? (
235 - || (
236 - media-sound/pulseaudio
237 - >=media-sound/apulse-0.1.12-r4[sdk]
238 - )
239 - )
240 - X? (
241 - x11-libs/libICE
242 - x11-libs/libSM
243 - )"
244 -
245 -S="${WORKDIR}/${PN}-${PV%_*}"
246 -
247 -# Allow MOZ_GMP_PLUGIN_LIST to be set in an eclass or
248 -# overridden in the enviromnent (advanced hackers only)
249 -if [[ -z "${MOZ_GMP_PLUGIN_LIST+set}" ]] ; then
250 - MOZ_GMP_PLUGIN_LIST=( gmp-gmpopenh264 gmp-widevinecdm )
251 -fi
252 -
253 -llvm_check_deps() {
254 - if ! has_version -b "sys-devel/clang:${LLVM_SLOT}" ; then
255 - einfo "sys-devel/clang:${LLVM_SLOT} is missing! Cannot use LLVM slot ${LLVM_SLOT} ..." >&2
256 - return 1
257 - fi
258 -
259 - if use clang ; then
260 - if ! has_version -b "=sys-devel/lld-${LLVM_SLOT}*" ; then
261 - einfo "=sys-devel/lld-${LLVM_SLOT}* is missing! Cannot use LLVM slot ${LLVM_SLOT} ..." >&2
262 - return 1
263 - fi
264 -
265 - if use pgo ; then
266 - if ! has_version -b "=sys-libs/compiler-rt-sanitizers-${LLVM_SLOT}*" ; then
267 - einfo "=sys-libs/compiler-rt-sanitizers-${LLVM_SLOT}* is missing! Cannot use LLVM slot ${LLVM_SLOT} ..." >&2
268 - return 1
269 - fi
270 - fi
271 - fi
272 -
273 - einfo "Using LLVM slot ${LLVM_SLOT} to build" >&2
274 -}
275 -
276 -MOZ_LANGS=(
277 - af ar ast be bg br ca cak cs cy da de dsb
278 - el en-CA en-GB en-US es-AR es-ES et eu
279 - fi fr fy-NL ga-IE gd gl he hr hsb hu
280 - id is it ja ka kab kk ko lt lv ms nb-NO nl nn-NO
281 - pa-IN pl pt-BR pt-PT rm ro ru
282 - sk sl sq sr sv-SE th tr uk uz vi zh-CN zh-TW
283 -)
284 -
285 -# Firefox-only LANGS
286 -MOZ_LANGS+=( ach )
287 -MOZ_LANGS+=( an )
288 -MOZ_LANGS+=( az )
289 -MOZ_LANGS+=( bn )
290 -MOZ_LANGS+=( bs )
291 -MOZ_LANGS+=( ca-valencia )
292 -MOZ_LANGS+=( eo )
293 -MOZ_LANGS+=( es-CL )
294 -MOZ_LANGS+=( es-MX )
295 -MOZ_LANGS+=( fa )
296 -MOZ_LANGS+=( ff )
297 -MOZ_LANGS+=( gn )
298 -MOZ_LANGS+=( gu-IN )
299 -MOZ_LANGS+=( hi-IN )
300 -MOZ_LANGS+=( hy-AM )
301 -MOZ_LANGS+=( ia )
302 -MOZ_LANGS+=( km )
303 -MOZ_LANGS+=( kn )
304 -MOZ_LANGS+=( lij )
305 -MOZ_LANGS+=( mk )
306 -MOZ_LANGS+=( mr )
307 -MOZ_LANGS+=( my )
308 -MOZ_LANGS+=( ne-NP )
309 -MOZ_LANGS+=( oc )
310 -MOZ_LANGS+=( sco )
311 -MOZ_LANGS+=( si )
312 -MOZ_LANGS+=( son )
313 -MOZ_LANGS+=( szl )
314 -MOZ_LANGS+=( ta )
315 -MOZ_LANGS+=( te )
316 -MOZ_LANGS+=( tl )
317 -MOZ_LANGS+=( trs )
318 -MOZ_LANGS+=( ur )
319 -MOZ_LANGS+=( xh )
320 -
321 -mozilla_set_globals() {
322 - # https://bugs.gentoo.org/587334
323 - local MOZ_TOO_REGIONALIZED_FOR_L10N=(
324 - fy-NL ga-IE gu-IN hi-IN hy-AM nb-NO ne-NP nn-NO pa-IN sv-SE
325 - )
326 -
327 - local lang xflag
328 - for lang in "${MOZ_LANGS[@]}" ; do
329 - # en and en_US are handled internally
330 - if [[ ${lang} == en ]] || [[ ${lang} == en-US ]] ; then
331 - continue
332 - fi
333 -
334 - # strip region subtag if $lang is in the list
335 - if has ${lang} "${MOZ_TOO_REGIONALIZED_FOR_L10N[@]}" ; then
336 - xflag=${lang%%-*}
337 - else
338 - xflag=${lang}
339 - fi
340 -
341 - SRC_URI+=" l10n_${xflag/[_@]/-}? ("
342 - SRC_URI+=" ${MOZ_SRC_BASE_URI}/linux-x86_64/xpi/${lang}.xpi -> ${MOZ_P_DISTFILES}-${lang}.xpi"
343 - SRC_URI+=" )"
344 - IUSE+=" l10n_${xflag/[_@]/-}"
345 - done
346 -}
347 -mozilla_set_globals
348 -
349 -moz_clear_vendor_checksums() {
350 - debug-print-function ${FUNCNAME} "$@"
351 -
352 - if [[ ${#} -ne 1 ]] ; then
353 - die "${FUNCNAME} requires exact one argument"
354 - fi
355 -
356 - einfo "Clearing cargo checksums for ${1} ..."
357 -
358 - sed -i \
359 - -e 's/\("files":{\)[^}]*/\1/' \
360 - "${S}"/third_party/rust/${1}/.cargo-checksum.json \
361 - || die
362 -}
363 -
364 -moz_install_xpi() {
365 - debug-print-function ${FUNCNAME} "$@"
366 -
367 - if [[ ${#} -lt 2 ]] ; then
368 - die "${FUNCNAME} requires at least two arguments"
369 - fi
370 -
371 - local DESTDIR=${1}
372 - shift
373 -
374 - insinto "${DESTDIR}"
375 -
376 - local emid xpi_file xpi_tmp_dir
377 - for xpi_file in "${@}" ; do
378 - emid=
379 - xpi_tmp_dir=$(mktemp -d --tmpdir="${T}")
380 -
381 - # Unpack XPI
382 - unzip -qq "${xpi_file}" -d "${xpi_tmp_dir}" || die
383 -
384 - # Determine extension ID
385 - if [[ -f "${xpi_tmp_dir}/install.rdf" ]] ; then
386 - emid=$(sed -n -e '/install-manifest/,$ { /em:id/!d; s/.*[\">]\([^\"<>]*\)[\"<].*/\1/; p; q }' "${xpi_tmp_dir}/install.rdf")
387 - [[ -z "${emid}" ]] && die "failed to determine extension id from install.rdf"
388 - elif [[ -f "${xpi_tmp_dir}/manifest.json" ]] ; then
389 - emid=$(sed -n -e 's/.*"id": "\([^"]*\)".*/\1/p' "${xpi_tmp_dir}/manifest.json")
390 - [[ -z "${emid}" ]] && die "failed to determine extension id from manifest.json"
391 - else
392 - die "failed to determine extension id"
393 - fi
394 -
395 - einfo "Installing ${emid}.xpi into ${ED}${DESTDIR} ..."
396 - newins "${xpi_file}" "${emid}.xpi"
397 - done
398 -}
399 -
400 -mozconfig_add_options_ac() {
401 - debug-print-function ${FUNCNAME} "$@"
402 -
403 - if [[ ${#} -lt 2 ]] ; then
404 - die "${FUNCNAME} requires at least two arguments"
405 - fi
406 -
407 - local reason=${1}
408 - shift
409 -
410 - local option
411 - for option in ${@} ; do
412 - echo "ac_add_options ${option} # ${reason}" >>${MOZCONFIG}
413 - done
414 -}
415 -
416 -mozconfig_add_options_mk() {
417 - debug-print-function ${FUNCNAME} "$@"
418 -
419 - if [[ ${#} -lt 2 ]] ; then
420 - die "${FUNCNAME} requires at least two arguments"
421 - fi
422 -
423 - local reason=${1}
424 - shift
425 -
426 - local option
427 - for option in ${@} ; do
428 - echo "mk_add_options ${option} # ${reason}" >>${MOZCONFIG}
429 - done
430 -}
431 -
432 -mozconfig_use_enable() {
433 - debug-print-function ${FUNCNAME} "$@"
434 -
435 - if [[ ${#} -lt 1 ]] ; then
436 - die "${FUNCNAME} requires at least one arguments"
437 - fi
438 -
439 - local flag=$(use_enable "${@}")
440 - mozconfig_add_options_ac "$(use ${1} && echo +${1} || echo -${1})" "${flag}"
441 -}
442 -
443 -mozconfig_use_with() {
444 - debug-print-function ${FUNCNAME} "$@"
445 -
446 - if [[ ${#} -lt 1 ]] ; then
447 - die "${FUNCNAME} requires at least one arguments"
448 - fi
449 -
450 - local flag=$(use_with "${@}")
451 - mozconfig_add_options_ac "$(use ${1} && echo +${1} || echo -${1})" "${flag}"
452 -}
453 -
454 -pkg_pretend() {
455 - if [[ ${MERGE_TYPE} != binary ]] ; then
456 - if use pgo ; then
457 - if ! has usersandbox $FEATURES ; then
458 - die "You must enable usersandbox as X server can not run as root!"
459 - fi
460 - fi
461 -
462 - # Ensure we have enough disk space to compile
463 - if use pgo || use lto || use debug ; then
464 - CHECKREQS_DISK_BUILD="13500M"
465 - else
466 - CHECKREQS_DISK_BUILD="6600M"
467 - fi
468 -
469 - check-reqs_pkg_pretend
470 - fi
471 -}
472 -
473 -pkg_setup() {
474 - if [[ ${MERGE_TYPE} != binary ]] ; then
475 - if use pgo ; then
476 - if ! has userpriv ${FEATURES} ; then
477 - eerror "Building ${PN} with USE=pgo and FEATURES=-userpriv is not supported!"
478 - fi
479 - fi
480 -
481 - # Ensure we have enough disk space to compile
482 - if use pgo || use lto || use debug ; then
483 - CHECKREQS_DISK_BUILD="13500M"
484 - else
485 - CHECKREQS_DISK_BUILD="6400M"
486 - fi
487 -
488 - check-reqs_pkg_setup
489 -
490 - llvm_pkg_setup
491 -
492 - if use clang && use lto ; then
493 - local version_lld=$(ld.lld --version 2>/dev/null | awk '{ print $2 }')
494 - [[ -n ${version_lld} ]] && version_lld=$(ver_cut 1 "${version_lld}")
495 - [[ -z ${version_lld} ]] && die "Failed to read ld.lld version!"
496 -
497 - local version_llvm_rust=$(rustc -Vv 2>/dev/null | grep -F -- 'LLVM version:' | awk '{ print $3 }')
498 - [[ -n ${version_llvm_rust} ]] && version_llvm_rust=$(ver_cut 1 "${version_llvm_rust}")
499 - [[ -z ${version_llvm_rust} ]] && die "Failed to read used LLVM version from rustc!"
500 -
501 - if ver_test "${version_lld}" -ne "${version_llvm_rust}" ; then
502 - eerror "Rust is using LLVM version ${version_llvm_rust} but ld.lld version belongs to LLVM version ${version_lld}."
503 - eerror "You will be unable to link ${CATEGORY}/${PN}. To proceed you have the following options:"
504 - eerror " - Manually switch rust version using 'eselect rust' to match used LLVM version"
505 - eerror " - Switch to dev-lang/rust[system-llvm] which will guarantee matching version"
506 - eerror " - Build ${CATEGORY}/${PN} without USE=lto"
507 - eerror " - Rebuild lld with llvm that was used to build rust (may need to rebuild the whole "
508 - eerror " llvm/clang/lld/rust chain depending on your @world updates)"
509 - die "LLVM version used by Rust (${version_llvm_rust}) does not match with ld.lld version (${version_lld})!"
510 - fi
511 - fi
512 -
513 - if ! use clang && [[ $(gcc-major-version) -eq 11 ]] \
514 - && ! has_version -b ">sys-devel/gcc-11.1.0:11" ; then
515 - # bug 792705
516 - eerror "Using GCC 11 to compile firefox is currently known to be broken (see bug #792705)."
517 - die "Set USE=clang or select <gcc-11 to build ${CATEGORY}/${P}."
518 - fi
519 -
520 - python-any-r1_pkg_setup
521 -
522 - # Avoid PGO profiling problems due to enviroment leakage
523 - # These should *always* be cleaned up anyway
524 - unset \
525 - DBUS_SESSION_BUS_ADDRESS \
526 - DISPLAY \
527 - ORBIT_SOCKETDIR \
528 - SESSION_MANAGER \
529 - XAUTHORITY \
530 - XDG_CACHE_HOME \
531 - XDG_SESSION_COOKIE
532 -
533 - # Build system is using /proc/self/oom_score_adj, bug #604394
534 - addpredict /proc/self/oom_score_adj
535 -
536 - if use pgo ; then
537 - # Allow access to GPU during PGO run
538 - local ati_cards mesa_cards nvidia_cards render_cards
539 - shopt -s nullglob
540 -
541 - ati_cards=$(echo -n /dev/ati/card* | sed 's/ /:/g')
542 - if [[ -n "${ati_cards}" ]] ; then
543 - addpredict "${ati_cards}"
544 - fi
545 -
546 - mesa_cards=$(echo -n /dev/dri/card* | sed 's/ /:/g')
547 - if [[ -n "${mesa_cards}" ]] ; then
548 - addpredict "${mesa_cards}"
549 - fi
550 -
551 - nvidia_cards=$(echo -n /dev/nvidia* | sed 's/ /:/g')
552 - if [[ -n "${nvidia_cards}" ]] ; then
553 - addpredict "${nvidia_cards}"
554 - fi
555 -
556 - render_cards=$(echo -n /dev/dri/renderD128* | sed 's/ /:/g')
557 - if [[ -n "${render_cards}" ]] ; then
558 - addpredict "${render_cards}"
559 - fi
560 -
561 - shopt -u nullglob
562 - fi
563 -
564 - if ! mountpoint -q /dev/shm ; then
565 - # If /dev/shm is not available, configure is known to fail with
566 - # a traceback report referencing /usr/lib/pythonN.N/multiprocessing/synchronize.py
567 - ewarn "/dev/shm is not mounted -- expect build failures!"
568 - fi
569 -
570 - # Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
571 - # Note: These are for Gentoo Linux use ONLY. For your own distribution, please
572 - # get your own set of keys.
573 - if [[ -z "${MOZ_API_KEY_GOOGLE+set}" ]] ; then
574 - MOZ_API_KEY_GOOGLE="AIzaSyDEAOvatFogGaPi0eTgsV_ZlEzx0ObmepsMzfAc"
575 - fi
576 -
577 - if [[ -z "${MOZ_API_KEY_LOCATION+set}" ]] ; then
578 - MOZ_API_KEY_LOCATION="AIzaSyB2h2OuRgGaPicUgy5N-5hsZqiPW6sH3n_rptiQ"
579 - fi
580 -
581 - # Mozilla API keys (see https://location.services.mozilla.com/api)
582 - # Note: These are for Gentoo Linux use ONLY. For your own distribution, please
583 - # get your own set of keys.
584 - if [[ -z "${MOZ_API_KEY_MOZILLA+set}" ]] ; then
585 - MOZ_API_KEY_MOZILLA="edb3d487-3a84-46m0ap1e3-9dfd-92b5efaaa005"
586 - fi
587 -
588 - # Ensure we use C locale when building, bug #746215
589 - export LC_ALL=C
590 - fi
591 -
592 - CONFIG_CHECK="~SECCOMP"
593 - WARNING_SECCOMP="CONFIG_SECCOMP not set! This system will be unable to play DRM-protected content."
594 - linux-info_pkg_setup
595 -}
596 -
597 -src_unpack() {
598 - local _lp_dir="${WORKDIR}/language_packs"
599 - local _src_file
600 -
601 - if [[ ! -d "${_lp_dir}" ]] ; then
602 - mkdir "${_lp_dir}" || die
603 - fi
604 -
605 - for _src_file in ${A} ; do
606 - if [[ ${_src_file} == *.xpi ]]; then
607 - cp "${DISTDIR}/${_src_file}" "${_lp_dir}" || die "Failed to copy '${_src_file}' to '${_lp_dir}'!"
608 - else
609 - unpack ${_src_file}
610 - fi
611 - done
612 -}
613 -
614 -src_prepare() {
615 - use lto && rm -v "${WORKDIR}"/firefox-patches/*-LTO-Only-enable-LTO-*.patch
616 - eapply "${WORKDIR}/firefox-patches"
617 -
618 - # Allow user to apply any additional patches without modifing ebuild
619 - eapply_user
620 -
621 - # Make cargo respect MAKEOPTS
622 - export CARGO_BUILD_JOBS="$(makeopts_jobs)"
623 -
624 - # Make LTO respect MAKEOPTS
625 - sed -i \
626 - -e "s/multiprocessing.cpu_count()/$(makeopts_jobs)/" \
627 - "${S}"/build/moz.configure/lto-pgo.configure \
628 - || die "sed failed to set num_cores"
629 -
630 - # Make ICU respect MAKEOPTS
631 - sed -i \
632 - -e "s/multiprocessing.cpu_count()/$(makeopts_jobs)/" \
633 - "${S}"/intl/icu_sources_data.py \
634 - || die "sed failed to set num_cores"
635 -
636 - # sed-in toolchain prefix
637 - sed -i \
638 - -e "s/objdump/${CHOST}-objdump/" \
639 - "${S}"/python/mozbuild/mozbuild/configure/check_debug_ranges.py \
640 - || die "sed failed to set toolchain prefix"
641 -
642 - sed -i \
643 - -e 's/ccache_stats = None/return None/' \
644 - "${S}"/python/mozbuild/mozbuild/controller/building.py \
645 - || die "sed failed to disable ccache stats call"
646 -
647 - einfo "Removing pre-built binaries ..."
648 - find "${S}"/third_party -type f \( -name '*.so' -o -name '*.o' \) -print -delete || die
649 -
650 - # Clearing checksums where we have applied patches
651 - moz_clear_vendor_checksums target-lexicon-0.9.0
652 -
653 - # Create build dir
654 - BUILD_DIR="${WORKDIR}/${PN}_build"
655 - mkdir -p "${BUILD_DIR}" || die
656 -
657 - # Write API keys to disk
658 - echo -n "${MOZ_API_KEY_GOOGLE//gGaPi/}" > "${S}"/api-google.key || die
659 - echo -n "${MOZ_API_KEY_LOCATION//gGaPi/}" > "${S}"/api-location.key || die
660 - echo -n "${MOZ_API_KEY_MOZILLA//m0ap1/}" > "${S}"/api-mozilla.key || die
661 -
662 - xdg_environment_reset
663 -}
664 -
665 -src_configure() {
666 - # Show flags set at the beginning
667 - einfo "Current BINDGEN_CFLAGS:\t${BINDGEN_CFLAGS:-no value set}"
668 - einfo "Current CFLAGS:\t\t${CFLAGS:-no value set}"
669 - einfo "Current CXXFLAGS:\t\t${CXXFLAGS:-no value set}"
670 - einfo "Current LDFLAGS:\t\t${LDFLAGS:-no value set}"
671 - einfo "Current RUSTFLAGS:\t\t${RUSTFLAGS:-no value set}"
672 -
673 - local have_switched_compiler=
674 - if use clang && ! tc-is-clang ; then
675 - # Force clang
676 - einfo "Enforcing the use of clang due to USE=clang ..."
677 - have_switched_compiler=yes
678 - AR=llvm-ar
679 - AS=llvm-as
680 - CC=${CHOST}-clang
681 - CXX=${CHOST}-clang++
682 - NM=llvm-nm
683 - RANLIB=llvm-ranlib
684 - elif ! use clang && ! tc-is-gcc ; then
685 - # Force gcc
686 - have_switched_compiler=yes
687 - einfo "Enforcing the use of gcc due to USE=-clang ..."
688 - AR=gcc-ar
689 - CC=${CHOST}-gcc
690 - CXX=${CHOST}-g++
691 - NM=gcc-nm
692 - RANLIB=gcc-ranlib
693 - fi
694 -
695 - if [[ -n "${have_switched_compiler}" ]] ; then
696 - # Because we switched active compiler we have to ensure
697 - # that no unsupported flags are set
698 - strip-unsupported-flags
699 - fi
700 -
701 - # Ensure we use correct toolchain
702 - export HOST_CC="$(tc-getBUILD_CC)"
703 - export HOST_CXX="$(tc-getBUILD_CXX)"
704 - tc-export CC CXX LD AR NM OBJDUMP RANLIB PKG_CONFIG
705 -
706 - # Pass the correct toolchain paths through cbindgen
707 - if tc-is-cross-compiler ; then
708 - export BINDGEN_CFLAGS="${SYSROOT:+--sysroot=${ESYSROOT}} --target=${CHOST} ${BINDGEN_CFLAGS-}"
709 - fi
710 -
711 - # Set MOZILLA_FIVE_HOME
712 - export MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
713 -
714 - # python/mach/mach/mixin/process.py fails to detect SHELL
715 - export SHELL="${EPREFIX}/bin/bash"
716 -
717 - # Set state path
718 - export MOZBUILD_STATE_PATH="${BUILD_DIR}"
719 -
720 - # Set MOZCONFIG
721 - export MOZCONFIG="${S}/.mozconfig"
722 -
723 - # Initialize MOZCONFIG
724 - mozconfig_add_options_ac '' --enable-application=browser
725 -
726 - # Set Gentoo defaults
727 - export MOZILLA_OFFICIAL=1
728 -
729 - mozconfig_add_options_ac 'Gentoo default' \
730 - --allow-addon-sideload \
731 - --disable-cargo-incremental \
732 - --disable-crashreporter \
733 - --disable-gpsd \
734 - --disable-install-strip \
735 - --disable-parental-controls \
736 - --disable-strip \
737 - --disable-updater \
738 - --enable-negotiateauth \
739 - --enable-new-pass-manager \
740 - --enable-official-branding \
741 - --enable-release \
742 - --enable-system-ffi \
743 - --enable-system-pixman \
744 - --host="${CBUILD:-${CHOST}}" \
745 - --libdir="${EPREFIX}/usr/$(get_libdir)" \
746 - --prefix="${EPREFIX}/usr" \
747 - --target="${CHOST}" \
748 - --without-ccache \
749 - --without-wasm-sandboxed-libraries \
750 - --with-intl-api \
751 - --with-libclang-path="$(llvm-config --libdir)" \
752 - --with-system-nspr \
753 - --with-system-nss \
754 - --with-system-zlib \
755 - --with-toolchain-prefix="${CHOST}-" \
756 - --with-unsigned-addon-scopes=app,system \
757 - --x-includes="${ESYSROOT}/usr/include" \
758 - --x-libraries="${ESYSROOT}/usr/$(get_libdir)"
759 -
760 - # Set update channel
761 - local update_channel=release
762 - [[ -n ${MOZ_ESR} ]] && update_channel=esr
763 - mozconfig_add_options_ac '' --update-channel=${update_channel}
764 -
765 - if ! use x86 && [[ ${CHOST} != armv*h* ]] ; then
766 - mozconfig_add_options_ac '' --enable-rust-simd
767 - fi
768 -
769 - # For future keywording: This is currently (97.0) only supported on:
770 - # amd64, arm, arm64 & x86.
771 - # Might want to flip the logic around if Firefox is to support more arches.
772 - if use ppc64; then
773 - mozconfig_add_options_ac '' --disable-sandbox
774 - else
775 - mozconfig_add_options_ac '' --enable-sandbox
776 - fi
777 -
778 - if [[ -s "${S}/api-google.key" ]] ; then
779 - local key_origin="Gentoo default"
780 - if [[ $(cat "${S}/api-google.key" | md5sum | awk '{ print $1 }') != 709560c02f94b41f9ad2c49207be6c54 ]] ; then
781 - key_origin="User value"
782 - fi
783 -
784 - mozconfig_add_options_ac "${key_origin}" \
785 - --with-google-safebrowsing-api-keyfile="${S}/api-google.key"
786 - else
787 - einfo "Building without Google API key ..."
788 - fi
789 -
790 - if [[ -s "${S}/api-location.key" ]] ; then
791 - local key_origin="Gentoo default"
792 - if [[ $(cat "${S}/api-location.key" | md5sum | awk '{ print $1 }') != ffb7895e35dedf832eb1c5d420ac7420 ]] ; then
793 - key_origin="User value"
794 - fi
795 -
796 - mozconfig_add_options_ac "${key_origin}" \
797 - --with-google-location-service-api-keyfile="${S}/api-location.key"
798 - else
799 - einfo "Building without Location API key ..."
800 - fi
801 -
802 - if [[ -s "${S}/api-mozilla.key" ]] ; then
803 - local key_origin="Gentoo default"
804 - if [[ $(cat "${S}/api-mozilla.key" | md5sum | awk '{ print $1 }') != 3927726e9442a8e8fa0e46ccc39caa27 ]] ; then
805 - key_origin="User value"
806 - fi
807 -
808 - mozconfig_add_options_ac "${key_origin}" \
809 - --with-mozilla-api-keyfile="${S}/api-mozilla.key"
810 - else
811 - einfo "Building without Mozilla API key ..."
812 - fi
813 -
814 - mozconfig_use_with system-av1
815 - mozconfig_use_with system-harfbuzz
816 - mozconfig_use_with system-harfbuzz system-graphite2
817 - mozconfig_use_with system-icu
818 - mozconfig_use_with system-jpeg
819 - mozconfig_use_with system-libevent
820 - mozconfig_use_with system-libvpx
821 - mozconfig_use_with system-png
822 - mozconfig_use_with system-webp
823 -
824 - mozconfig_use_enable dbus
825 - mozconfig_use_enable libproxy
826 -
827 - use eme-free && mozconfig_add_options_ac '+eme-free' --disable-eme
828 -
829 - mozconfig_use_enable geckodriver
830 -
831 - if use hardened ; then
832 - mozconfig_add_options_ac "+hardened" --enable-hardening
833 - append-ldflags "-Wl,-z,relro -Wl,-z,now"
834 - fi
835 -
836 - local myaudiobackends=""
837 - use jack && myaudiobackends+="jack,"
838 - use sndio && myaudiobackends+="sndio,"
839 - use pulseaudio && myaudiobackends+="pulseaudio,"
840 - ! use pulseaudio && myaudiobackends+="alsa,"
841 -
842 - mozconfig_add_options_ac '--enable-audio-backends' --enable-audio-backends="${myaudiobackends::-1}"
843 -
844 - mozconfig_use_enable wifi necko-wifi
845 -
846 - if use X && use wayland ; then
847 - mozconfig_add_options_ac '+x11+wayland' --enable-default-toolkit=cairo-gtk3-x11-wayland
848 - elif ! use X && use wayland ; then
849 - mozconfig_add_options_ac '+wayland' --enable-default-toolkit=cairo-gtk3-wayland-only
850 - else
851 - mozconfig_add_options_ac '+x11' --enable-default-toolkit=cairo-gtk3
852 - fi
853 -
854 - if use lto ; then
855 - if use clang ; then
856 - # Upstream only supports lld when using clang
857 - mozconfig_add_options_ac "forcing ld=lld due to USE=clang and USE=lto" --enable-linker=lld
858 -
859 - mozconfig_add_options_ac '+lto' --enable-lto=cross
860 -
861 - else
862 - # ThinLTO is currently broken, see bmo#1644409
863 - mozconfig_add_options_ac '+lto' --enable-lto=full
864 - mozconfig_add_options_ac "linker is set to bfd" --enable-linker=bfd
865 - fi
866 -
867 - if use pgo ; then
868 - mozconfig_add_options_ac '+pgo' MOZ_PGO=1
869 -
870 - if use clang ; then
871 - # Used in build/pgo/profileserver.py
872 - export LLVM_PROFDATA="llvm-profdata"
873 - fi
874 - fi
875 - else
876 - # Avoid auto-magic on linker
877 - if use clang ; then
878 - # This is upstream's default
879 - mozconfig_add_options_ac "forcing ld=lld due to USE=clang" --enable-linker=lld
880 - else
881 - mozconfig_add_options_ac "linker is set to bfd" --enable-linker=bfd
882 - fi
883 - fi
884 -
885 - # LTO flag was handled via configure
886 - filter-flags '-flto*'
887 -
888 - mozconfig_use_enable debug
889 - if use debug ; then
890 - mozconfig_add_options_ac '+debug' --disable-optimize
891 - else
892 - if is-flag '-g*' ; then
893 - if use clang ; then
894 - mozconfig_add_options_ac 'from CFLAGS' --enable-debug-symbols=$(get-flag '-g*')
895 - else
896 - mozconfig_add_options_ac 'from CFLAGS' --enable-debug-symbols
897 - fi
898 - else
899 - mozconfig_add_options_ac 'Gentoo default' --disable-debug-symbols
900 - fi
901 -
902 - if is-flag '-O0' ; then
903 - mozconfig_add_options_ac "from CFLAGS" --enable-optimize=-O0
904 - elif is-flag '-O4' ; then
905 - mozconfig_add_options_ac "from CFLAGS" --enable-optimize=-O4
906 - elif is-flag '-O3' ; then
907 - mozconfig_add_options_ac "from CFLAGS" --enable-optimize=-O3
908 - elif is-flag '-O1' ; then
909 - mozconfig_add_options_ac "from CFLAGS" --enable-optimize=-O1
910 - elif is-flag '-Os' ; then
911 - mozconfig_add_options_ac "from CFLAGS" --enable-optimize=-Os
912 - else
913 - mozconfig_add_options_ac "Gentoo default" --enable-optimize=-O2
914 - fi
915 - fi
916 -
917 - # Debug flag was handled via configure
918 - filter-flags '-g*'
919 -
920 - # Optimization flag was handled via configure
921 - filter-flags '-O*'
922 -
923 - # Modifications to better support ARM, bug #553364
924 - if use cpu_flags_arm_neon ; then
925 - mozconfig_add_options_ac '+cpu_flags_arm_neon' --with-fpu=neon
926 -
927 - if ! tc-is-clang ; then
928 - # thumb options aren't supported when using clang, bug 666966
929 - mozconfig_add_options_ac '+cpu_flags_arm_neon' \
930 - --with-thumb=yes \
931 - --with-thumb-interwork=no
932 - fi
933 - fi
934 -
935 - if [[ ${CHOST} == armv*h* ]] ; then
936 - mozconfig_add_options_ac 'CHOST=armv*h*' --with-float-abi=hard
937 -
938 - if ! use system-libvpx ; then
939 - sed -i \
940 - -e "s|softfp|hard|" \
941 - "${S}"/media/libvpx/moz.build \
942 - || die
943 - fi
944 - fi
945 -
946 - if use clang ; then
947 - # https://bugzilla.mozilla.org/show_bug.cgi?id=1482204
948 - # https://bugzilla.mozilla.org/show_bug.cgi?id=1483822
949 - # toolkit/moz.configure Elfhack section: target.cpu in ('arm', 'x86', 'x86_64')
950 - local disable_elf_hack=
951 - if use amd64 ; then
952 - disable_elf_hack=yes
953 - elif use x86 ; then
954 - disable_elf_hack=yes
955 - elif use arm ; then
956 - disable_elf_hack=yes
957 - fi
958 -
959 - if [[ -n ${disable_elf_hack} ]] ; then
960 - mozconfig_add_options_ac 'elf-hack is broken when using Clang' --disable-elf-hack
961 - fi
962 - elif tc-is-gcc ; then
963 - if ver_test $(gcc-fullversion) -ge 10 ; then
964 - einfo "Forcing -fno-tree-loop-vectorize to workaround GCC bug, see bug 758446 ..."
965 - append-cxxflags -fno-tree-loop-vectorize
966 - fi
967 - fi
968 -
969 - # Additional ARCH support
970 - case "${ARCH}" in
971 - arm)
972 - # Reduce the memory requirements for linking
973 - if use clang ; then
974 - # Nothing to do
975 - :;
976 - elif use lto ; then
977 - append-ldflags -Wl,--no-keep-memory
978 - else
979 - append-ldflags -Wl,--no-keep-memory -Wl,--reduce-memory-overheads
980 - fi
981 - ;;
982 - esac
983 -
984 - if ! use elibc_glibc ; then
985 - mozconfig_add_options_ac '!elibc_glibc' --disable-jemalloc
986 - fi
987 -
988 - # Allow elfhack to work in combination with unstripped binaries
989 - # when they would normally be larger than 2GiB.
990 - append-ldflags "-Wl,--compress-debug-sections=zlib"
991 -
992 - # Make revdep-rebuild.sh happy; Also required for musl
993 - append-ldflags -Wl,-rpath="${MOZILLA_FIVE_HOME}",--enable-new-dtags
994 -
995 - # Pass $MAKEOPTS to build system
996 - export MOZ_MAKE_FLAGS="${MAKEOPTS}"
997 -
998 - # Use system's Python environment
999 - PIP_NETWORK_INSTALL_RESTRICTED_VIRTUALENVS=mach
1000 -
1001 - if use system-python-libs; then
1002 - export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE="system"
1003 - else
1004 - export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE="none"
1005 - fi
1006 -
1007 - # Disable notification when build system has finished
1008 - export MOZ_NOSPAM=1
1009 -
1010 - # Portage sets XARGS environment variable to "xargs -r" by default which
1011 - # breaks build system's check_prog() function which doesn't support arguments
1012 - mozconfig_add_options_ac 'Gentoo default' "XARGS=${EPREFIX}/usr/bin/xargs"
1013 -
1014 - # Set build dir
1015 - mozconfig_add_options_mk 'Gentoo default' "MOZ_OBJDIR=${BUILD_DIR}"
1016 -
1017 - # Show flags we will use
1018 - einfo "Build BINDGEN_CFLAGS:\t${BINDGEN_CFLAGS:-no value set}"
1019 - einfo "Build CFLAGS:\t\t${CFLAGS:-no value set}"
1020 - einfo "Build CXXFLAGS:\t\t${CXXFLAGS:-no value set}"
1021 - einfo "Build LDFLAGS:\t\t${LDFLAGS:-no value set}"
1022 - einfo "Build RUSTFLAGS:\t\t${RUSTFLAGS:-no value set}"
1023 -
1024 - # Handle EXTRA_CONF and show summary
1025 - local ac opt hash reason
1026 -
1027 - # Apply EXTRA_ECONF entries to $MOZCONFIG
1028 - if [[ -n ${EXTRA_ECONF} ]] ; then
1029 - IFS=\! read -a ac <<<${EXTRA_ECONF// --/\!}
1030 - for opt in "${ac[@]}"; do
1031 - mozconfig_add_options_ac "EXTRA_ECONF" --${opt#--}
1032 - done
1033 - fi
1034 -
1035 - echo
1036 - echo "=========================================================="
1037 - echo "Building ${PF} with the following configuration"
1038 - grep ^ac_add_options "${MOZCONFIG}" | while read ac opt hash reason; do
1039 - [[ -z ${hash} || ${hash} == \# ]] \
1040 - || die "error reading mozconfig: ${ac} ${opt} ${hash} ${reason}"
1041 - printf " %-30s %s\n" "${opt}" "${reason:-mozilla.org default}"
1042 - done
1043 - echo "=========================================================="
1044 - echo
1045 -
1046 - ./mach configure || die
1047 -}
1048 -
1049 -src_compile() {
1050 - local virtx_cmd=
1051 -
1052 - if use pgo ; then
1053 - virtx_cmd=virtx
1054 -
1055 - # Reset and cleanup environment variables used by GNOME/XDG
1056 - gnome2_environment_reset
1057 -
1058 - addpredict /root
1059 - fi
1060 -
1061 - if ! use X && use wayland; then
1062 - local -x GDK_BACKEND=wayland
1063 - else
1064 - local -x GDK_BACKEND=x11
1065 - fi
1066 -
1067 - ${virtx_cmd} ./mach build --verbose \
1068 - || die
1069 -}
1070 -
1071 -src_install() {
1072 - # xpcshell is getting called during install
1073 - pax-mark m \
1074 - "${BUILD_DIR}"/dist/bin/xpcshell \
1075 - "${BUILD_DIR}"/dist/bin/${PN} \
1076 - "${BUILD_DIR}"/dist/bin/plugin-container
1077 -
1078 - DESTDIR="${D}" ./mach install || die
1079 -
1080 - # Upstream cannot ship symlink but we can (bmo#658850)
1081 - rm "${ED}${MOZILLA_FIVE_HOME}/${PN}-bin" || die
1082 - dosym ${PN} ${MOZILLA_FIVE_HOME}/${PN}-bin
1083 -
1084 - # Don't install llvm-symbolizer from sys-devel/llvm package
1085 - if [[ -f "${ED}${MOZILLA_FIVE_HOME}/llvm-symbolizer" ]] ; then
1086 - rm -v "${ED}${MOZILLA_FIVE_HOME}/llvm-symbolizer" || die
1087 - fi
1088 -
1089 - # Install policy (currently only used to disable application updates)
1090 - insinto "${MOZILLA_FIVE_HOME}/distribution"
1091 - newins "${FILESDIR}"/distribution.ini distribution.ini
1092 - newins "${FILESDIR}"/disable-auto-update.policy.json policies.json
1093 -
1094 - # Install system-wide preferences
1095 - local PREFS_DIR="${MOZILLA_FIVE_HOME}/browser/defaults/preferences"
1096 - insinto "${PREFS_DIR}"
1097 - newins "${FILESDIR}"/gentoo-default-prefs.js gentoo-prefs.js
1098 -
1099 - local GENTOO_PREFS="${ED}${PREFS_DIR}/gentoo-prefs.js"
1100 -
1101 - # Set dictionary path to use system hunspell
1102 - cat >>"${GENTOO_PREFS}" <<-EOF || die "failed to set spellchecker.dictionary_path pref"
1103 - pref("spellchecker.dictionary_path", "${EPREFIX}/usr/share/myspell");
1104 - EOF
1105 -
1106 - # Force hwaccel prefs if USE=hwaccel is enabled
1107 - if use hwaccel ; then
1108 - cat "${FILESDIR}"/gentoo-hwaccel-prefs.js-r2 \
1109 - >>"${GENTOO_PREFS}" \
1110 - || die "failed to add prefs to force hardware-accelerated rendering to all-gentoo.js"
1111 -
1112 - if use wayland; then
1113 - cat >>"${GENTOO_PREFS}" <<-EOF || die "failed to set hwaccel wayland prefs"
1114 - pref("gfx.x11-egl.force-enabled", false);
1115 - EOF
1116 - else
1117 - cat >>"${GENTOO_PREFS}" <<-EOF || die "failed to set hwaccel x11 prefs"
1118 - pref("gfx.x11-egl.force-enabled", true);
1119 - EOF
1120 - fi
1121 - fi
1122 -
1123 - if ! use gmp-autoupdate ; then
1124 - local plugin
1125 - for plugin in "${MOZ_GMP_PLUGIN_LIST[@]}" ; do
1126 - einfo "Disabling auto-update for ${plugin} plugin ..."
1127 - cat >>"${GENTOO_PREFS}" <<-EOF || die "failed to disable autoupdate for ${plugin} media plugin"
1128 - pref("media.${plugin}.autoupdate", false);
1129 - EOF
1130 - done
1131 - fi
1132 -
1133 - # Force the graphite pref if USE=system-harfbuzz is enabled, since the pref cannot disable it
1134 - if use system-harfbuzz ; then
1135 - cat >>"${GENTOO_PREFS}" <<-EOF || die "failed to set gfx.font_rendering.graphite.enabled pref"
1136 - sticky_pref("gfx.font_rendering.graphite.enabled", true);
1137 - EOF
1138 - fi
1139 -
1140 - # Install language packs
1141 - local langpacks=( $(find "${WORKDIR}/language_packs" -type f -name '*.xpi') )
1142 - if [[ -n "${langpacks}" ]] ; then
1143 - moz_install_xpi "${MOZILLA_FIVE_HOME}/distribution/extensions" "${langpacks[@]}"
1144 - fi
1145 -
1146 - # Install geckodriver
1147 - if use geckodriver ; then
1148 - einfo "Installing geckodriver into ${ED}${MOZILLA_FIVE_HOME} ..."
1149 - pax-mark m "${BUILD_DIR}"/dist/bin/geckodriver
1150 - exeinto "${MOZILLA_FIVE_HOME}"
1151 - doexe "${BUILD_DIR}"/dist/bin/geckodriver
1152 -
1153 - dosym ${MOZILLA_FIVE_HOME}/geckodriver /usr/bin/geckodriver
1154 - fi
1155 -
1156 - # Install icons
1157 - local icon_srcdir="${S}/browser/branding/official"
1158 - local icon_symbolic_file="${FILESDIR}/icon/firefox-symbolic.svg"
1159 -
1160 - insinto /usr/share/icons/hicolor/symbolic/apps
1161 - newins "${icon_symbolic_file}" ${PN}-symbolic.svg
1162 -
1163 - local icon size
1164 - for icon in "${icon_srcdir}"/default*.png ; do
1165 - size=${icon%.png}
1166 - size=${size##*/default}
1167 -
1168 - if [[ ${size} -eq 48 ]] ; then
1169 - newicon "${icon}" ${PN}.png
1170 - fi
1171 -
1172 - newicon -s ${size} "${icon}" ${PN}.png
1173 - done
1174 -
1175 - # Install menu
1176 - local app_name="Mozilla ${MOZ_PN^}"
1177 - local desktop_file="${FILESDIR}/icon/${PN}-r3.desktop"
1178 - local desktop_filename="${PN}.desktop"
1179 - local exec_command="${PN}"
1180 - local icon="${PN}"
1181 - local use_wayland="false"
1182 -
1183 - if use wayland ; then
1184 - use_wayland="true"
1185 - fi
1186 -
1187 - cp "${desktop_file}" "${WORKDIR}/${PN}.desktop-template" || die
1188 -
1189 - sed -i \
1190 - -e "s:@NAME@:${app_name}:" \
1191 - -e "s:@EXEC@:${exec_command}:" \
1192 - -e "s:@ICON@:${icon}:" \
1193 - "${WORKDIR}/${PN}.desktop-template" \
1194 - || die
1195 -
1196 - newmenu "${WORKDIR}/${PN}.desktop-template" "${desktop_filename}"
1197 -
1198 - rm "${WORKDIR}/${PN}.desktop-template" || die
1199 -
1200 - # Install wrapper script
1201 - [[ -f "${ED}/usr/bin/${PN}" ]] && rm "${ED}/usr/bin/${PN}"
1202 - newbin "${FILESDIR}/${PN}-r1.sh" ${PN}
1203 -
1204 - # Update wrapper
1205 - sed -i \
1206 - -e "s:@PREFIX@:${EPREFIX}/usr:" \
1207 - -e "s:@MOZ_FIVE_HOME@:${MOZILLA_FIVE_HOME}:" \
1208 - -e "s:@APULSELIB_DIR@:${apulselib}:" \
1209 - -e "s:@DEFAULT_WAYLAND@:${use_wayland}:" \
1210 - "${ED}/usr/bin/${PN}" \
1211 - || die
1212 -}
1213 -
1214 -pkg_preinst() {
1215 - xdg_pkg_preinst
1216 -
1217 - # If the apulse libs are available in MOZILLA_FIVE_HOME then apulse
1218 - # does not need to be forced into the LD_LIBRARY_PATH
1219 - if use pulseaudio && has_version ">=media-sound/apulse-0.1.12-r4" ; then
1220 - einfo "APULSE found; Generating library symlinks for sound support ..."
1221 - local lib
1222 - pushd "${ED}${MOZILLA_FIVE_HOME}" &>/dev/null || die
1223 - for lib in ../apulse/libpulse{.so{,.0},-simple.so{,.0}} ; do
1224 - # A quickpkg rolled by hand will grab symlinks as part of the package,
1225 - # so we need to avoid creating them if they already exist.
1226 - if [[ ! -L ${lib##*/} ]] ; then
1227 - ln -s "${lib}" ${lib##*/} || die
1228 - fi
1229 - done
1230 - popd &>/dev/null || die
1231 - fi
1232 -}
1233 -
1234 -pkg_postinst() {
1235 - xdg_pkg_postinst
1236 -
1237 - if ! use gmp-autoupdate ; then
1238 - elog "USE='-gmp-autoupdate' has disabled the following plugins from updating or"
1239 - elog "installing into new profiles:"
1240 - local plugin
1241 - for plugin in "${MOZ_GMP_PLUGIN_LIST[@]}" ; do
1242 - elog "\t ${plugin}"
1243 - done
1244 - elog
1245 - fi
1246 -
1247 - if use pulseaudio && has_version ">=media-sound/apulse-0.1.12-r4" ; then
1248 - elog "Apulse was detected at merge time on this system and so it will always be"
1249 - elog "used for sound. If you wish to use pulseaudio instead please unmerge"
1250 - elog "media-sound/apulse."
1251 - elog
1252 - fi
1253 -
1254 - local show_doh_information
1255 - local show_normandy_information
1256 - local show_shortcut_information
1257 -
1258 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
1259 - # New install; Tell user that DoH is disabled by default
1260 - show_doh_information=yes
1261 - show_normandy_information=yes
1262 - show_shortcut_information=no
1263 - else
1264 - local replacing_version
1265 - for replacing_version in ${REPLACING_VERSIONS} ; do
1266 - if ver_test "${replacing_version}" -lt 91.0 ; then
1267 - # Tell user that we no longer install a shortcut
1268 - # per supported display protocol
1269 - show_shortcut_information=yes
1270 - fi
1271 - done
1272 - fi
1273 -
1274 - if [[ -n "${show_doh_information}" ]] ; then
1275 - elog
1276 - elog "Note regarding Trusted Recursive Resolver aka DNS-over-HTTPS (DoH):"
1277 - elog "Due to privacy concerns (encrypting DNS might be a good thing, sending all"
1278 - elog "DNS traffic to Cloudflare by default is not a good idea and applications"
1279 - elog "should respect OS configured settings), \"network.trr.mode\" was set to 5"
1280 - elog "(\"Off by choice\") by default."
1281 - elog "You can enable DNS-over-HTTPS in ${PN^}'s preferences."
1282 - fi
1283 -
1284 - # bug 713782
1285 - if [[ -n "${show_normandy_information}" ]] ; then
1286 - elog
1287 - elog "Upstream operates a service named Normandy which allows Mozilla to"
1288 - elog "push changes for default settings or even install new add-ons remotely."
1289 - elog "While this can be useful to address problems like 'Armagadd-on 2.0' or"
1290 - elog "revert previous decisions to disable TLS 1.0/1.1, privacy and security"
1291 - elog "concerns prevail, which is why we have switched off the use of this"
1292 - elog "service by default."
1293 - elog
1294 - elog "To re-enable this service set"
1295 - elog
1296 - elog " app.normandy.enabled=true"
1297 - elog
1298 - elog "in about:config."
1299 - fi
1300 -
1301 - if [[ -n "${show_shortcut_information}" ]] ; then
1302 - elog
1303 - elog "Since ${PN}-91.0 we no longer install multiple shortcuts for"
1304 - elog "each supported display protocol. Instead we will only install"
1305 - elog "one generic Mozilla ${PN^} shortcut."
1306 - elog "If you still want to be able to select between running Mozilla ${PN^}"
1307 - elog "on X11 or Wayland, you have to re-create these shortcuts on your own."
1308 - fi
1309 -
1310 - # bug 835078
1311 - if use hwaccel && has_version "x11-drivers/xf86-video-nouveau"; then
1312 - ewarn "You have nouveau drivers installed in your system and 'hwaccel' "
1313 - ewarn "enabled for Firefox. Nouveau / your GPU might not supported the "
1314 - ewarn "required EGL, so either disable 'hwaccel' or try the workaround "
1315 - ewarn "explained in https://bugs.gentoo.org/835078#c5 if Firefox crashes."
1316 - fi
1317 -
1318 - elog
1319 - elog "Unfortunately Firefox-100.0 breaks compatibility with some sites using "
1320 - elog "useragent checks. To temporarily fix this, enter about:config and modify "
1321 - elog "network.http.useragent.forceVersion preference to \"99\"."
1322 - elog "Or install an addon to change your useragent."
1323 - elog "See: https://support.mozilla.org/en-US/kb/difficulties-opening-or-using-website-firefox-100"
1324 - elog
1325 -}
1326
1327 diff --git a/www-client/firefox/firefox-101.0.1.ebuild b/www-client/firefox/firefox-101.0.1.ebuild
1328 deleted file mode 100644
1329 index e4e4ad10cb39..000000000000
1330 --- a/www-client/firefox/firefox-101.0.1.ebuild
1331 +++ /dev/null
1332 @@ -1,1276 +0,0 @@
1333 -# Copyright 1999-2022 Gentoo Authors
1334 -# Distributed under the terms of the GNU General Public License v2
1335 -
1336 -EAPI="8"
1337 -
1338 -FIREFOX_PATCHSET="firefox-101-patches-05j.tar.xz"
1339 -
1340 -LLVM_MAX_SLOT=14
1341 -
1342 -PYTHON_COMPAT=( python3_{8..10} )
1343 -PYTHON_REQ_USE="ncurses,sqlite,ssl"
1344 -
1345 -WANT_AUTOCONF="2.1"
1346 -
1347 -VIRTUALX_REQUIRED="pgo"
1348 -
1349 -MOZ_ESR=
1350 -
1351 -MOZ_PV=${PV}
1352 -MOZ_PV_SUFFIX=
1353 -if [[ ${PV} =~ (_(alpha|beta|rc).*)$ ]] ; then
1354 - MOZ_PV_SUFFIX=${BASH_REMATCH[1]}
1355 -
1356 - # Convert the ebuild version to the upstream Mozilla version
1357 - MOZ_PV="${MOZ_PV/_alpha/a}" # Handle alpha for SRC_URI
1358 - MOZ_PV="${MOZ_PV/_beta/b}" # Handle beta for SRC_URI
1359 - MOZ_PV="${MOZ_PV%%_rc*}" # Handle rc for SRC_URI
1360 -fi
1361 -
1362 -if [[ -n ${MOZ_ESR} ]] ; then
1363 - # ESR releases have slightly different version numbers
1364 - MOZ_PV="${MOZ_PV}esr"
1365 -fi
1366 -
1367 -MOZ_PN="${PN%-bin}"
1368 -MOZ_P="${MOZ_PN}-${MOZ_PV}"
1369 -MOZ_PV_DISTFILES="${MOZ_PV}${MOZ_PV_SUFFIX}"
1370 -MOZ_P_DISTFILES="${MOZ_PN}-${MOZ_PV_DISTFILES}"
1371 -
1372 -inherit autotools check-reqs desktop flag-o-matic gnome2-utils linux-info \
1373 - llvm multiprocessing pax-utils python-any-r1 toolchain-funcs \
1374 - virtualx xdg
1375 -
1376 -MOZ_SRC_BASE_URI="https://archive.mozilla.org/pub/${MOZ_PN}/releases/${MOZ_PV}"
1377 -
1378 -if [[ ${PV} == *_rc* ]] ; then
1379 - MOZ_SRC_BASE_URI="https://archive.mozilla.org/pub/${MOZ_PN}/candidates/${MOZ_PV}-candidates/build${PV##*_rc}"
1380 -fi
1381 -
1382 -PATCH_URIS=(
1383 - https://dev.gentoo.org/~{juippis,polynomial-c,whissi,slashbeast}/mozilla/patchsets/${FIREFOX_PATCHSET}
1384 -)
1385 -
1386 -SRC_URI="${MOZ_SRC_BASE_URI}/source/${MOZ_P}.source.tar.xz -> ${MOZ_P_DISTFILES}.source.tar.xz
1387 - ${PATCH_URIS[@]}"
1388 -
1389 -DESCRIPTION="Firefox Web Browser"
1390 -HOMEPAGE="https://www.mozilla.com/firefox"
1391 -
1392 -KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
1393 -
1394 -SLOT="rapid"
1395 -LICENSE="MPL-2.0 GPL-2 LGPL-2.1"
1396 -
1397 -IUSE="+clang cpu_flags_arm_neon dbus debug eme-free hardened hwaccel"
1398 -IUSE+=" jack libproxy lto +openh264 pgo pulseaudio sndio selinux"
1399 -IUSE+=" +system-av1 +system-harfbuzz +system-icu +system-jpeg +system-libevent +system-libvpx system-png system-python-libs +system-webp"
1400 -IUSE+=" wayland wifi"
1401 -
1402 -# Firefox-only IUSE
1403 -IUSE+=" geckodriver +gmp-autoupdate screencast"
1404 -
1405 -REQUIRED_USE="debug? ( !system-av1 )
1406 - pgo? ( lto )
1407 - wayland? ( dbus )
1408 - wifi? ( dbus )"
1409 -
1410 -# Firefox-only REQUIRED_USE flags
1411 -REQUIRED_USE+=" screencast? ( wayland )"
1412 -
1413 -BDEPEND="${PYTHON_DEPS}
1414 - app-arch/unzip
1415 - app-arch/zip
1416 - >=dev-util/cbindgen-0.24.0
1417 - >=net-libs/nodejs-10.23.1
1418 - virtual/pkgconfig
1419 - >=virtual/rust-1.59.0
1420 - || (
1421 - (
1422 - sys-devel/clang:14
1423 - sys-devel/llvm:14
1424 - clang? (
1425 - =sys-devel/lld-14*
1426 - pgo? ( =sys-libs/compiler-rt-sanitizers-14*[profile] )
1427 - )
1428 - )
1429 - (
1430 - sys-devel/clang:13
1431 - sys-devel/llvm:13
1432 - clang? (
1433 - =sys-devel/lld-13*
1434 - pgo? ( =sys-libs/compiler-rt-sanitizers-13*[profile] )
1435 - )
1436 - )
1437 - (
1438 - sys-devel/clang:12
1439 - sys-devel/llvm:12
1440 - clang? (
1441 - =sys-devel/lld-12*
1442 - pgo? ( =sys-libs/compiler-rt-sanitizers-12*[profile] )
1443 - )
1444 - )
1445 - )
1446 - amd64? ( >=dev-lang/nasm-2.14 )
1447 - x86? ( >=dev-lang/nasm-2.14 )"
1448 -
1449 -COMMON_DEPEND="
1450 - dev-libs/atk
1451 - dev-libs/expat
1452 - dev-libs/glib:2
1453 - dev-libs/libffi:=
1454 - >=dev-libs/nss-3.78
1455 - >=dev-libs/nspr-4.32
1456 - media-libs/alsa-lib
1457 - media-libs/fontconfig
1458 - media-libs/freetype
1459 - media-libs/mesa
1460 - media-video/ffmpeg
1461 - sys-libs/zlib
1462 - virtual/freedesktop-icon-theme
1463 - x11-libs/cairo[X]
1464 - x11-libs/gdk-pixbuf
1465 - x11-libs/gtk+:3[X]
1466 - x11-libs/libX11
1467 - x11-libs/libXcomposite
1468 - x11-libs/libXdamage
1469 - x11-libs/libXext
1470 - x11-libs/libXfixes
1471 - x11-libs/libXrandr
1472 - x11-libs/libXrender
1473 - x11-libs/libXtst
1474 - x11-libs/libxcb:=
1475 - x11-libs/pango
1476 - x11-libs/pixman
1477 - dbus? (
1478 - dev-libs/dbus-glib
1479 - sys-apps/dbus
1480 - )
1481 - jack? ( virtual/jack )
1482 - libproxy? ( net-libs/libproxy )
1483 - screencast? ( media-video/pipewire:= )
1484 - selinux? ( sec-policy/selinux-mozilla )
1485 - sndio? ( >=media-sound/sndio-1.8.0-r1 )
1486 - system-av1? (
1487 - >=media-libs/dav1d-0.9.3:=
1488 - >=media-libs/libaom-1.0.0:=
1489 - )
1490 - system-harfbuzz? (
1491 - >=media-gfx/graphite2-1.3.13
1492 - >=media-libs/harfbuzz-2.8.1:0=
1493 - )
1494 - system-icu? ( >=dev-libs/icu-71.1:= )
1495 - system-jpeg? ( >=media-libs/libjpeg-turbo-1.2.1 )
1496 - system-libevent? ( >=dev-libs/libevent-2.0:0=[threads] )
1497 - system-libvpx? ( >=media-libs/libvpx-1.8.2:0=[postproc] )
1498 - system-png? ( >=media-libs/libpng-1.6.35:0=[apng] )
1499 - system-webp? ( >=media-libs/libwebp-1.1.0:0= )
1500 - wifi? (
1501 - kernel_linux? (
1502 - dev-libs/dbus-glib
1503 - net-misc/networkmanager
1504 - sys-apps/dbus
1505 - )
1506 - )"
1507 -
1508 -RDEPEND="${COMMON_DEPEND}
1509 - !www-client/firefox:0
1510 - !www-client/firefox:esr
1511 - jack? ( virtual/jack )
1512 - openh264? ( media-libs/openh264:*[plugin] )
1513 - pulseaudio? (
1514 - || (
1515 - media-sound/pulseaudio
1516 - >=media-sound/apulse-0.1.12-r4
1517 - )
1518 - )
1519 - selinux? ( sec-policy/selinux-mozilla )"
1520 -
1521 -DEPEND="${COMMON_DEPEND}
1522 - x11-libs/libICE
1523 - x11-libs/libSM
1524 - pulseaudio? (
1525 - || (
1526 - media-sound/pulseaudio
1527 - >=media-sound/apulse-0.1.12-r4[sdk]
1528 - )
1529 - )
1530 - wayland? ( >=x11-libs/gtk+-3.11:3[wayland] )
1531 - amd64? ( virtual/opengl )
1532 - x86? ( virtual/opengl )"
1533 -
1534 -S="${WORKDIR}/${PN}-${PV%_*}"
1535 -
1536 -# Allow MOZ_GMP_PLUGIN_LIST to be set in an eclass or
1537 -# overridden in the enviromnent (advanced hackers only)
1538 -if [[ -z "${MOZ_GMP_PLUGIN_LIST+set}" ]] ; then
1539 - MOZ_GMP_PLUGIN_LIST=( gmp-gmpopenh264 gmp-widevinecdm )
1540 -fi
1541 -
1542 -llvm_check_deps() {
1543 - if ! has_version -b "sys-devel/clang:${LLVM_SLOT}" ; then
1544 - einfo "sys-devel/clang:${LLVM_SLOT} is missing! Cannot use LLVM slot ${LLVM_SLOT} ..." >&2
1545 - return 1
1546 - fi
1547 -
1548 - if use clang ; then
1549 - if ! has_version -b "=sys-devel/lld-${LLVM_SLOT}*" ; then
1550 - einfo "=sys-devel/lld-${LLVM_SLOT}* is missing! Cannot use LLVM slot ${LLVM_SLOT} ..." >&2
1551 - return 1
1552 - fi
1553 -
1554 - if use pgo ; then
1555 - if ! has_version -b "=sys-libs/compiler-rt-sanitizers-${LLVM_SLOT}*" ; then
1556 - einfo "=sys-libs/compiler-rt-sanitizers-${LLVM_SLOT}* is missing! Cannot use LLVM slot ${LLVM_SLOT} ..." >&2
1557 - return 1
1558 - fi
1559 - fi
1560 - fi
1561 -
1562 - einfo "Using LLVM slot ${LLVM_SLOT} to build" >&2
1563 -}
1564 -
1565 -MOZ_LANGS=(
1566 - af ar ast be bg br ca cak cs cy da de dsb
1567 - el en-CA en-GB en-US es-AR es-ES et eu
1568 - fi fr fy-NL ga-IE gd gl he hr hsb hu
1569 - id is it ja ka kab kk ko lt lv ms nb-NO nl nn-NO
1570 - pa-IN pl pt-BR pt-PT rm ro ru
1571 - sk sl sq sr sv-SE th tr uk uz vi zh-CN zh-TW
1572 -)
1573 -
1574 -# Firefox-only LANGS
1575 -MOZ_LANGS+=( ach )
1576 -MOZ_LANGS+=( an )
1577 -MOZ_LANGS+=( az )
1578 -MOZ_LANGS+=( bn )
1579 -MOZ_LANGS+=( bs )
1580 -MOZ_LANGS+=( ca-valencia )
1581 -MOZ_LANGS+=( eo )
1582 -MOZ_LANGS+=( es-CL )
1583 -MOZ_LANGS+=( es-MX )
1584 -MOZ_LANGS+=( fa )
1585 -MOZ_LANGS+=( ff )
1586 -MOZ_LANGS+=( gn )
1587 -MOZ_LANGS+=( gu-IN )
1588 -MOZ_LANGS+=( hi-IN )
1589 -MOZ_LANGS+=( hy-AM )
1590 -MOZ_LANGS+=( ia )
1591 -MOZ_LANGS+=( km )
1592 -MOZ_LANGS+=( kn )
1593 -MOZ_LANGS+=( lij )
1594 -MOZ_LANGS+=( mk )
1595 -MOZ_LANGS+=( mr )
1596 -MOZ_LANGS+=( my )
1597 -MOZ_LANGS+=( ne-NP )
1598 -MOZ_LANGS+=( oc )
1599 -MOZ_LANGS+=( sco )
1600 -MOZ_LANGS+=( si )
1601 -MOZ_LANGS+=( son )
1602 -MOZ_LANGS+=( szl )
1603 -MOZ_LANGS+=( ta )
1604 -MOZ_LANGS+=( te )
1605 -MOZ_LANGS+=( tl )
1606 -MOZ_LANGS+=( trs )
1607 -MOZ_LANGS+=( ur )
1608 -MOZ_LANGS+=( xh )
1609 -
1610 -mozilla_set_globals() {
1611 - # https://bugs.gentoo.org/587334
1612 - local MOZ_TOO_REGIONALIZED_FOR_L10N=(
1613 - fy-NL ga-IE gu-IN hi-IN hy-AM nb-NO ne-NP nn-NO pa-IN sv-SE
1614 - )
1615 -
1616 - local lang xflag
1617 - for lang in "${MOZ_LANGS[@]}" ; do
1618 - # en and en_US are handled internally
1619 - if [[ ${lang} == en ]] || [[ ${lang} == en-US ]] ; then
1620 - continue
1621 - fi
1622 -
1623 - # strip region subtag if $lang is in the list
1624 - if has ${lang} "${MOZ_TOO_REGIONALIZED_FOR_L10N[@]}" ; then
1625 - xflag=${lang%%-*}
1626 - else
1627 - xflag=${lang}
1628 - fi
1629 -
1630 - SRC_URI+=" l10n_${xflag/[_@]/-}? ("
1631 - SRC_URI+=" ${MOZ_SRC_BASE_URI}/linux-x86_64/xpi/${lang}.xpi -> ${MOZ_P_DISTFILES}-${lang}.xpi"
1632 - SRC_URI+=" )"
1633 - IUSE+=" l10n_${xflag/[_@]/-}"
1634 - done
1635 -}
1636 -mozilla_set_globals
1637 -
1638 -moz_clear_vendor_checksums() {
1639 - debug-print-function ${FUNCNAME} "$@"
1640 -
1641 - if [[ ${#} -ne 1 ]] ; then
1642 - die "${FUNCNAME} requires exact one argument"
1643 - fi
1644 -
1645 - einfo "Clearing cargo checksums for ${1} ..."
1646 -
1647 - sed -i \
1648 - -e 's/\("files":{\)[^}]*/\1/' \
1649 - "${S}"/third_party/rust/${1}/.cargo-checksum.json \
1650 - || die
1651 -}
1652 -
1653 -moz_install_xpi() {
1654 - debug-print-function ${FUNCNAME} "$@"
1655 -
1656 - if [[ ${#} -lt 2 ]] ; then
1657 - die "${FUNCNAME} requires at least two arguments"
1658 - fi
1659 -
1660 - local DESTDIR=${1}
1661 - shift
1662 -
1663 - insinto "${DESTDIR}"
1664 -
1665 - local emid xpi_file xpi_tmp_dir
1666 - for xpi_file in "${@}" ; do
1667 - emid=
1668 - xpi_tmp_dir=$(mktemp -d --tmpdir="${T}")
1669 -
1670 - # Unpack XPI
1671 - unzip -qq "${xpi_file}" -d "${xpi_tmp_dir}" || die
1672 -
1673 - # Determine extension ID
1674 - if [[ -f "${xpi_tmp_dir}/install.rdf" ]] ; then
1675 - emid=$(sed -n -e '/install-manifest/,$ { /em:id/!d; s/.*[\">]\([^\"<>]*\)[\"<].*/\1/; p; q }' "${xpi_tmp_dir}/install.rdf")
1676 - [[ -z "${emid}" ]] && die "failed to determine extension id from install.rdf"
1677 - elif [[ -f "${xpi_tmp_dir}/manifest.json" ]] ; then
1678 - emid=$(sed -n -e 's/.*"id": "\([^"]*\)".*/\1/p' "${xpi_tmp_dir}/manifest.json")
1679 - [[ -z "${emid}" ]] && die "failed to determine extension id from manifest.json"
1680 - else
1681 - die "failed to determine extension id"
1682 - fi
1683 -
1684 - einfo "Installing ${emid}.xpi into ${ED}${DESTDIR} ..."
1685 - newins "${xpi_file}" "${emid}.xpi"
1686 - done
1687 -}
1688 -
1689 -mozconfig_add_options_ac() {
1690 - debug-print-function ${FUNCNAME} "$@"
1691 -
1692 - if [[ ${#} -lt 2 ]] ; then
1693 - die "${FUNCNAME} requires at least two arguments"
1694 - fi
1695 -
1696 - local reason=${1}
1697 - shift
1698 -
1699 - local option
1700 - for option in ${@} ; do
1701 - echo "ac_add_options ${option} # ${reason}" >>${MOZCONFIG}
1702 - done
1703 -}
1704 -
1705 -mozconfig_add_options_mk() {
1706 - debug-print-function ${FUNCNAME} "$@"
1707 -
1708 - if [[ ${#} -lt 2 ]] ; then
1709 - die "${FUNCNAME} requires at least two arguments"
1710 - fi
1711 -
1712 - local reason=${1}
1713 - shift
1714 -
1715 - local option
1716 - for option in ${@} ; do
1717 - echo "mk_add_options ${option} # ${reason}" >>${MOZCONFIG}
1718 - done
1719 -}
1720 -
1721 -mozconfig_use_enable() {
1722 - debug-print-function ${FUNCNAME} "$@"
1723 -
1724 - if [[ ${#} -lt 1 ]] ; then
1725 - die "${FUNCNAME} requires at least one arguments"
1726 - fi
1727 -
1728 - local flag=$(use_enable "${@}")
1729 - mozconfig_add_options_ac "$(use ${1} && echo +${1} || echo -${1})" "${flag}"
1730 -}
1731 -
1732 -mozconfig_use_with() {
1733 - debug-print-function ${FUNCNAME} "$@"
1734 -
1735 - if [[ ${#} -lt 1 ]] ; then
1736 - die "${FUNCNAME} requires at least one arguments"
1737 - fi
1738 -
1739 - local flag=$(use_with "${@}")
1740 - mozconfig_add_options_ac "$(use ${1} && echo +${1} || echo -${1})" "${flag}"
1741 -}
1742 -
1743 -pkg_pretend() {
1744 - if [[ ${MERGE_TYPE} != binary ]] ; then
1745 - if use pgo ; then
1746 - if ! has usersandbox $FEATURES ; then
1747 - die "You must enable usersandbox as X server can not run as root!"
1748 - fi
1749 - fi
1750 -
1751 - # Ensure we have enough disk space to compile
1752 - if use pgo || use lto || use debug ; then
1753 - CHECKREQS_DISK_BUILD="13500M"
1754 - else
1755 - CHECKREQS_DISK_BUILD="6600M"
1756 - fi
1757 -
1758 - check-reqs_pkg_pretend
1759 - fi
1760 -}
1761 -
1762 -pkg_setup() {
1763 - if [[ ${MERGE_TYPE} != binary ]] ; then
1764 - if use pgo ; then
1765 - if ! has userpriv ${FEATURES} ; then
1766 - eerror "Building ${PN} with USE=pgo and FEATURES=-userpriv is not supported!"
1767 - fi
1768 - fi
1769 -
1770 - # Ensure we have enough disk space to compile
1771 - if use pgo || use lto || use debug ; then
1772 - CHECKREQS_DISK_BUILD="13500M"
1773 - else
1774 - CHECKREQS_DISK_BUILD="6400M"
1775 - fi
1776 -
1777 - check-reqs_pkg_setup
1778 -
1779 - llvm_pkg_setup
1780 -
1781 - if use clang && use lto ; then
1782 - local version_lld=$(ld.lld --version 2>/dev/null | awk '{ print $2 }')
1783 - [[ -n ${version_lld} ]] && version_lld=$(ver_cut 1 "${version_lld}")
1784 - [[ -z ${version_lld} ]] && die "Failed to read ld.lld version!"
1785 -
1786 - local version_llvm_rust=$(rustc -Vv 2>/dev/null | grep -F -- 'LLVM version:' | awk '{ print $3 }')
1787 - [[ -n ${version_llvm_rust} ]] && version_llvm_rust=$(ver_cut 1 "${version_llvm_rust}")
1788 - [[ -z ${version_llvm_rust} ]] && die "Failed to read used LLVM version from rustc!"
1789 -
1790 - if ver_test "${version_lld}" -ne "${version_llvm_rust}" ; then
1791 - eerror "Rust is using LLVM version ${version_llvm_rust} but ld.lld version belongs to LLVM version ${version_lld}."
1792 - eerror "You will be unable to link ${CATEGORY}/${PN}. To proceed you have the following options:"
1793 - eerror " - Manually switch rust version using 'eselect rust' to match used LLVM version"
1794 - eerror " - Switch to dev-lang/rust[system-llvm] which will guarantee matching version"
1795 - eerror " - Build ${CATEGORY}/${PN} without USE=lto"
1796 - eerror " - Rebuild lld with llvm that was used to build rust (may need to rebuild the whole "
1797 - eerror " llvm/clang/lld/rust chain depending on your @world updates)"
1798 - die "LLVM version used by Rust (${version_llvm_rust}) does not match with ld.lld version (${version_lld})!"
1799 - fi
1800 - fi
1801 -
1802 - if ! use clang && [[ $(gcc-major-version) -eq 11 ]] \
1803 - && ! has_version -b ">sys-devel/gcc-11.1.0:11" ; then
1804 - # bug 792705
1805 - eerror "Using GCC 11 to compile firefox is currently known to be broken (see bug #792705)."
1806 - die "Set USE=clang or select <gcc-11 to build ${CATEGORY}/${P}."
1807 - fi
1808 -
1809 - python-any-r1_pkg_setup
1810 -
1811 - # Avoid PGO profiling problems due to enviroment leakage
1812 - # These should *always* be cleaned up anyway
1813 - unset \
1814 - DBUS_SESSION_BUS_ADDRESS \
1815 - DISPLAY \
1816 - ORBIT_SOCKETDIR \
1817 - SESSION_MANAGER \
1818 - XAUTHORITY \
1819 - XDG_CACHE_HOME \
1820 - XDG_SESSION_COOKIE
1821 -
1822 - # Build system is using /proc/self/oom_score_adj, bug #604394
1823 - addpredict /proc/self/oom_score_adj
1824 -
1825 - if use pgo ; then
1826 - # Allow access to GPU during PGO run
1827 - local ati_cards mesa_cards nvidia_cards render_cards
1828 - shopt -s nullglob
1829 -
1830 - ati_cards=$(echo -n /dev/ati/card* | sed 's/ /:/g')
1831 - if [[ -n "${ati_cards}" ]] ; then
1832 - addpredict "${ati_cards}"
1833 - fi
1834 -
1835 - mesa_cards=$(echo -n /dev/dri/card* | sed 's/ /:/g')
1836 - if [[ -n "${mesa_cards}" ]] ; then
1837 - addpredict "${mesa_cards}"
1838 - fi
1839 -
1840 - nvidia_cards=$(echo -n /dev/nvidia* | sed 's/ /:/g')
1841 - if [[ -n "${nvidia_cards}" ]] ; then
1842 - addpredict "${nvidia_cards}"
1843 - fi
1844 -
1845 - render_cards=$(echo -n /dev/dri/renderD128* | sed 's/ /:/g')
1846 - if [[ -n "${render_cards}" ]] ; then
1847 - addpredict "${render_cards}"
1848 - fi
1849 -
1850 - shopt -u nullglob
1851 - fi
1852 -
1853 - if ! mountpoint -q /dev/shm ; then
1854 - # If /dev/shm is not available, configure is known to fail with
1855 - # a traceback report referencing /usr/lib/pythonN.N/multiprocessing/synchronize.py
1856 - ewarn "/dev/shm is not mounted -- expect build failures!"
1857 - fi
1858 -
1859 - # Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
1860 - # Note: These are for Gentoo Linux use ONLY. For your own distribution, please
1861 - # get your own set of keys.
1862 - if [[ -z "${MOZ_API_KEY_GOOGLE+set}" ]] ; then
1863 - MOZ_API_KEY_GOOGLE="AIzaSyDEAOvatFogGaPi0eTgsV_ZlEzx0ObmepsMzfAc"
1864 - fi
1865 -
1866 - if [[ -z "${MOZ_API_KEY_LOCATION+set}" ]] ; then
1867 - MOZ_API_KEY_LOCATION="AIzaSyB2h2OuRgGaPicUgy5N-5hsZqiPW6sH3n_rptiQ"
1868 - fi
1869 -
1870 - # Mozilla API keys (see https://location.services.mozilla.com/api)
1871 - # Note: These are for Gentoo Linux use ONLY. For your own distribution, please
1872 - # get your own set of keys.
1873 - if [[ -z "${MOZ_API_KEY_MOZILLA+set}" ]] ; then
1874 - MOZ_API_KEY_MOZILLA="edb3d487-3a84-46m0ap1e3-9dfd-92b5efaaa005"
1875 - fi
1876 -
1877 - # Ensure we use C locale when building, bug #746215
1878 - export LC_ALL=C
1879 - fi
1880 -
1881 - CONFIG_CHECK="~SECCOMP"
1882 - WARNING_SECCOMP="CONFIG_SECCOMP not set! This system will be unable to play DRM-protected content."
1883 - linux-info_pkg_setup
1884 -}
1885 -
1886 -src_unpack() {
1887 - local _lp_dir="${WORKDIR}/language_packs"
1888 - local _src_file
1889 -
1890 - if [[ ! -d "${_lp_dir}" ]] ; then
1891 - mkdir "${_lp_dir}" || die
1892 - fi
1893 -
1894 - for _src_file in ${A} ; do
1895 - if [[ ${_src_file} == *.xpi ]]; then
1896 - cp "${DISTDIR}/${_src_file}" "${_lp_dir}" || die "Failed to copy '${_src_file}' to '${_lp_dir}'!"
1897 - else
1898 - unpack ${_src_file}
1899 - fi
1900 - done
1901 -}
1902 -
1903 -src_prepare() {
1904 - use lto && rm -v "${WORKDIR}"/firefox-patches/*-LTO-Only-enable-LTO-*.patch
1905 - eapply "${WORKDIR}/firefox-patches"
1906 -
1907 - # Allow user to apply any additional patches without modifing ebuild
1908 - eapply_user
1909 -
1910 - # Make cargo respect MAKEOPTS
1911 - export CARGO_BUILD_JOBS="$(makeopts_jobs)"
1912 -
1913 - # Make LTO respect MAKEOPTS
1914 - sed -i \
1915 - -e "s/multiprocessing.cpu_count()/$(makeopts_jobs)/" \
1916 - "${S}"/build/moz.configure/lto-pgo.configure \
1917 - || die "sed failed to set num_cores"
1918 -
1919 - # Make ICU respect MAKEOPTS
1920 - sed -i \
1921 - -e "s/multiprocessing.cpu_count()/$(makeopts_jobs)/" \
1922 - "${S}"/intl/icu_sources_data.py \
1923 - || die "sed failed to set num_cores"
1924 -
1925 - # sed-in toolchain prefix
1926 - sed -i \
1927 - -e "s/objdump/${CHOST}-objdump/" \
1928 - "${S}"/python/mozbuild/mozbuild/configure/check_debug_ranges.py \
1929 - || die "sed failed to set toolchain prefix"
1930 -
1931 - sed -i \
1932 - -e 's/ccache_stats = None/return None/' \
1933 - "${S}"/python/mozbuild/mozbuild/controller/building.py \
1934 - || die "sed failed to disable ccache stats call"
1935 -
1936 - einfo "Removing pre-built binaries ..."
1937 - find "${S}"/third_party -type f \( -name '*.so' -o -name '*.o' \) -print -delete || die
1938 -
1939 - # Clearing checksums where we have applied patches
1940 - moz_clear_vendor_checksums target-lexicon-0.9.0
1941 -
1942 - # Create build dir
1943 - BUILD_DIR="${WORKDIR}/${PN}_build"
1944 - mkdir -p "${BUILD_DIR}" || die
1945 -
1946 - # Write API keys to disk
1947 - echo -n "${MOZ_API_KEY_GOOGLE//gGaPi/}" > "${S}"/api-google.key || die
1948 - echo -n "${MOZ_API_KEY_LOCATION//gGaPi/}" > "${S}"/api-location.key || die
1949 - echo -n "${MOZ_API_KEY_MOZILLA//m0ap1/}" > "${S}"/api-mozilla.key || die
1950 -
1951 - xdg_environment_reset
1952 -}
1953 -
1954 -src_configure() {
1955 - # Show flags set at the beginning
1956 - einfo "Current BINDGEN_CFLAGS:\t${BINDGEN_CFLAGS:-no value set}"
1957 - einfo "Current CFLAGS:\t\t${CFLAGS:-no value set}"
1958 - einfo "Current CXXFLAGS:\t\t${CXXFLAGS:-no value set}"
1959 - einfo "Current LDFLAGS:\t\t${LDFLAGS:-no value set}"
1960 - einfo "Current RUSTFLAGS:\t\t${RUSTFLAGS:-no value set}"
1961 -
1962 - local have_switched_compiler=
1963 - if use clang && ! tc-is-clang ; then
1964 - # Force clang
1965 - einfo "Enforcing the use of clang due to USE=clang ..."
1966 - have_switched_compiler=yes
1967 - AR=llvm-ar
1968 - AS=llvm-as
1969 - CC=${CHOST}-clang
1970 - CXX=${CHOST}-clang++
1971 - NM=llvm-nm
1972 - RANLIB=llvm-ranlib
1973 - elif ! use clang && ! tc-is-gcc ; then
1974 - # Force gcc
1975 - have_switched_compiler=yes
1976 - einfo "Enforcing the use of gcc due to USE=-clang ..."
1977 - AR=gcc-ar
1978 - CC=${CHOST}-gcc
1979 - CXX=${CHOST}-g++
1980 - NM=gcc-nm
1981 - RANLIB=gcc-ranlib
1982 - fi
1983 -
1984 - if [[ -n "${have_switched_compiler}" ]] ; then
1985 - # Because we switched active compiler we have to ensure
1986 - # that no unsupported flags are set
1987 - strip-unsupported-flags
1988 - fi
1989 -
1990 - # Ensure we use correct toolchain
1991 - export HOST_CC="$(tc-getBUILD_CC)"
1992 - export HOST_CXX="$(tc-getBUILD_CXX)"
1993 - tc-export CC CXX LD AR NM OBJDUMP RANLIB PKG_CONFIG
1994 -
1995 - # Pass the correct toolchain paths through cbindgen
1996 - if tc-is-cross-compiler ; then
1997 - export BINDGEN_CFLAGS="${SYSROOT:+--sysroot=${ESYSROOT}} --target=${CHOST} ${BINDGEN_CFLAGS-}"
1998 - fi
1999 -
2000 - # Set MOZILLA_FIVE_HOME
2001 - export MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
2002 -
2003 - # python/mach/mach/mixin/process.py fails to detect SHELL
2004 - export SHELL="${EPREFIX}/bin/bash"
2005 -
2006 - # Set state path
2007 - export MOZBUILD_STATE_PATH="${BUILD_DIR}"
2008 -
2009 - # Set MOZCONFIG
2010 - export MOZCONFIG="${S}/.mozconfig"
2011 -
2012 - # Initialize MOZCONFIG
2013 - mozconfig_add_options_ac '' --enable-application=browser
2014 -
2015 - # Set Gentoo defaults
2016 - export MOZILLA_OFFICIAL=1
2017 -
2018 - mozconfig_add_options_ac 'Gentoo default' \
2019 - --allow-addon-sideload \
2020 - --disable-cargo-incremental \
2021 - --disable-crashreporter \
2022 - --disable-gpsd \
2023 - --disable-install-strip \
2024 - --disable-parental-controls \
2025 - --disable-strip \
2026 - --disable-updater \
2027 - --enable-negotiateauth \
2028 - --enable-new-pass-manager \
2029 - --enable-official-branding \
2030 - --enable-release \
2031 - --enable-system-ffi \
2032 - --enable-system-pixman \
2033 - --host="${CBUILD:-${CHOST}}" \
2034 - --libdir="${EPREFIX}/usr/$(get_libdir)" \
2035 - --prefix="${EPREFIX}/usr" \
2036 - --target="${CHOST}" \
2037 - --without-ccache \
2038 - --without-wasm-sandboxed-libraries \
2039 - --with-intl-api \
2040 - --with-libclang-path="$(llvm-config --libdir)" \
2041 - --with-system-nspr \
2042 - --with-system-nss \
2043 - --with-system-zlib \
2044 - --with-toolchain-prefix="${CHOST}-" \
2045 - --with-unsigned-addon-scopes=app,system \
2046 - --x-includes="${ESYSROOT}/usr/include" \
2047 - --x-libraries="${ESYSROOT}/usr/$(get_libdir)"
2048 -
2049 - # Set update channel
2050 - local update_channel=release
2051 - [[ -n ${MOZ_ESR} ]] && update_channel=esr
2052 - mozconfig_add_options_ac '' --update-channel=${update_channel}
2053 -
2054 - if ! use x86 && [[ ${CHOST} != armv*h* ]] ; then
2055 - mozconfig_add_options_ac '' --enable-rust-simd
2056 - fi
2057 -
2058 - # For future keywording: This is currently (97.0) only supported on:
2059 - # amd64, arm, arm64 & x86.
2060 - # Might want to flip the logic around if Firefox is to support more arches.
2061 - if use ppc64; then
2062 - mozconfig_add_options_ac '' --disable-sandbox
2063 - else
2064 - mozconfig_add_options_ac '' --enable-sandbox
2065 - fi
2066 -
2067 - if [[ -s "${S}/api-google.key" ]] ; then
2068 - local key_origin="Gentoo default"
2069 - if [[ $(cat "${S}/api-google.key" | md5sum | awk '{ print $1 }') != 709560c02f94b41f9ad2c49207be6c54 ]] ; then
2070 - key_origin="User value"
2071 - fi
2072 -
2073 - mozconfig_add_options_ac "${key_origin}" \
2074 - --with-google-safebrowsing-api-keyfile="${S}/api-google.key"
2075 - else
2076 - einfo "Building without Google API key ..."
2077 - fi
2078 -
2079 - if [[ -s "${S}/api-location.key" ]] ; then
2080 - local key_origin="Gentoo default"
2081 - if [[ $(cat "${S}/api-location.key" | md5sum | awk '{ print $1 }') != ffb7895e35dedf832eb1c5d420ac7420 ]] ; then
2082 - key_origin="User value"
2083 - fi
2084 -
2085 - mozconfig_add_options_ac "${key_origin}" \
2086 - --with-google-location-service-api-keyfile="${S}/api-location.key"
2087 - else
2088 - einfo "Building without Location API key ..."
2089 - fi
2090 -
2091 - if [[ -s "${S}/api-mozilla.key" ]] ; then
2092 - local key_origin="Gentoo default"
2093 - if [[ $(cat "${S}/api-mozilla.key" | md5sum | awk '{ print $1 }') != 3927726e9442a8e8fa0e46ccc39caa27 ]] ; then
2094 - key_origin="User value"
2095 - fi
2096 -
2097 - mozconfig_add_options_ac "${key_origin}" \
2098 - --with-mozilla-api-keyfile="${S}/api-mozilla.key"
2099 - else
2100 - einfo "Building without Mozilla API key ..."
2101 - fi
2102 -
2103 - mozconfig_use_with system-av1
2104 - mozconfig_use_with system-harfbuzz
2105 - mozconfig_use_with system-harfbuzz system-graphite2
2106 - mozconfig_use_with system-icu
2107 - mozconfig_use_with system-jpeg
2108 - mozconfig_use_with system-libevent
2109 - mozconfig_use_with system-libvpx
2110 - mozconfig_use_with system-png
2111 - mozconfig_use_with system-webp
2112 -
2113 - mozconfig_use_enable dbus
2114 - mozconfig_use_enable libproxy
2115 -
2116 - use eme-free && mozconfig_add_options_ac '+eme-free' --disable-eme
2117 -
2118 - mozconfig_use_enable geckodriver
2119 -
2120 - if use hardened ; then
2121 - mozconfig_add_options_ac "+hardened" --enable-hardening
2122 - append-ldflags "-Wl,-z,relro -Wl,-z,now"
2123 - fi
2124 -
2125 - local myaudiobackends=""
2126 - use jack && myaudiobackends+="jack,"
2127 - use sndio && myaudiobackends+="sndio,"
2128 - use pulseaudio && myaudiobackends+="pulseaudio,"
2129 - ! use pulseaudio && myaudiobackends+="alsa,"
2130 -
2131 - mozconfig_add_options_ac '--enable-audio-backends' --enable-audio-backends="${myaudiobackends::-1}"
2132 -
2133 - mozconfig_use_enable wifi necko-wifi
2134 -
2135 - if use wayland ; then
2136 - mozconfig_add_options_ac '+wayland' --enable-default-toolkit=cairo-gtk3-x11-wayland
2137 - else
2138 - mozconfig_add_options_ac '' --enable-default-toolkit=cairo-gtk3
2139 - fi
2140 -
2141 - if use lto ; then
2142 - if use clang ; then
2143 - # Upstream only supports lld when using clang
2144 - mozconfig_add_options_ac "forcing ld=lld due to USE=clang and USE=lto" --enable-linker=lld
2145 -
2146 - mozconfig_add_options_ac '+lto' --enable-lto=cross
2147 -
2148 - else
2149 - # ThinLTO is currently broken, see bmo#1644409
2150 - mozconfig_add_options_ac '+lto' --enable-lto=full
2151 - mozconfig_add_options_ac "linker is set to bfd" --enable-linker=bfd
2152 - fi
2153 -
2154 - if use pgo ; then
2155 - mozconfig_add_options_ac '+pgo' MOZ_PGO=1
2156 -
2157 - if use clang ; then
2158 - # Used in build/pgo/profileserver.py
2159 - export LLVM_PROFDATA="llvm-profdata"
2160 - fi
2161 - fi
2162 - else
2163 - # Avoid auto-magic on linker
2164 - if use clang ; then
2165 - # This is upstream's default
2166 - mozconfig_add_options_ac "forcing ld=lld due to USE=clang" --enable-linker=lld
2167 - else
2168 - mozconfig_add_options_ac "linker is set to bfd" --enable-linker=bfd
2169 - fi
2170 - fi
2171 -
2172 - # LTO flag was handled via configure
2173 - filter-flags '-flto*'
2174 -
2175 - mozconfig_use_enable debug
2176 - if use debug ; then
2177 - mozconfig_add_options_ac '+debug' --disable-optimize
2178 - else
2179 - if is-flag '-g*' ; then
2180 - if use clang ; then
2181 - mozconfig_add_options_ac 'from CFLAGS' --enable-debug-symbols=$(get-flag '-g*')
2182 - else
2183 - mozconfig_add_options_ac 'from CFLAGS' --enable-debug-symbols
2184 - fi
2185 - else
2186 - mozconfig_add_options_ac 'Gentoo default' --disable-debug-symbols
2187 - fi
2188 -
2189 - if is-flag '-O0' ; then
2190 - mozconfig_add_options_ac "from CFLAGS" --enable-optimize=-O0
2191 - elif is-flag '-O4' ; then
2192 - mozconfig_add_options_ac "from CFLAGS" --enable-optimize=-O4
2193 - elif is-flag '-O3' ; then
2194 - mozconfig_add_options_ac "from CFLAGS" --enable-optimize=-O3
2195 - elif is-flag '-O1' ; then
2196 - mozconfig_add_options_ac "from CFLAGS" --enable-optimize=-O1
2197 - elif is-flag '-Os' ; then
2198 - mozconfig_add_options_ac "from CFLAGS" --enable-optimize=-Os
2199 - else
2200 - mozconfig_add_options_ac "Gentoo default" --enable-optimize=-O2
2201 - fi
2202 - fi
2203 -
2204 - # Debug flag was handled via configure
2205 - filter-flags '-g*'
2206 -
2207 - # Optimization flag was handled via configure
2208 - filter-flags '-O*'
2209 -
2210 - # Modifications to better support ARM, bug #553364
2211 - if use cpu_flags_arm_neon ; then
2212 - mozconfig_add_options_ac '+cpu_flags_arm_neon' --with-fpu=neon
2213 -
2214 - if ! tc-is-clang ; then
2215 - # thumb options aren't supported when using clang, bug 666966
2216 - mozconfig_add_options_ac '+cpu_flags_arm_neon' \
2217 - --with-thumb=yes \
2218 - --with-thumb-interwork=no
2219 - fi
2220 - fi
2221 -
2222 - if [[ ${CHOST} == armv*h* ]] ; then
2223 - mozconfig_add_options_ac 'CHOST=armv*h*' --with-float-abi=hard
2224 -
2225 - if ! use system-libvpx ; then
2226 - sed -i \
2227 - -e "s|softfp|hard|" \
2228 - "${S}"/media/libvpx/moz.build \
2229 - || die
2230 - fi
2231 - fi
2232 -
2233 - if use clang ; then
2234 - # https://bugzilla.mozilla.org/show_bug.cgi?id=1482204
2235 - # https://bugzilla.mozilla.org/show_bug.cgi?id=1483822
2236 - # toolkit/moz.configure Elfhack section: target.cpu in ('arm', 'x86', 'x86_64')
2237 - local disable_elf_hack=
2238 - if use amd64 ; then
2239 - disable_elf_hack=yes
2240 - elif use x86 ; then
2241 - disable_elf_hack=yes
2242 - elif use arm ; then
2243 - disable_elf_hack=yes
2244 - fi
2245 -
2246 - if [[ -n ${disable_elf_hack} ]] ; then
2247 - mozconfig_add_options_ac 'elf-hack is broken when using Clang' --disable-elf-hack
2248 - fi
2249 - elif tc-is-gcc ; then
2250 - if ver_test $(gcc-fullversion) -ge 10 ; then
2251 - einfo "Forcing -fno-tree-loop-vectorize to workaround GCC bug, see bug 758446 ..."
2252 - append-cxxflags -fno-tree-loop-vectorize
2253 - fi
2254 - fi
2255 -
2256 - # Additional ARCH support
2257 - case "${ARCH}" in
2258 - arm)
2259 - # Reduce the memory requirements for linking
2260 - if use clang ; then
2261 - # Nothing to do
2262 - :;
2263 - elif use lto ; then
2264 - append-ldflags -Wl,--no-keep-memory
2265 - else
2266 - append-ldflags -Wl,--no-keep-memory -Wl,--reduce-memory-overheads
2267 - fi
2268 - ;;
2269 - esac
2270 -
2271 - if ! use elibc_glibc ; then
2272 - mozconfig_add_options_ac '!elibc_glibc' --disable-jemalloc
2273 - fi
2274 -
2275 - # Allow elfhack to work in combination with unstripped binaries
2276 - # when they would normally be larger than 2GiB.
2277 - append-ldflags "-Wl,--compress-debug-sections=zlib"
2278 -
2279 - # Make revdep-rebuild.sh happy; Also required for musl
2280 - append-ldflags -Wl,-rpath="${MOZILLA_FIVE_HOME}",--enable-new-dtags
2281 -
2282 - # Pass $MAKEOPTS to build system
2283 - export MOZ_MAKE_FLAGS="${MAKEOPTS}"
2284 -
2285 - # Use system's Python environment
2286 - PIP_NETWORK_INSTALL_RESTRICTED_VIRTUALENVS=mach
2287 -
2288 - if use system-python-libs; then
2289 - export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE="system"
2290 - else
2291 - export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE="none"
2292 - fi
2293 -
2294 - # Disable notification when build system has finished
2295 - export MOZ_NOSPAM=1
2296 -
2297 - # Portage sets XARGS environment variable to "xargs -r" by default which
2298 - # breaks build system's check_prog() function which doesn't support arguments
2299 - mozconfig_add_options_ac 'Gentoo default' "XARGS=${EPREFIX}/usr/bin/xargs"
2300 -
2301 - # Set build dir
2302 - mozconfig_add_options_mk 'Gentoo default' "MOZ_OBJDIR=${BUILD_DIR}"
2303 -
2304 - # Show flags we will use
2305 - einfo "Build BINDGEN_CFLAGS:\t${BINDGEN_CFLAGS:-no value set}"
2306 - einfo "Build CFLAGS:\t\t${CFLAGS:-no value set}"
2307 - einfo "Build CXXFLAGS:\t\t${CXXFLAGS:-no value set}"
2308 - einfo "Build LDFLAGS:\t\t${LDFLAGS:-no value set}"
2309 - einfo "Build RUSTFLAGS:\t\t${RUSTFLAGS:-no value set}"
2310 -
2311 - # Handle EXTRA_CONF and show summary
2312 - local ac opt hash reason
2313 -
2314 - # Apply EXTRA_ECONF entries to $MOZCONFIG
2315 - if [[ -n ${EXTRA_ECONF} ]] ; then
2316 - IFS=\! read -a ac <<<${EXTRA_ECONF// --/\!}
2317 - for opt in "${ac[@]}"; do
2318 - mozconfig_add_options_ac "EXTRA_ECONF" --${opt#--}
2319 - done
2320 - fi
2321 -
2322 - echo
2323 - echo "=========================================================="
2324 - echo "Building ${PF} with the following configuration"
2325 - grep ^ac_add_options "${MOZCONFIG}" | while read ac opt hash reason; do
2326 - [[ -z ${hash} || ${hash} == \# ]] \
2327 - || die "error reading mozconfig: ${ac} ${opt} ${hash} ${reason}"
2328 - printf " %-30s %s\n" "${opt}" "${reason:-mozilla.org default}"
2329 - done
2330 - echo "=========================================================="
2331 - echo
2332 -
2333 - ./mach configure || die
2334 -}
2335 -
2336 -src_compile() {
2337 - local virtx_cmd=
2338 -
2339 - if use pgo ; then
2340 - virtx_cmd=virtx
2341 -
2342 - # Reset and cleanup environment variables used by GNOME/XDG
2343 - gnome2_environment_reset
2344 -
2345 - addpredict /root
2346 - fi
2347 -
2348 - local -x GDK_BACKEND=x11
2349 -
2350 - ${virtx_cmd} ./mach build --verbose \
2351 - || die
2352 -}
2353 -
2354 -src_install() {
2355 - # xpcshell is getting called during install
2356 - pax-mark m \
2357 - "${BUILD_DIR}"/dist/bin/xpcshell \
2358 - "${BUILD_DIR}"/dist/bin/${PN} \
2359 - "${BUILD_DIR}"/dist/bin/plugin-container
2360 -
2361 - DESTDIR="${D}" ./mach install || die
2362 -
2363 - # Upstream cannot ship symlink but we can (bmo#658850)
2364 - rm "${ED}${MOZILLA_FIVE_HOME}/${PN}-bin" || die
2365 - dosym ${PN} ${MOZILLA_FIVE_HOME}/${PN}-bin
2366 -
2367 - # Don't install llvm-symbolizer from sys-devel/llvm package
2368 - if [[ -f "${ED}${MOZILLA_FIVE_HOME}/llvm-symbolizer" ]] ; then
2369 - rm -v "${ED}${MOZILLA_FIVE_HOME}/llvm-symbolizer" || die
2370 - fi
2371 -
2372 - # Install policy (currently only used to disable application updates)
2373 - insinto "${MOZILLA_FIVE_HOME}/distribution"
2374 - newins "${FILESDIR}"/distribution.ini distribution.ini
2375 - newins "${FILESDIR}"/disable-auto-update.policy.json policies.json
2376 -
2377 - # Install system-wide preferences
2378 - local PREFS_DIR="${MOZILLA_FIVE_HOME}/browser/defaults/preferences"
2379 - insinto "${PREFS_DIR}"
2380 - newins "${FILESDIR}"/gentoo-default-prefs.js gentoo-prefs.js
2381 -
2382 - local GENTOO_PREFS="${ED}${PREFS_DIR}/gentoo-prefs.js"
2383 -
2384 - # Set dictionary path to use system hunspell
2385 - cat >>"${GENTOO_PREFS}" <<-EOF || die "failed to set spellchecker.dictionary_path pref"
2386 - pref("spellchecker.dictionary_path", "${EPREFIX}/usr/share/myspell");
2387 - EOF
2388 -
2389 - # Force hwaccel prefs if USE=hwaccel is enabled
2390 - if use hwaccel ; then
2391 - cat "${FILESDIR}"/gentoo-hwaccel-prefs.js-r2 \
2392 - >>"${GENTOO_PREFS}" \
2393 - || die "failed to add prefs to force hardware-accelerated rendering to all-gentoo.js"
2394 -
2395 - if use wayland; then
2396 - cat >>"${GENTOO_PREFS}" <<-EOF || die "failed to set hwaccel wayland prefs"
2397 - pref("gfx.x11-egl.force-enabled", false);
2398 - EOF
2399 - else
2400 - cat >>"${GENTOO_PREFS}" <<-EOF || die "failed to set hwaccel x11 prefs"
2401 - pref("gfx.x11-egl.force-enabled", true);
2402 - EOF
2403 - fi
2404 - fi
2405 -
2406 - if ! use gmp-autoupdate ; then
2407 - local plugin
2408 - for plugin in "${MOZ_GMP_PLUGIN_LIST[@]}" ; do
2409 - einfo "Disabling auto-update for ${plugin} plugin ..."
2410 - cat >>"${GENTOO_PREFS}" <<-EOF || die "failed to disable autoupdate for ${plugin} media plugin"
2411 - pref("media.${plugin}.autoupdate", false);
2412 - EOF
2413 - done
2414 - fi
2415 -
2416 - # Force the graphite pref if USE=system-harfbuzz is enabled, since the pref cannot disable it
2417 - if use system-harfbuzz ; then
2418 - cat >>"${GENTOO_PREFS}" <<-EOF || die "failed to set gfx.font_rendering.graphite.enabled pref"
2419 - sticky_pref("gfx.font_rendering.graphite.enabled", true);
2420 - EOF
2421 - fi
2422 -
2423 - # Install language packs
2424 - local langpacks=( $(find "${WORKDIR}/language_packs" -type f -name '*.xpi') )
2425 - if [[ -n "${langpacks}" ]] ; then
2426 - moz_install_xpi "${MOZILLA_FIVE_HOME}/distribution/extensions" "${langpacks[@]}"
2427 - fi
2428 -
2429 - # Install geckodriver
2430 - if use geckodriver ; then
2431 - einfo "Installing geckodriver into ${ED}${MOZILLA_FIVE_HOME} ..."
2432 - pax-mark m "${BUILD_DIR}"/dist/bin/geckodriver
2433 - exeinto "${MOZILLA_FIVE_HOME}"
2434 - doexe "${BUILD_DIR}"/dist/bin/geckodriver
2435 -
2436 - dosym ${MOZILLA_FIVE_HOME}/geckodriver /usr/bin/geckodriver
2437 - fi
2438 -
2439 - # Install icons
2440 - local icon_srcdir="${S}/browser/branding/official"
2441 - local icon_symbolic_file="${FILESDIR}/icon/firefox-symbolic.svg"
2442 -
2443 - insinto /usr/share/icons/hicolor/symbolic/apps
2444 - newins "${icon_symbolic_file}" ${PN}-symbolic.svg
2445 -
2446 - local icon size
2447 - for icon in "${icon_srcdir}"/default*.png ; do
2448 - size=${icon%.png}
2449 - size=${size##*/default}
2450 -
2451 - if [[ ${size} -eq 48 ]] ; then
2452 - newicon "${icon}" ${PN}.png
2453 - fi
2454 -
2455 - newicon -s ${size} "${icon}" ${PN}.png
2456 - done
2457 -
2458 - # Install menu
2459 - local app_name="Mozilla ${MOZ_PN^}"
2460 - local desktop_file="${FILESDIR}/icon/${PN}-r3.desktop"
2461 - local desktop_filename="${PN}.desktop"
2462 - local exec_command="${PN}"
2463 - local icon="${PN}"
2464 - local use_wayland="false"
2465 -
2466 - if use wayland ; then
2467 - use_wayland="true"
2468 - fi
2469 -
2470 - cp "${desktop_file}" "${WORKDIR}/${PN}.desktop-template" || die
2471 -
2472 - sed -i \
2473 - -e "s:@NAME@:${app_name}:" \
2474 - -e "s:@EXEC@:${exec_command}:" \
2475 - -e "s:@ICON@:${icon}:" \
2476 - "${WORKDIR}/${PN}.desktop-template" \
2477 - || die
2478 -
2479 - newmenu "${WORKDIR}/${PN}.desktop-template" "${desktop_filename}"
2480 -
2481 - rm "${WORKDIR}/${PN}.desktop-template" || die
2482 -
2483 - # Install wrapper script
2484 - [[ -f "${ED}/usr/bin/${PN}" ]] && rm "${ED}/usr/bin/${PN}"
2485 - newbin "${FILESDIR}/${PN}-r1.sh" ${PN}
2486 -
2487 - # Update wrapper
2488 - sed -i \
2489 - -e "s:@PREFIX@:${EPREFIX}/usr:" \
2490 - -e "s:@MOZ_FIVE_HOME@:${MOZILLA_FIVE_HOME}:" \
2491 - -e "s:@APULSELIB_DIR@:${apulselib}:" \
2492 - -e "s:@DEFAULT_WAYLAND@:${use_wayland}:" \
2493 - "${ED}/usr/bin/${PN}" \
2494 - || die
2495 -}
2496 -
2497 -pkg_preinst() {
2498 - xdg_pkg_preinst
2499 -
2500 - # If the apulse libs are available in MOZILLA_FIVE_HOME then apulse
2501 - # does not need to be forced into the LD_LIBRARY_PATH
2502 - if use pulseaudio && has_version ">=media-sound/apulse-0.1.12-r4" ; then
2503 - einfo "APULSE found; Generating library symlinks for sound support ..."
2504 - local lib
2505 - pushd "${ED}${MOZILLA_FIVE_HOME}" &>/dev/null || die
2506 - for lib in ../apulse/libpulse{.so{,.0},-simple.so{,.0}} ; do
2507 - # A quickpkg rolled by hand will grab symlinks as part of the package,
2508 - # so we need to avoid creating them if they already exist.
2509 - if [[ ! -L ${lib##*/} ]] ; then
2510 - ln -s "${lib}" ${lib##*/} || die
2511 - fi
2512 - done
2513 - popd &>/dev/null || die
2514 - fi
2515 -}
2516 -
2517 -pkg_postinst() {
2518 - xdg_pkg_postinst
2519 -
2520 - if ! use gmp-autoupdate ; then
2521 - elog "USE='-gmp-autoupdate' has disabled the following plugins from updating or"
2522 - elog "installing into new profiles:"
2523 - local plugin
2524 - for plugin in "${MOZ_GMP_PLUGIN_LIST[@]}" ; do
2525 - elog "\t ${plugin}"
2526 - done
2527 - elog
2528 - fi
2529 -
2530 - if use pulseaudio && has_version ">=media-sound/apulse-0.1.12-r4" ; then
2531 - elog "Apulse was detected at merge time on this system and so it will always be"
2532 - elog "used for sound. If you wish to use pulseaudio instead please unmerge"
2533 - elog "media-sound/apulse."
2534 - elog
2535 - fi
2536 -
2537 - local show_doh_information
2538 - local show_normandy_information
2539 - local show_shortcut_information
2540 -
2541 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
2542 - # New install; Tell user that DoH is disabled by default
2543 - show_doh_information=yes
2544 - show_normandy_information=yes
2545 - show_shortcut_information=no
2546 - else
2547 - local replacing_version
2548 - for replacing_version in ${REPLACING_VERSIONS} ; do
2549 - if ver_test "${replacing_version}" -lt 91.0 ; then
2550 - # Tell user that we no longer install a shortcut
2551 - # per supported display protocol
2552 - show_shortcut_information=yes
2553 - fi
2554 - done
2555 - fi
2556 -
2557 - if [[ -n "${show_doh_information}" ]] ; then
2558 - elog
2559 - elog "Note regarding Trusted Recursive Resolver aka DNS-over-HTTPS (DoH):"
2560 - elog "Due to privacy concerns (encrypting DNS might be a good thing, sending all"
2561 - elog "DNS traffic to Cloudflare by default is not a good idea and applications"
2562 - elog "should respect OS configured settings), \"network.trr.mode\" was set to 5"
2563 - elog "(\"Off by choice\") by default."
2564 - elog "You can enable DNS-over-HTTPS in ${PN^}'s preferences."
2565 - fi
2566 -
2567 - # bug 713782
2568 - if [[ -n "${show_normandy_information}" ]] ; then
2569 - elog
2570 - elog "Upstream operates a service named Normandy which allows Mozilla to"
2571 - elog "push changes for default settings or even install new add-ons remotely."
2572 - elog "While this can be useful to address problems like 'Armagadd-on 2.0' or"
2573 - elog "revert previous decisions to disable TLS 1.0/1.1, privacy and security"
2574 - elog "concerns prevail, which is why we have switched off the use of this"
2575 - elog "service by default."
2576 - elog
2577 - elog "To re-enable this service set"
2578 - elog
2579 - elog " app.normandy.enabled=true"
2580 - elog
2581 - elog "in about:config."
2582 - fi
2583 -
2584 - if [[ -n "${show_shortcut_information}" ]] ; then
2585 - elog
2586 - elog "Since ${PN}-91.0 we no longer install multiple shortcuts for"
2587 - elog "each supported display protocol. Instead we will only install"
2588 - elog "one generic Mozilla ${PN^} shortcut."
2589 - elog "If you still want to be able to select between running Mozilla ${PN^}"
2590 - elog "on X11 or Wayland, you have to re-create these shortcuts on your own."
2591 - fi
2592 -
2593 - # bug 835078
2594 - if use hwaccel && has_version "x11-drivers/xf86-video-nouveau"; then
2595 - ewarn "You have nouveau drivers installed in your system and 'hwaccel' "
2596 - ewarn "enabled for Firefox. Nouveau / your GPU might not supported the "
2597 - ewarn "required EGL, so either disable 'hwaccel' or try the workaround "
2598 - ewarn "explained in https://bugs.gentoo.org/835078#c5 if Firefox crashes."
2599 - fi
2600 -
2601 - elog
2602 - elog "Unfortunately Firefox-100.0 breaks compatibility with some sites using "
2603 - elog "useragent checks. To temporarily fix this, enter about:config and modify "
2604 - elog "network.http.useragent.forceVersion preference to \"99\"."
2605 - elog "Or install an addon to change your useragent."
2606 - elog "See: https://support.mozilla.org/en-US/kb/difficulties-opening-or-using-website-firefox-100"
2607 - elog
2608 -}