1 |
commit: 1d0fae1958a7d239ab8d4877567074c026b92145 |
2 |
Author: Joonas Niilola <juippis <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jun 5 13:31:34 2022 +0000 |
4 |
Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jun 5 13:34:41 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1d0fae19 |
7 |
|
8 |
www-client/firefox: introduce 'X' use flag |
9 |
|
10 |
- which allows wayland-only build. Huge thanks to Michel Ganguin in |
11 |
bgo#848858 for providing patches, and working with upstream in |
12 |
prior to have wayland-only build possible. PGO is still X-only, as |
13 |
it requires an update to virtualx.eclass first. |
14 |
- will be package.mask'd for further testing. |
15 |
|
16 |
Bug: https://bugs.gentoo.org/848858 |
17 |
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org> |
18 |
|
19 |
www-client/firefox/Manifest | 1 + |
20 |
www-client/firefox/firefox-101.0-r10.ebuild | 1282 +++++++++++++++++++++++++++ |
21 |
2 files changed, 1283 insertions(+) |
22 |
|
23 |
diff --git a/www-client/firefox/Manifest b/www-client/firefox/Manifest |
24 |
index 8a742e02f5b9..238483ad4fd1 100644 |
25 |
--- a/www-client/firefox/Manifest |
26 |
+++ b/www-client/firefox/Manifest |
27 |
@@ -1,4 +1,5 @@ |
28 |
DIST firefox-101-patches-01j.tar.xz 17516 BLAKE2B 1d222df49f8c97d71e07acbe1427351961425508af86d9df440e9a78026edacb638f1ac8e49bc93733aeffb68a270a7bf2e7f1758c285d682fbc6e8910f162cb SHA512 f7e59b67761caf60e6d37134a72d7d71bf9376a5ef9149fb83d59ddb227601a78b63685051ff634cfa17f49f5d77eba49f8ca6f9bb635fe97a4acbe8eb07177f |
29 |
+DIST firefox-101-patches-03j.tar.xz 20448 BLAKE2B 4261674022814cc656a73785f75ceb489a4bf60132f027674ac841e61a43b6defcdafe14878dcb8cd01911f43952d9e2c99b23065d4e68b68d907ae176d2aaa4 SHA512 316e3474a631bfc636d2f76dc709146aec0010f44c0b1e8b40d9b603000063320257b80dc758d8e08441b67125fa2346cb468470b87efcbb3324c1be3c492f44 |
30 |
DIST firefox-101.0-ach.xpi 443451 BLAKE2B a8da480ce7f4d677a3b432708376aa1ef3cb302b9e944605bf52708b723ff3778024683461789b83b292fe77965a5f9e45995cc354b5c3ab68f2ac1c14da11c3 SHA512 7f9778d872043a80fb357503a76b78cb9de821214bf66374f9f3cbe079dc5ada99b32c98cef76853657fd1db937ab3b1d28d499de1d304364cd7db3c8dd94863 |
31 |
DIST firefox-101.0-af.xpi 413388 BLAKE2B 600f6091343ea59bc68d5c9352b75d560055530ffbb241c916d86ee3e8a9db6eabcd64743999a8de3fd3f4e0984addbfdcd341c1d97b6b0fedb8873acc1490fa SHA512 64c66a654efda3c9d9c44ba44014570285cf14aa4fa6c08c4d2f89aa27c7854fb43694445ff5f9362e2260453ca9789798af3424f56e500fc542bf514046b3df |
32 |
DIST firefox-101.0-an.xpi 487253 BLAKE2B 32938686d11e0fd7b4083b67929fa2274f8c7685871d6ad91898b6b310622c42f4e0fd732dffe50878fb874a473178826daf3e42000c916615e0159aeae4bdd4 SHA512 b32e0768865643a58e7b86fc8839e08d982463311741931b01592992cb3fb512caa28080434cf22fc8dcf2be8f8d9af76168efdda31cc002016cde46710a8102 |
33 |
|
34 |
diff --git a/www-client/firefox/firefox-101.0-r10.ebuild b/www-client/firefox/firefox-101.0-r10.ebuild |
35 |
new file mode 100644 |
36 |
index 000000000000..e409fa7f0871 |
37 |
--- /dev/null |
38 |
+++ b/www-client/firefox/firefox-101.0-r10.ebuild |
39 |
@@ -0,0 +1,1282 @@ |
40 |
+# Copyright 1999-2022 Gentoo Authors |
41 |
+# Distributed under the terms of the GNU General Public License v2 |
42 |
+ |
43 |
+EAPI="8" |
44 |
+ |
45 |
+FIREFOX_PATCHSET="firefox-101-patches-03j.tar.xz" |
46 |
+ |
47 |
+LLVM_MAX_SLOT=14 |
48 |
+ |
49 |
+PYTHON_COMPAT=( python3_{8..10} ) |
50 |
+PYTHON_REQ_USE="ncurses,sqlite,ssl" |
51 |
+ |
52 |
+WANT_AUTOCONF="2.1" |
53 |
+ |
54 |
+VIRTUALX_REQUIRED="pgo" |
55 |
+ |
56 |
+MOZ_ESR= |
57 |
+ |
58 |
+MOZ_PV=${PV} |
59 |
+MOZ_PV_SUFFIX= |
60 |
+if [[ ${PV} =~ (_(alpha|beta|rc).*)$ ]] ; then |
61 |
+ MOZ_PV_SUFFIX=${BASH_REMATCH[1]} |
62 |
+ |
63 |
+ # Convert the ebuild version to the upstream Mozilla version |
64 |
+ MOZ_PV="${MOZ_PV/_alpha/a}" # Handle alpha for SRC_URI |
65 |
+ MOZ_PV="${MOZ_PV/_beta/b}" # Handle beta for SRC_URI |
66 |
+ MOZ_PV="${MOZ_PV%%_rc*}" # Handle rc for SRC_URI |
67 |
+fi |
68 |
+ |
69 |
+if [[ -n ${MOZ_ESR} ]] ; then |
70 |
+ # ESR releases have slightly different version numbers |
71 |
+ MOZ_PV="${MOZ_PV}esr" |
72 |
+fi |
73 |
+ |
74 |
+MOZ_PN="${PN%-bin}" |
75 |
+MOZ_P="${MOZ_PN}-${MOZ_PV}" |
76 |
+MOZ_PV_DISTFILES="${MOZ_PV}${MOZ_PV_SUFFIX}" |
77 |
+MOZ_P_DISTFILES="${MOZ_PN}-${MOZ_PV_DISTFILES}" |
78 |
+ |
79 |
+inherit autotools check-reqs desktop flag-o-matic gnome2-utils linux-info \ |
80 |
+ llvm multiprocessing pax-utils python-any-r1 toolchain-funcs \ |
81 |
+ virtualx xdg |
82 |
+ |
83 |
+MOZ_SRC_BASE_URI="https://archive.mozilla.org/pub/${MOZ_PN}/releases/${MOZ_PV}" |
84 |
+ |
85 |
+if [[ ${PV} == *_rc* ]] ; then |
86 |
+ MOZ_SRC_BASE_URI="https://archive.mozilla.org/pub/${MOZ_PN}/candidates/${MOZ_PV}-candidates/build${PV##*_rc}" |
87 |
+fi |
88 |
+ |
89 |
+PATCH_URIS=( |
90 |
+ https://dev.gentoo.org/~{juippis,polynomial-c,whissi,slashbeast}/mozilla/patchsets/${FIREFOX_PATCHSET} |
91 |
+) |
92 |
+ |
93 |
+SRC_URI="${MOZ_SRC_BASE_URI}/source/${MOZ_P}.source.tar.xz -> ${MOZ_P_DISTFILES}.source.tar.xz |
94 |
+ ${PATCH_URIS[@]}" |
95 |
+ |
96 |
+DESCRIPTION="Firefox Web Browser" |
97 |
+HOMEPAGE="https://www.mozilla.com/firefox" |
98 |
+ |
99 |
+KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86" |
100 |
+ |
101 |
+SLOT="rapid" |
102 |
+LICENSE="MPL-2.0 GPL-2 LGPL-2.1" |
103 |
+ |
104 |
+IUSE="+clang cpu_flags_arm_neon dbus debug eme-free hardened hwaccel" |
105 |
+IUSE+=" jack libproxy lto +openh264 pgo pulseaudio sndio selinux" |
106 |
+IUSE+=" +system-av1 +system-harfbuzz +system-icu +system-jpeg +system-libevent +system-libvpx system-png system-python-libs +system-webp" |
107 |
+IUSE+=" wayland wifi" |
108 |
+ |
109 |
+# Firefox-only IUSE |
110 |
+IUSE+=" geckodriver +gmp-autoupdate screencast +X" |
111 |
+ |
112 |
+REQUIRED_USE="debug? ( !system-av1 ) |
113 |
+ pgo? ( lto ) |
114 |
+ wayland? ( dbus ) |
115 |
+ wifi? ( dbus )" |
116 |
+ |
117 |
+# Firefox-only REQUIRED_USE flags |
118 |
+REQUIRED_USE+=" || ( X wayland )" |
119 |
+REQUIRED_USE+=" pgo? ( X )" |
120 |
+REQUIRED_USE+=" screencast? ( wayland )" |
121 |
+ |
122 |
+BDEPEND="${PYTHON_DEPS} |
123 |
+ app-arch/unzip |
124 |
+ app-arch/zip |
125 |
+ >=dev-util/cbindgen-0.23.0 |
126 |
+ >=net-libs/nodejs-10.23.1 |
127 |
+ virtual/pkgconfig |
128 |
+ >=virtual/rust-1.59.0 |
129 |
+ || ( |
130 |
+ ( |
131 |
+ sys-devel/clang:14 |
132 |
+ sys-devel/llvm:14 |
133 |
+ clang? ( |
134 |
+ =sys-devel/lld-14* |
135 |
+ pgo? ( =sys-libs/compiler-rt-sanitizers-14*[profile] ) |
136 |
+ ) |
137 |
+ ) |
138 |
+ ( |
139 |
+ sys-devel/clang:13 |
140 |
+ sys-devel/llvm:13 |
141 |
+ clang? ( |
142 |
+ =sys-devel/lld-13* |
143 |
+ pgo? ( =sys-libs/compiler-rt-sanitizers-13*[profile] ) |
144 |
+ ) |
145 |
+ ) |
146 |
+ ( |
147 |
+ sys-devel/clang:12 |
148 |
+ sys-devel/llvm:12 |
149 |
+ clang? ( |
150 |
+ =sys-devel/lld-12* |
151 |
+ pgo? ( =sys-libs/compiler-rt-sanitizers-12*[profile] ) |
152 |
+ ) |
153 |
+ ) |
154 |
+ ) |
155 |
+ amd64? ( >=dev-lang/nasm-2.14 ) |
156 |
+ x86? ( >=dev-lang/nasm-2.14 )" |
157 |
+ |
158 |
+COMMON_DEPEND=" |
159 |
+ dev-libs/glib:2 |
160 |
+ dev-libs/atk |
161 |
+ dev-libs/expat |
162 |
+ dev-libs/libffi:= |
163 |
+ >=dev-libs/nss-3.78 |
164 |
+ >=dev-libs/nspr-4.32 |
165 |
+ media-libs/alsa-lib |
166 |
+ media-libs/fontconfig |
167 |
+ media-libs/freetype |
168 |
+ media-libs/mesa |
169 |
+ media-video/ffmpeg |
170 |
+ sys-libs/zlib |
171 |
+ virtual/freedesktop-icon-theme |
172 |
+ x11-libs/cairo |
173 |
+ x11-libs/gdk-pixbuf |
174 |
+ x11-libs/pango |
175 |
+ x11-libs/pixman |
176 |
+ dbus? ( |
177 |
+ dev-libs/dbus-glib |
178 |
+ sys-apps/dbus |
179 |
+ ) |
180 |
+ jack? ( virtual/jack ) |
181 |
+ libproxy? ( net-libs/libproxy ) |
182 |
+ selinux? ( sec-policy/selinux-mozilla ) |
183 |
+ sndio? ( media-sound/sndio ) |
184 |
+ screencast? ( media-video/pipewire:= ) |
185 |
+ system-av1? ( |
186 |
+ >=media-libs/dav1d-0.9.3:= |
187 |
+ >=media-libs/libaom-1.0.0:= |
188 |
+ ) |
189 |
+ system-harfbuzz? ( |
190 |
+ >=media-gfx/graphite2-1.3.13 |
191 |
+ >=media-libs/harfbuzz-2.8.1:0= |
192 |
+ ) |
193 |
+ system-icu? ( >=dev-libs/icu-71.1:= ) |
194 |
+ system-jpeg? ( >=media-libs/libjpeg-turbo-1.2.1 ) |
195 |
+ system-libevent? ( >=dev-libs/libevent-2.0:0=[threads] ) |
196 |
+ system-libvpx? ( >=media-libs/libvpx-1.8.2:0=[postproc] ) |
197 |
+ system-png? ( >=media-libs/libpng-1.6.35:0=[apng] ) |
198 |
+ system-webp? ( >=media-libs/libwebp-1.1.0:0= ) |
199 |
+ wayland? ( |
200 |
+ x11-libs/gtk+:3[wayland] |
201 |
+ x11-libs/libdrm |
202 |
+ x11-libs/libxkbcommon[wayland] |
203 |
+ ) |
204 |
+ wifi? ( |
205 |
+ kernel_linux? ( |
206 |
+ dev-libs/dbus-glib |
207 |
+ net-misc/networkmanager |
208 |
+ sys-apps/dbus |
209 |
+ ) |
210 |
+ ) |
211 |
+ X? ( |
212 |
+ virtual/opengl |
213 |
+ x11-libs/cairo[X] |
214 |
+ x11-libs/gtk+:3[X] |
215 |
+ x11-libs/libX11 |
216 |
+ x11-libs/libXcomposite |
217 |
+ x11-libs/libXdamage |
218 |
+ x11-libs/libXext |
219 |
+ x11-libs/libXfixes |
220 |
+ x11-libs/libxkbcommon[X] |
221 |
+ x11-libs/libXrandr |
222 |
+ x11-libs/libXtst |
223 |
+ x11-libs/libxcb:= |
224 |
+ )" |
225 |
+ |
226 |
+RDEPEND="${COMMON_DEPEND} |
227 |
+ !www-client/firefox:0 |
228 |
+ !www-client/firefox:esr |
229 |
+ jack? ( virtual/jack ) |
230 |
+ openh264? ( media-libs/openh264:*[plugin] ) |
231 |
+ pulseaudio? ( |
232 |
+ || ( |
233 |
+ media-sound/pulseaudio |
234 |
+ >=media-sound/apulse-0.1.12-r4 |
235 |
+ ) |
236 |
+ ) |
237 |
+ selinux? ( sec-policy/selinux-mozilla )" |
238 |
+ |
239 |
+DEPEND="${COMMON_DEPEND} |
240 |
+ pulseaudio? ( |
241 |
+ || ( |
242 |
+ media-sound/pulseaudio |
243 |
+ >=media-sound/apulse-0.1.12-r4[sdk] |
244 |
+ ) |
245 |
+ ) |
246 |
+ X? ( |
247 |
+ x11-libs/libICE |
248 |
+ x11-libs/libSM |
249 |
+ )" |
250 |
+ |
251 |
+S="${WORKDIR}/${PN}-${PV%_*}" |
252 |
+ |
253 |
+# Allow MOZ_GMP_PLUGIN_LIST to be set in an eclass or |
254 |
+# overridden in the enviromnent (advanced hackers only) |
255 |
+if [[ -z "${MOZ_GMP_PLUGIN_LIST+set}" ]] ; then |
256 |
+ MOZ_GMP_PLUGIN_LIST=( gmp-gmpopenh264 gmp-widevinecdm ) |
257 |
+fi |
258 |
+ |
259 |
+llvm_check_deps() { |
260 |
+ if ! has_version -b "sys-devel/clang:${LLVM_SLOT}" ; then |
261 |
+ einfo "sys-devel/clang:${LLVM_SLOT} is missing! Cannot use LLVM slot ${LLVM_SLOT} ..." >&2 |
262 |
+ return 1 |
263 |
+ fi |
264 |
+ |
265 |
+ if use clang ; then |
266 |
+ if ! has_version -b "=sys-devel/lld-${LLVM_SLOT}*" ; then |
267 |
+ einfo "=sys-devel/lld-${LLVM_SLOT}* is missing! Cannot use LLVM slot ${LLVM_SLOT} ..." >&2 |
268 |
+ return 1 |
269 |
+ fi |
270 |
+ |
271 |
+ if use pgo ; then |
272 |
+ if ! has_version -b "=sys-libs/compiler-rt-sanitizers-${LLVM_SLOT}*" ; then |
273 |
+ einfo "=sys-libs/compiler-rt-sanitizers-${LLVM_SLOT}* is missing! Cannot use LLVM slot ${LLVM_SLOT} ..." >&2 |
274 |
+ return 1 |
275 |
+ fi |
276 |
+ fi |
277 |
+ fi |
278 |
+ |
279 |
+ einfo "Using LLVM slot ${LLVM_SLOT} to build" >&2 |
280 |
+} |
281 |
+ |
282 |
+MOZ_LANGS=( |
283 |
+ af ar ast be bg br ca cak cs cy da de dsb |
284 |
+ el en-CA en-GB en-US es-AR es-ES et eu |
285 |
+ fi fr fy-NL ga-IE gd gl he hr hsb hu |
286 |
+ id is it ja ka kab kk ko lt lv ms nb-NO nl nn-NO |
287 |
+ pa-IN pl pt-BR pt-PT rm ro ru |
288 |
+ sk sl sq sr sv-SE th tr uk uz vi zh-CN zh-TW |
289 |
+) |
290 |
+ |
291 |
+# Firefox-only LANGS |
292 |
+MOZ_LANGS+=( ach ) |
293 |
+MOZ_LANGS+=( an ) |
294 |
+MOZ_LANGS+=( az ) |
295 |
+MOZ_LANGS+=( bn ) |
296 |
+MOZ_LANGS+=( bs ) |
297 |
+MOZ_LANGS+=( ca-valencia ) |
298 |
+MOZ_LANGS+=( eo ) |
299 |
+MOZ_LANGS+=( es-CL ) |
300 |
+MOZ_LANGS+=( es-MX ) |
301 |
+MOZ_LANGS+=( fa ) |
302 |
+MOZ_LANGS+=( ff ) |
303 |
+MOZ_LANGS+=( gn ) |
304 |
+MOZ_LANGS+=( gu-IN ) |
305 |
+MOZ_LANGS+=( hi-IN ) |
306 |
+MOZ_LANGS+=( hy-AM ) |
307 |
+MOZ_LANGS+=( ia ) |
308 |
+MOZ_LANGS+=( km ) |
309 |
+MOZ_LANGS+=( kn ) |
310 |
+MOZ_LANGS+=( lij ) |
311 |
+MOZ_LANGS+=( mk ) |
312 |
+MOZ_LANGS+=( mr ) |
313 |
+MOZ_LANGS+=( my ) |
314 |
+MOZ_LANGS+=( ne-NP ) |
315 |
+MOZ_LANGS+=( oc ) |
316 |
+MOZ_LANGS+=( sco ) |
317 |
+MOZ_LANGS+=( si ) |
318 |
+MOZ_LANGS+=( son ) |
319 |
+MOZ_LANGS+=( szl ) |
320 |
+MOZ_LANGS+=( ta ) |
321 |
+MOZ_LANGS+=( te ) |
322 |
+MOZ_LANGS+=( tl ) |
323 |
+MOZ_LANGS+=( trs ) |
324 |
+MOZ_LANGS+=( ur ) |
325 |
+MOZ_LANGS+=( xh ) |
326 |
+ |
327 |
+mozilla_set_globals() { |
328 |
+ # https://bugs.gentoo.org/587334 |
329 |
+ local MOZ_TOO_REGIONALIZED_FOR_L10N=( |
330 |
+ fy-NL ga-IE gu-IN hi-IN hy-AM nb-NO ne-NP nn-NO pa-IN sv-SE |
331 |
+ ) |
332 |
+ |
333 |
+ local lang xflag |
334 |
+ for lang in "${MOZ_LANGS[@]}" ; do |
335 |
+ # en and en_US are handled internally |
336 |
+ if [[ ${lang} == en ]] || [[ ${lang} == en-US ]] ; then |
337 |
+ continue |
338 |
+ fi |
339 |
+ |
340 |
+ # strip region subtag if $lang is in the list |
341 |
+ if has ${lang} "${MOZ_TOO_REGIONALIZED_FOR_L10N[@]}" ; then |
342 |
+ xflag=${lang%%-*} |
343 |
+ else |
344 |
+ xflag=${lang} |
345 |
+ fi |
346 |
+ |
347 |
+ SRC_URI+=" l10n_${xflag/[_@]/-}? (" |
348 |
+ SRC_URI+=" ${MOZ_SRC_BASE_URI}/linux-x86_64/xpi/${lang}.xpi -> ${MOZ_P_DISTFILES}-${lang}.xpi" |
349 |
+ SRC_URI+=" )" |
350 |
+ IUSE+=" l10n_${xflag/[_@]/-}" |
351 |
+ done |
352 |
+} |
353 |
+mozilla_set_globals |
354 |
+ |
355 |
+moz_clear_vendor_checksums() { |
356 |
+ debug-print-function ${FUNCNAME} "$@" |
357 |
+ |
358 |
+ if [[ ${#} -ne 1 ]] ; then |
359 |
+ die "${FUNCNAME} requires exact one argument" |
360 |
+ fi |
361 |
+ |
362 |
+ einfo "Clearing cargo checksums for ${1} ..." |
363 |
+ |
364 |
+ sed -i \ |
365 |
+ -e 's/\("files":{\)[^}]*/\1/' \ |
366 |
+ "${S}"/third_party/rust/${1}/.cargo-checksum.json \ |
367 |
+ || die |
368 |
+} |
369 |
+ |
370 |
+moz_install_xpi() { |
371 |
+ debug-print-function ${FUNCNAME} "$@" |
372 |
+ |
373 |
+ if [[ ${#} -lt 2 ]] ; then |
374 |
+ die "${FUNCNAME} requires at least two arguments" |
375 |
+ fi |
376 |
+ |
377 |
+ local DESTDIR=${1} |
378 |
+ shift |
379 |
+ |
380 |
+ insinto "${DESTDIR}" |
381 |
+ |
382 |
+ local emid xpi_file xpi_tmp_dir |
383 |
+ for xpi_file in "${@}" ; do |
384 |
+ emid= |
385 |
+ xpi_tmp_dir=$(mktemp -d --tmpdir="${T}") |
386 |
+ |
387 |
+ # Unpack XPI |
388 |
+ unzip -qq "${xpi_file}" -d "${xpi_tmp_dir}" || die |
389 |
+ |
390 |
+ # Determine extension ID |
391 |
+ if [[ -f "${xpi_tmp_dir}/install.rdf" ]] ; then |
392 |
+ emid=$(sed -n -e '/install-manifest/,$ { /em:id/!d; s/.*[\">]\([^\"<>]*\)[\"<].*/\1/; p; q }' "${xpi_tmp_dir}/install.rdf") |
393 |
+ [[ -z "${emid}" ]] && die "failed to determine extension id from install.rdf" |
394 |
+ elif [[ -f "${xpi_tmp_dir}/manifest.json" ]] ; then |
395 |
+ emid=$(sed -n -e 's/.*"id": "\([^"]*\)".*/\1/p' "${xpi_tmp_dir}/manifest.json") |
396 |
+ [[ -z "${emid}" ]] && die "failed to determine extension id from manifest.json" |
397 |
+ else |
398 |
+ die "failed to determine extension id" |
399 |
+ fi |
400 |
+ |
401 |
+ einfo "Installing ${emid}.xpi into ${ED}${DESTDIR} ..." |
402 |
+ newins "${xpi_file}" "${emid}.xpi" |
403 |
+ done |
404 |
+} |
405 |
+ |
406 |
+mozconfig_add_options_ac() { |
407 |
+ debug-print-function ${FUNCNAME} "$@" |
408 |
+ |
409 |
+ if [[ ${#} -lt 2 ]] ; then |
410 |
+ die "${FUNCNAME} requires at least two arguments" |
411 |
+ fi |
412 |
+ |
413 |
+ local reason=${1} |
414 |
+ shift |
415 |
+ |
416 |
+ local option |
417 |
+ for option in ${@} ; do |
418 |
+ echo "ac_add_options ${option} # ${reason}" >>${MOZCONFIG} |
419 |
+ done |
420 |
+} |
421 |
+ |
422 |
+mozconfig_add_options_mk() { |
423 |
+ debug-print-function ${FUNCNAME} "$@" |
424 |
+ |
425 |
+ if [[ ${#} -lt 2 ]] ; then |
426 |
+ die "${FUNCNAME} requires at least two arguments" |
427 |
+ fi |
428 |
+ |
429 |
+ local reason=${1} |
430 |
+ shift |
431 |
+ |
432 |
+ local option |
433 |
+ for option in ${@} ; do |
434 |
+ echo "mk_add_options ${option} # ${reason}" >>${MOZCONFIG} |
435 |
+ done |
436 |
+} |
437 |
+ |
438 |
+mozconfig_use_enable() { |
439 |
+ debug-print-function ${FUNCNAME} "$@" |
440 |
+ |
441 |
+ if [[ ${#} -lt 1 ]] ; then |
442 |
+ die "${FUNCNAME} requires at least one arguments" |
443 |
+ fi |
444 |
+ |
445 |
+ local flag=$(use_enable "${@}") |
446 |
+ mozconfig_add_options_ac "$(use ${1} && echo +${1} || echo -${1})" "${flag}" |
447 |
+} |
448 |
+ |
449 |
+mozconfig_use_with() { |
450 |
+ debug-print-function ${FUNCNAME} "$@" |
451 |
+ |
452 |
+ if [[ ${#} -lt 1 ]] ; then |
453 |
+ die "${FUNCNAME} requires at least one arguments" |
454 |
+ fi |
455 |
+ |
456 |
+ local flag=$(use_with "${@}") |
457 |
+ mozconfig_add_options_ac "$(use ${1} && echo +${1} || echo -${1})" "${flag}" |
458 |
+} |
459 |
+ |
460 |
+pkg_pretend() { |
461 |
+ if [[ ${MERGE_TYPE} != binary ]] ; then |
462 |
+ if use pgo ; then |
463 |
+ if ! has usersandbox $FEATURES ; then |
464 |
+ die "You must enable usersandbox as X server can not run as root!" |
465 |
+ fi |
466 |
+ fi |
467 |
+ |
468 |
+ # Ensure we have enough disk space to compile |
469 |
+ if use pgo || use lto || use debug ; then |
470 |
+ CHECKREQS_DISK_BUILD="13500M" |
471 |
+ else |
472 |
+ CHECKREQS_DISK_BUILD="6600M" |
473 |
+ fi |
474 |
+ |
475 |
+ check-reqs_pkg_pretend |
476 |
+ fi |
477 |
+} |
478 |
+ |
479 |
+pkg_setup() { |
480 |
+ if [[ ${MERGE_TYPE} != binary ]] ; then |
481 |
+ if use pgo ; then |
482 |
+ if ! has userpriv ${FEATURES} ; then |
483 |
+ eerror "Building ${PN} with USE=pgo and FEATURES=-userpriv is not supported!" |
484 |
+ fi |
485 |
+ fi |
486 |
+ |
487 |
+ # Ensure we have enough disk space to compile |
488 |
+ if use pgo || use lto || use debug ; then |
489 |
+ CHECKREQS_DISK_BUILD="13500M" |
490 |
+ else |
491 |
+ CHECKREQS_DISK_BUILD="6400M" |
492 |
+ fi |
493 |
+ |
494 |
+ check-reqs_pkg_setup |
495 |
+ |
496 |
+ llvm_pkg_setup |
497 |
+ |
498 |
+ if use clang && use lto ; then |
499 |
+ local version_lld=$(ld.lld --version 2>/dev/null | awk '{ print $2 }') |
500 |
+ [[ -n ${version_lld} ]] && version_lld=$(ver_cut 1 "${version_lld}") |
501 |
+ [[ -z ${version_lld} ]] && die "Failed to read ld.lld version!" |
502 |
+ |
503 |
+ local version_llvm_rust=$(rustc -Vv 2>/dev/null | grep -F -- 'LLVM version:' | awk '{ print $3 }') |
504 |
+ [[ -n ${version_llvm_rust} ]] && version_llvm_rust=$(ver_cut 1 "${version_llvm_rust}") |
505 |
+ [[ -z ${version_llvm_rust} ]] && die "Failed to read used LLVM version from rustc!" |
506 |
+ |
507 |
+ if ver_test "${version_lld}" -ne "${version_llvm_rust}" ; then |
508 |
+ eerror "Rust is using LLVM version ${version_llvm_rust} but ld.lld version belongs to LLVM version ${version_lld}." |
509 |
+ eerror "You will be unable to link ${CATEGORY}/${PN}. To proceed you have the following options:" |
510 |
+ eerror " - Manually switch rust version using 'eselect rust' to match used LLVM version" |
511 |
+ eerror " - Switch to dev-lang/rust[system-llvm] which will guarantee matching version" |
512 |
+ eerror " - Build ${CATEGORY}/${PN} without USE=lto" |
513 |
+ eerror " - Rebuild lld with llvm that was used to build rust (may need to rebuild the whole " |
514 |
+ eerror " llvm/clang/lld/rust chain depending on your @world updates)" |
515 |
+ die "LLVM version used by Rust (${version_llvm_rust}) does not match with ld.lld version (${version_lld})!" |
516 |
+ fi |
517 |
+ fi |
518 |
+ |
519 |
+ if ! use clang && [[ $(gcc-major-version) -eq 11 ]] \ |
520 |
+ && ! has_version -b ">sys-devel/gcc-11.1.0:11" ; then |
521 |
+ # bug 792705 |
522 |
+ eerror "Using GCC 11 to compile firefox is currently known to be broken (see bug #792705)." |
523 |
+ die "Set USE=clang or select <gcc-11 to build ${CATEGORY}/${P}." |
524 |
+ fi |
525 |
+ |
526 |
+ python-any-r1_pkg_setup |
527 |
+ |
528 |
+ # Avoid PGO profiling problems due to enviroment leakage |
529 |
+ # These should *always* be cleaned up anyway |
530 |
+ unset \ |
531 |
+ DBUS_SESSION_BUS_ADDRESS \ |
532 |
+ DISPLAY \ |
533 |
+ ORBIT_SOCKETDIR \ |
534 |
+ SESSION_MANAGER \ |
535 |
+ XAUTHORITY \ |
536 |
+ XDG_CACHE_HOME \ |
537 |
+ XDG_SESSION_COOKIE |
538 |
+ |
539 |
+ # Build system is using /proc/self/oom_score_adj, bug #604394 |
540 |
+ addpredict /proc/self/oom_score_adj |
541 |
+ |
542 |
+ if use pgo ; then |
543 |
+ # Allow access to GPU during PGO run |
544 |
+ local ati_cards mesa_cards nvidia_cards render_cards |
545 |
+ shopt -s nullglob |
546 |
+ |
547 |
+ ati_cards=$(echo -n /dev/ati/card* | sed 's/ /:/g') |
548 |
+ if [[ -n "${ati_cards}" ]] ; then |
549 |
+ addpredict "${ati_cards}" |
550 |
+ fi |
551 |
+ |
552 |
+ mesa_cards=$(echo -n /dev/dri/card* | sed 's/ /:/g') |
553 |
+ if [[ -n "${mesa_cards}" ]] ; then |
554 |
+ addpredict "${mesa_cards}" |
555 |
+ fi |
556 |
+ |
557 |
+ nvidia_cards=$(echo -n /dev/nvidia* | sed 's/ /:/g') |
558 |
+ if [[ -n "${nvidia_cards}" ]] ; then |
559 |
+ addpredict "${nvidia_cards}" |
560 |
+ fi |
561 |
+ |
562 |
+ render_cards=$(echo -n /dev/dri/renderD128* | sed 's/ /:/g') |
563 |
+ if [[ -n "${render_cards}" ]] ; then |
564 |
+ addpredict "${render_cards}" |
565 |
+ fi |
566 |
+ |
567 |
+ shopt -u nullglob |
568 |
+ fi |
569 |
+ |
570 |
+ if ! mountpoint -q /dev/shm ; then |
571 |
+ # If /dev/shm is not available, configure is known to fail with |
572 |
+ # a traceback report referencing /usr/lib/pythonN.N/multiprocessing/synchronize.py |
573 |
+ ewarn "/dev/shm is not mounted -- expect build failures!" |
574 |
+ fi |
575 |
+ |
576 |
+ # Google API keys (see http://www.chromium.org/developers/how-tos/api-keys) |
577 |
+ # Note: These are for Gentoo Linux use ONLY. For your own distribution, please |
578 |
+ # get your own set of keys. |
579 |
+ if [[ -z "${MOZ_API_KEY_GOOGLE+set}" ]] ; then |
580 |
+ MOZ_API_KEY_GOOGLE="AIzaSyDEAOvatFogGaPi0eTgsV_ZlEzx0ObmepsMzfAc" |
581 |
+ fi |
582 |
+ |
583 |
+ if [[ -z "${MOZ_API_KEY_LOCATION+set}" ]] ; then |
584 |
+ MOZ_API_KEY_LOCATION="AIzaSyB2h2OuRgGaPicUgy5N-5hsZqiPW6sH3n_rptiQ" |
585 |
+ fi |
586 |
+ |
587 |
+ # Mozilla API keys (see https://location.services.mozilla.com/api) |
588 |
+ # Note: These are for Gentoo Linux use ONLY. For your own distribution, please |
589 |
+ # get your own set of keys. |
590 |
+ if [[ -z "${MOZ_API_KEY_MOZILLA+set}" ]] ; then |
591 |
+ MOZ_API_KEY_MOZILLA="edb3d487-3a84-46m0ap1e3-9dfd-92b5efaaa005" |
592 |
+ fi |
593 |
+ |
594 |
+ # Ensure we use C locale when building, bug #746215 |
595 |
+ export LC_ALL=C |
596 |
+ fi |
597 |
+ |
598 |
+ CONFIG_CHECK="~SECCOMP" |
599 |
+ WARNING_SECCOMP="CONFIG_SECCOMP not set! This system will be unable to play DRM-protected content." |
600 |
+ linux-info_pkg_setup |
601 |
+} |
602 |
+ |
603 |
+src_unpack() { |
604 |
+ local _lp_dir="${WORKDIR}/language_packs" |
605 |
+ local _src_file |
606 |
+ |
607 |
+ if [[ ! -d "${_lp_dir}" ]] ; then |
608 |
+ mkdir "${_lp_dir}" || die |
609 |
+ fi |
610 |
+ |
611 |
+ for _src_file in ${A} ; do |
612 |
+ if [[ ${_src_file} == *.xpi ]]; then |
613 |
+ cp "${DISTDIR}/${_src_file}" "${_lp_dir}" || die "Failed to copy '${_src_file}' to '${_lp_dir}'!" |
614 |
+ else |
615 |
+ unpack ${_src_file} |
616 |
+ fi |
617 |
+ done |
618 |
+} |
619 |
+ |
620 |
+src_prepare() { |
621 |
+ use lto && rm -v "${WORKDIR}"/firefox-patches/*-LTO-Only-enable-LTO-*.patch |
622 |
+ eapply "${WORKDIR}/firefox-patches" |
623 |
+ |
624 |
+ # Allow user to apply any additional patches without modifing ebuild |
625 |
+ eapply_user |
626 |
+ |
627 |
+ # Make cargo respect MAKEOPTS |
628 |
+ export CARGO_BUILD_JOBS="$(makeopts_jobs)" |
629 |
+ |
630 |
+ # Make LTO respect MAKEOPTS |
631 |
+ sed -i \ |
632 |
+ -e "s/multiprocessing.cpu_count()/$(makeopts_jobs)/" \ |
633 |
+ "${S}"/build/moz.configure/lto-pgo.configure \ |
634 |
+ || die "sed failed to set num_cores" |
635 |
+ |
636 |
+ # Make ICU respect MAKEOPTS |
637 |
+ sed -i \ |
638 |
+ -e "s/multiprocessing.cpu_count()/$(makeopts_jobs)/" \ |
639 |
+ "${S}"/intl/icu_sources_data.py \ |
640 |
+ || die "sed failed to set num_cores" |
641 |
+ |
642 |
+ # sed-in toolchain prefix |
643 |
+ sed -i \ |
644 |
+ -e "s/objdump/${CHOST}-objdump/" \ |
645 |
+ "${S}"/python/mozbuild/mozbuild/configure/check_debug_ranges.py \ |
646 |
+ || die "sed failed to set toolchain prefix" |
647 |
+ |
648 |
+ sed -i \ |
649 |
+ -e 's/ccache_stats = None/return None/' \ |
650 |
+ "${S}"/python/mozbuild/mozbuild/controller/building.py \ |
651 |
+ || die "sed failed to disable ccache stats call" |
652 |
+ |
653 |
+ einfo "Removing pre-built binaries ..." |
654 |
+ find "${S}"/third_party -type f \( -name '*.so' -o -name '*.o' \) -print -delete || die |
655 |
+ |
656 |
+ # Clearing checksums where we have applied patches |
657 |
+ moz_clear_vendor_checksums target-lexicon-0.9.0 |
658 |
+ |
659 |
+ # Create build dir |
660 |
+ BUILD_DIR="${WORKDIR}/${PN}_build" |
661 |
+ mkdir -p "${BUILD_DIR}" || die |
662 |
+ |
663 |
+ # Write API keys to disk |
664 |
+ echo -n "${MOZ_API_KEY_GOOGLE//gGaPi/}" > "${S}"/api-google.key || die |
665 |
+ echo -n "${MOZ_API_KEY_LOCATION//gGaPi/}" > "${S}"/api-location.key || die |
666 |
+ echo -n "${MOZ_API_KEY_MOZILLA//m0ap1/}" > "${S}"/api-mozilla.key || die |
667 |
+ |
668 |
+ xdg_environment_reset |
669 |
+} |
670 |
+ |
671 |
+src_configure() { |
672 |
+ # Show flags set at the beginning |
673 |
+ einfo "Current BINDGEN_CFLAGS:\t${BINDGEN_CFLAGS:-no value set}" |
674 |
+ einfo "Current CFLAGS:\t\t${CFLAGS:-no value set}" |
675 |
+ einfo "Current CXXFLAGS:\t\t${CXXFLAGS:-no value set}" |
676 |
+ einfo "Current LDFLAGS:\t\t${LDFLAGS:-no value set}" |
677 |
+ einfo "Current RUSTFLAGS:\t\t${RUSTFLAGS:-no value set}" |
678 |
+ |
679 |
+ local have_switched_compiler= |
680 |
+ if use clang && ! tc-is-clang ; then |
681 |
+ # Force clang |
682 |
+ einfo "Enforcing the use of clang due to USE=clang ..." |
683 |
+ have_switched_compiler=yes |
684 |
+ AR=llvm-ar |
685 |
+ AS=llvm-as |
686 |
+ CC=${CHOST}-clang |
687 |
+ CXX=${CHOST}-clang++ |
688 |
+ NM=llvm-nm |
689 |
+ RANLIB=llvm-ranlib |
690 |
+ elif ! use clang && ! tc-is-gcc ; then |
691 |
+ # Force gcc |
692 |
+ have_switched_compiler=yes |
693 |
+ einfo "Enforcing the use of gcc due to USE=-clang ..." |
694 |
+ AR=gcc-ar |
695 |
+ CC=${CHOST}-gcc |
696 |
+ CXX=${CHOST}-g++ |
697 |
+ NM=gcc-nm |
698 |
+ RANLIB=gcc-ranlib |
699 |
+ fi |
700 |
+ |
701 |
+ if [[ -n "${have_switched_compiler}" ]] ; then |
702 |
+ # Because we switched active compiler we have to ensure |
703 |
+ # that no unsupported flags are set |
704 |
+ strip-unsupported-flags |
705 |
+ fi |
706 |
+ |
707 |
+ # Ensure we use correct toolchain |
708 |
+ export HOST_CC="$(tc-getBUILD_CC)" |
709 |
+ export HOST_CXX="$(tc-getBUILD_CXX)" |
710 |
+ tc-export CC CXX LD AR NM OBJDUMP RANLIB PKG_CONFIG |
711 |
+ |
712 |
+ # Pass the correct toolchain paths through cbindgen |
713 |
+ if tc-is-cross-compiler ; then |
714 |
+ export BINDGEN_CFLAGS="${SYSROOT:+--sysroot=${ESYSROOT}} --target=${CHOST} ${BINDGEN_CFLAGS-}" |
715 |
+ fi |
716 |
+ |
717 |
+ # Set MOZILLA_FIVE_HOME |
718 |
+ export MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}" |
719 |
+ |
720 |
+ # python/mach/mach/mixin/process.py fails to detect SHELL |
721 |
+ export SHELL="${EPREFIX}/bin/bash" |
722 |
+ |
723 |
+ # Set state path |
724 |
+ export MOZBUILD_STATE_PATH="${BUILD_DIR}" |
725 |
+ |
726 |
+ # Set MOZCONFIG |
727 |
+ export MOZCONFIG="${S}/.mozconfig" |
728 |
+ |
729 |
+ # Initialize MOZCONFIG |
730 |
+ mozconfig_add_options_ac '' --enable-application=browser |
731 |
+ |
732 |
+ # Set Gentoo defaults |
733 |
+ export MOZILLA_OFFICIAL=1 |
734 |
+ |
735 |
+ mozconfig_add_options_ac 'Gentoo default' \ |
736 |
+ --allow-addon-sideload \ |
737 |
+ --disable-cargo-incremental \ |
738 |
+ --disable-crashreporter \ |
739 |
+ --disable-gpsd \ |
740 |
+ --disable-install-strip \ |
741 |
+ --disable-parental-controls \ |
742 |
+ --disable-strip \ |
743 |
+ --disable-updater \ |
744 |
+ --enable-negotiateauth \ |
745 |
+ --enable-new-pass-manager \ |
746 |
+ --enable-official-branding \ |
747 |
+ --enable-release \ |
748 |
+ --enable-system-ffi \ |
749 |
+ --enable-system-pixman \ |
750 |
+ --host="${CBUILD:-${CHOST}}" \ |
751 |
+ --libdir="${EPREFIX}/usr/$(get_libdir)" \ |
752 |
+ --prefix="${EPREFIX}/usr" \ |
753 |
+ --target="${CHOST}" \ |
754 |
+ --without-ccache \ |
755 |
+ --without-wasm-sandboxed-libraries \ |
756 |
+ --with-intl-api \ |
757 |
+ --with-libclang-path="$(llvm-config --libdir)" \ |
758 |
+ --with-system-nspr \ |
759 |
+ --with-system-nss \ |
760 |
+ --with-system-zlib \ |
761 |
+ --with-toolchain-prefix="${CHOST}-" \ |
762 |
+ --with-unsigned-addon-scopes=app,system \ |
763 |
+ --x-includes="${ESYSROOT}/usr/include" \ |
764 |
+ --x-libraries="${ESYSROOT}/usr/$(get_libdir)" |
765 |
+ |
766 |
+ # Set update channel |
767 |
+ local update_channel=release |
768 |
+ [[ -n ${MOZ_ESR} ]] && update_channel=esr |
769 |
+ mozconfig_add_options_ac '' --update-channel=${update_channel} |
770 |
+ |
771 |
+ if ! use x86 && [[ ${CHOST} != armv*h* ]] ; then |
772 |
+ mozconfig_add_options_ac '' --enable-rust-simd |
773 |
+ fi |
774 |
+ |
775 |
+ # For future keywording: This is currently (97.0) only supported on: |
776 |
+ # amd64, arm, arm64 & x86. |
777 |
+ # Might want to flip the logic around if Firefox is to support more arches. |
778 |
+ if use ppc64; then |
779 |
+ mozconfig_add_options_ac '' --disable-sandbox |
780 |
+ else |
781 |
+ mozconfig_add_options_ac '' --enable-sandbox |
782 |
+ fi |
783 |
+ |
784 |
+ if [[ -s "${S}/api-google.key" ]] ; then |
785 |
+ local key_origin="Gentoo default" |
786 |
+ if [[ $(cat "${S}/api-google.key" | md5sum | awk '{ print $1 }') != 709560c02f94b41f9ad2c49207be6c54 ]] ; then |
787 |
+ key_origin="User value" |
788 |
+ fi |
789 |
+ |
790 |
+ mozconfig_add_options_ac "${key_origin}" \ |
791 |
+ --with-google-safebrowsing-api-keyfile="${S}/api-google.key" |
792 |
+ else |
793 |
+ einfo "Building without Google API key ..." |
794 |
+ fi |
795 |
+ |
796 |
+ if [[ -s "${S}/api-location.key" ]] ; then |
797 |
+ local key_origin="Gentoo default" |
798 |
+ if [[ $(cat "${S}/api-location.key" | md5sum | awk '{ print $1 }') != ffb7895e35dedf832eb1c5d420ac7420 ]] ; then |
799 |
+ key_origin="User value" |
800 |
+ fi |
801 |
+ |
802 |
+ mozconfig_add_options_ac "${key_origin}" \ |
803 |
+ --with-google-location-service-api-keyfile="${S}/api-location.key" |
804 |
+ else |
805 |
+ einfo "Building without Location API key ..." |
806 |
+ fi |
807 |
+ |
808 |
+ if [[ -s "${S}/api-mozilla.key" ]] ; then |
809 |
+ local key_origin="Gentoo default" |
810 |
+ if [[ $(cat "${S}/api-mozilla.key" | md5sum | awk '{ print $1 }') != 3927726e9442a8e8fa0e46ccc39caa27 ]] ; then |
811 |
+ key_origin="User value" |
812 |
+ fi |
813 |
+ |
814 |
+ mozconfig_add_options_ac "${key_origin}" \ |
815 |
+ --with-mozilla-api-keyfile="${S}/api-mozilla.key" |
816 |
+ else |
817 |
+ einfo "Building without Mozilla API key ..." |
818 |
+ fi |
819 |
+ |
820 |
+ mozconfig_use_with system-av1 |
821 |
+ mozconfig_use_with system-harfbuzz |
822 |
+ mozconfig_use_with system-harfbuzz system-graphite2 |
823 |
+ mozconfig_use_with system-icu |
824 |
+ mozconfig_use_with system-jpeg |
825 |
+ mozconfig_use_with system-libevent |
826 |
+ mozconfig_use_with system-libvpx |
827 |
+ mozconfig_use_with system-png |
828 |
+ mozconfig_use_with system-webp |
829 |
+ |
830 |
+ mozconfig_use_enable dbus |
831 |
+ mozconfig_use_enable libproxy |
832 |
+ |
833 |
+ use eme-free && mozconfig_add_options_ac '+eme-free' --disable-eme |
834 |
+ |
835 |
+ mozconfig_use_enable geckodriver |
836 |
+ |
837 |
+ if use hardened ; then |
838 |
+ mozconfig_add_options_ac "+hardened" --enable-hardening |
839 |
+ append-ldflags "-Wl,-z,relro -Wl,-z,now" |
840 |
+ fi |
841 |
+ |
842 |
+ local myaudiobackends="" |
843 |
+ use jack && myaudiobackends+="jack," |
844 |
+ use sndio && myaudiobackends+="sndio," |
845 |
+ use pulseaudio && myaudiobackends+="pulseaudio," |
846 |
+ ! use pulseaudio && myaudiobackends+="alsa," |
847 |
+ |
848 |
+ mozconfig_add_options_ac '--enable-audio-backends' --enable-audio-backends="${myaudiobackends::-1}" |
849 |
+ |
850 |
+ mozconfig_use_enable wifi necko-wifi |
851 |
+ |
852 |
+ if use X && use wayland ; then |
853 |
+ mozconfig_add_options_ac '+x11+wayland' --enable-default-toolkit=cairo-gtk3-x11-wayland |
854 |
+ elif ! use X && use wayland ; then |
855 |
+ mozconfig_add_options_ac '+wayland' --enable-default-toolkit=cairo-gtk3-wayland-only |
856 |
+ else |
857 |
+ mozconfig_add_options_ac '+x11' --enable-default-toolkit=cairo-gtk3 |
858 |
+ fi |
859 |
+ |
860 |
+ if use lto ; then |
861 |
+ if use clang ; then |
862 |
+ # Upstream only supports lld when using clang |
863 |
+ mozconfig_add_options_ac "forcing ld=lld due to USE=clang and USE=lto" --enable-linker=lld |
864 |
+ |
865 |
+ mozconfig_add_options_ac '+lto' --enable-lto=cross |
866 |
+ |
867 |
+ else |
868 |
+ # ThinLTO is currently broken, see bmo#1644409 |
869 |
+ mozconfig_add_options_ac '+lto' --enable-lto=full |
870 |
+ mozconfig_add_options_ac "linker is set to bfd" --enable-linker=bfd |
871 |
+ fi |
872 |
+ |
873 |
+ if use pgo ; then |
874 |
+ mozconfig_add_options_ac '+pgo' MOZ_PGO=1 |
875 |
+ |
876 |
+ if use clang ; then |
877 |
+ # Used in build/pgo/profileserver.py |
878 |
+ export LLVM_PROFDATA="llvm-profdata" |
879 |
+ fi |
880 |
+ fi |
881 |
+ else |
882 |
+ # Avoid auto-magic on linker |
883 |
+ if use clang ; then |
884 |
+ # This is upstream's default |
885 |
+ mozconfig_add_options_ac "forcing ld=lld due to USE=clang" --enable-linker=lld |
886 |
+ else |
887 |
+ mozconfig_add_options_ac "linker is set to bfd" --enable-linker=bfd |
888 |
+ fi |
889 |
+ fi |
890 |
+ |
891 |
+ # LTO flag was handled via configure |
892 |
+ filter-flags '-flto*' |
893 |
+ |
894 |
+ mozconfig_use_enable debug |
895 |
+ if use debug ; then |
896 |
+ mozconfig_add_options_ac '+debug' --disable-optimize |
897 |
+ else |
898 |
+ if is-flag '-g*' ; then |
899 |
+ if use clang ; then |
900 |
+ mozconfig_add_options_ac 'from CFLAGS' --enable-debug-symbols=$(get-flag '-g*') |
901 |
+ else |
902 |
+ mozconfig_add_options_ac 'from CFLAGS' --enable-debug-symbols |
903 |
+ fi |
904 |
+ else |
905 |
+ mozconfig_add_options_ac 'Gentoo default' --disable-debug-symbols |
906 |
+ fi |
907 |
+ |
908 |
+ if is-flag '-O0' ; then |
909 |
+ mozconfig_add_options_ac "from CFLAGS" --enable-optimize=-O0 |
910 |
+ elif is-flag '-O4' ; then |
911 |
+ mozconfig_add_options_ac "from CFLAGS" --enable-optimize=-O4 |
912 |
+ elif is-flag '-O3' ; then |
913 |
+ mozconfig_add_options_ac "from CFLAGS" --enable-optimize=-O3 |
914 |
+ elif is-flag '-O1' ; then |
915 |
+ mozconfig_add_options_ac "from CFLAGS" --enable-optimize=-O1 |
916 |
+ elif is-flag '-Os' ; then |
917 |
+ mozconfig_add_options_ac "from CFLAGS" --enable-optimize=-Os |
918 |
+ else |
919 |
+ mozconfig_add_options_ac "Gentoo default" --enable-optimize=-O2 |
920 |
+ fi |
921 |
+ fi |
922 |
+ |
923 |
+ # Debug flag was handled via configure |
924 |
+ filter-flags '-g*' |
925 |
+ |
926 |
+ # Optimization flag was handled via configure |
927 |
+ filter-flags '-O*' |
928 |
+ |
929 |
+ # Modifications to better support ARM, bug #553364 |
930 |
+ if use cpu_flags_arm_neon ; then |
931 |
+ mozconfig_add_options_ac '+cpu_flags_arm_neon' --with-fpu=neon |
932 |
+ |
933 |
+ if ! tc-is-clang ; then |
934 |
+ # thumb options aren't supported when using clang, bug 666966 |
935 |
+ mozconfig_add_options_ac '+cpu_flags_arm_neon' \ |
936 |
+ --with-thumb=yes \ |
937 |
+ --with-thumb-interwork=no |
938 |
+ fi |
939 |
+ fi |
940 |
+ |
941 |
+ if [[ ${CHOST} == armv*h* ]] ; then |
942 |
+ mozconfig_add_options_ac 'CHOST=armv*h*' --with-float-abi=hard |
943 |
+ |
944 |
+ if ! use system-libvpx ; then |
945 |
+ sed -i \ |
946 |
+ -e "s|softfp|hard|" \ |
947 |
+ "${S}"/media/libvpx/moz.build \ |
948 |
+ || die |
949 |
+ fi |
950 |
+ fi |
951 |
+ |
952 |
+ if use clang ; then |
953 |
+ # https://bugzilla.mozilla.org/show_bug.cgi?id=1482204 |
954 |
+ # https://bugzilla.mozilla.org/show_bug.cgi?id=1483822 |
955 |
+ # toolkit/moz.configure Elfhack section: target.cpu in ('arm', 'x86', 'x86_64') |
956 |
+ local disable_elf_hack= |
957 |
+ if use amd64 ; then |
958 |
+ disable_elf_hack=yes |
959 |
+ elif use x86 ; then |
960 |
+ disable_elf_hack=yes |
961 |
+ elif use arm ; then |
962 |
+ disable_elf_hack=yes |
963 |
+ fi |
964 |
+ |
965 |
+ if [[ -n ${disable_elf_hack} ]] ; then |
966 |
+ mozconfig_add_options_ac 'elf-hack is broken when using Clang' --disable-elf-hack |
967 |
+ fi |
968 |
+ elif tc-is-gcc ; then |
969 |
+ if ver_test $(gcc-fullversion) -ge 10 ; then |
970 |
+ einfo "Forcing -fno-tree-loop-vectorize to workaround GCC bug, see bug 758446 ..." |
971 |
+ append-cxxflags -fno-tree-loop-vectorize |
972 |
+ fi |
973 |
+ fi |
974 |
+ |
975 |
+ # Additional ARCH support |
976 |
+ case "${ARCH}" in |
977 |
+ arm) |
978 |
+ # Reduce the memory requirements for linking |
979 |
+ if use clang ; then |
980 |
+ # Nothing to do |
981 |
+ :; |
982 |
+ elif use lto ; then |
983 |
+ append-ldflags -Wl,--no-keep-memory |
984 |
+ else |
985 |
+ append-ldflags -Wl,--no-keep-memory -Wl,--reduce-memory-overheads |
986 |
+ fi |
987 |
+ ;; |
988 |
+ esac |
989 |
+ |
990 |
+ if ! use elibc_glibc ; then |
991 |
+ mozconfig_add_options_ac '!elibc_glibc' --disable-jemalloc |
992 |
+ fi |
993 |
+ |
994 |
+ # Allow elfhack to work in combination with unstripped binaries |
995 |
+ # when they would normally be larger than 2GiB. |
996 |
+ append-ldflags "-Wl,--compress-debug-sections=zlib" |
997 |
+ |
998 |
+ # Make revdep-rebuild.sh happy; Also required for musl |
999 |
+ append-ldflags -Wl,-rpath="${MOZILLA_FIVE_HOME}",--enable-new-dtags |
1000 |
+ |
1001 |
+ # Pass $MAKEOPTS to build system |
1002 |
+ export MOZ_MAKE_FLAGS="${MAKEOPTS}" |
1003 |
+ |
1004 |
+ # Use system's Python environment |
1005 |
+ PIP_NETWORK_INSTALL_RESTRICTED_VIRTUALENVS=mach |
1006 |
+ |
1007 |
+ if use system-python-libs; then |
1008 |
+ export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE="system" |
1009 |
+ else |
1010 |
+ export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE="none" |
1011 |
+ fi |
1012 |
+ |
1013 |
+ # Disable notification when build system has finished |
1014 |
+ export MOZ_NOSPAM=1 |
1015 |
+ |
1016 |
+ # Portage sets XARGS environment variable to "xargs -r" by default which |
1017 |
+ # breaks build system's check_prog() function which doesn't support arguments |
1018 |
+ mozconfig_add_options_ac 'Gentoo default' "XARGS=${EPREFIX}/usr/bin/xargs" |
1019 |
+ |
1020 |
+ # Set build dir |
1021 |
+ mozconfig_add_options_mk 'Gentoo default' "MOZ_OBJDIR=${BUILD_DIR}" |
1022 |
+ |
1023 |
+ # Show flags we will use |
1024 |
+ einfo "Build BINDGEN_CFLAGS:\t${BINDGEN_CFLAGS:-no value set}" |
1025 |
+ einfo "Build CFLAGS:\t\t${CFLAGS:-no value set}" |
1026 |
+ einfo "Build CXXFLAGS:\t\t${CXXFLAGS:-no value set}" |
1027 |
+ einfo "Build LDFLAGS:\t\t${LDFLAGS:-no value set}" |
1028 |
+ einfo "Build RUSTFLAGS:\t\t${RUSTFLAGS:-no value set}" |
1029 |
+ |
1030 |
+ # Handle EXTRA_CONF and show summary |
1031 |
+ local ac opt hash reason |
1032 |
+ |
1033 |
+ # Apply EXTRA_ECONF entries to $MOZCONFIG |
1034 |
+ if [[ -n ${EXTRA_ECONF} ]] ; then |
1035 |
+ IFS=\! read -a ac <<<${EXTRA_ECONF// --/\!} |
1036 |
+ for opt in "${ac[@]}"; do |
1037 |
+ mozconfig_add_options_ac "EXTRA_ECONF" --${opt#--} |
1038 |
+ done |
1039 |
+ fi |
1040 |
+ |
1041 |
+ echo |
1042 |
+ echo "==========================================================" |
1043 |
+ echo "Building ${PF} with the following configuration" |
1044 |
+ grep ^ac_add_options "${MOZCONFIG}" | while read ac opt hash reason; do |
1045 |
+ [[ -z ${hash} || ${hash} == \# ]] \ |
1046 |
+ || die "error reading mozconfig: ${ac} ${opt} ${hash} ${reason}" |
1047 |
+ printf " %-30s %s\n" "${opt}" "${reason:-mozilla.org default}" |
1048 |
+ done |
1049 |
+ echo "==========================================================" |
1050 |
+ echo |
1051 |
+ |
1052 |
+ ./mach configure || die |
1053 |
+} |
1054 |
+ |
1055 |
+src_compile() { |
1056 |
+ local virtx_cmd= |
1057 |
+ |
1058 |
+ if use pgo ; then |
1059 |
+ virtx_cmd=virtx |
1060 |
+ |
1061 |
+ # Reset and cleanup environment variables used by GNOME/XDG |
1062 |
+ gnome2_environment_reset |
1063 |
+ |
1064 |
+ addpredict /root |
1065 |
+ fi |
1066 |
+ |
1067 |
+ if ! use X && use wayland; then |
1068 |
+ local -x GDK_BACKEND=wayland |
1069 |
+ else |
1070 |
+ local -x GDK_BACKEND=x11 |
1071 |
+ fi |
1072 |
+ |
1073 |
+ ${virtx_cmd} ./mach build --verbose \ |
1074 |
+ || die |
1075 |
+} |
1076 |
+ |
1077 |
+src_install() { |
1078 |
+ # xpcshell is getting called during install |
1079 |
+ pax-mark m \ |
1080 |
+ "${BUILD_DIR}"/dist/bin/xpcshell \ |
1081 |
+ "${BUILD_DIR}"/dist/bin/${PN} \ |
1082 |
+ "${BUILD_DIR}"/dist/bin/plugin-container |
1083 |
+ |
1084 |
+ DESTDIR="${D}" ./mach install || die |
1085 |
+ |
1086 |
+ # Upstream cannot ship symlink but we can (bmo#658850) |
1087 |
+ rm "${ED}${MOZILLA_FIVE_HOME}/${PN}-bin" || die |
1088 |
+ dosym ${PN} ${MOZILLA_FIVE_HOME}/${PN}-bin |
1089 |
+ |
1090 |
+ # Don't install llvm-symbolizer from sys-devel/llvm package |
1091 |
+ if [[ -f "${ED}${MOZILLA_FIVE_HOME}/llvm-symbolizer" ]] ; then |
1092 |
+ rm -v "${ED}${MOZILLA_FIVE_HOME}/llvm-symbolizer" || die |
1093 |
+ fi |
1094 |
+ |
1095 |
+ # Install policy (currently only used to disable application updates) |
1096 |
+ insinto "${MOZILLA_FIVE_HOME}/distribution" |
1097 |
+ newins "${FILESDIR}"/distribution.ini distribution.ini |
1098 |
+ newins "${FILESDIR}"/disable-auto-update.policy.json policies.json |
1099 |
+ |
1100 |
+ # Install system-wide preferences |
1101 |
+ local PREFS_DIR="${MOZILLA_FIVE_HOME}/browser/defaults/preferences" |
1102 |
+ insinto "${PREFS_DIR}" |
1103 |
+ newins "${FILESDIR}"/gentoo-default-prefs.js gentoo-prefs.js |
1104 |
+ |
1105 |
+ local GENTOO_PREFS="${ED}${PREFS_DIR}/gentoo-prefs.js" |
1106 |
+ |
1107 |
+ # Set dictionary path to use system hunspell |
1108 |
+ cat >>"${GENTOO_PREFS}" <<-EOF || die "failed to set spellchecker.dictionary_path pref" |
1109 |
+ pref("spellchecker.dictionary_path", "${EPREFIX}/usr/share/myspell"); |
1110 |
+ EOF |
1111 |
+ |
1112 |
+ # Force hwaccel prefs if USE=hwaccel is enabled |
1113 |
+ if use hwaccel ; then |
1114 |
+ cat "${FILESDIR}"/gentoo-hwaccel-prefs.js-r1 \ |
1115 |
+ >>"${GENTOO_PREFS}" \ |
1116 |
+ || die "failed to add prefs to force hardware-accelerated rendering to all-gentoo.js" |
1117 |
+ fi |
1118 |
+ |
1119 |
+ if ! use gmp-autoupdate ; then |
1120 |
+ local plugin |
1121 |
+ for plugin in "${MOZ_GMP_PLUGIN_LIST[@]}" ; do |
1122 |
+ einfo "Disabling auto-update for ${plugin} plugin ..." |
1123 |
+ cat >>"${GENTOO_PREFS}" <<-EOF || die "failed to disable autoupdate for ${plugin} media plugin" |
1124 |
+ pref("media.${plugin}.autoupdate", false); |
1125 |
+ EOF |
1126 |
+ done |
1127 |
+ fi |
1128 |
+ |
1129 |
+ # Force the graphite pref if USE=system-harfbuzz is enabled, since the pref cannot disable it |
1130 |
+ if use system-harfbuzz ; then |
1131 |
+ cat >>"${GENTOO_PREFS}" <<-EOF || die "failed to set gfx.font_rendering.graphite.enabled pref" |
1132 |
+ sticky_pref("gfx.font_rendering.graphite.enabled", true); |
1133 |
+ EOF |
1134 |
+ fi |
1135 |
+ |
1136 |
+ # Install language packs |
1137 |
+ local langpacks=( $(find "${WORKDIR}/language_packs" -type f -name '*.xpi') ) |
1138 |
+ if [[ -n "${langpacks}" ]] ; then |
1139 |
+ moz_install_xpi "${MOZILLA_FIVE_HOME}/distribution/extensions" "${langpacks[@]}" |
1140 |
+ fi |
1141 |
+ |
1142 |
+ # Install geckodriver |
1143 |
+ if use geckodriver ; then |
1144 |
+ einfo "Installing geckodriver into ${ED}${MOZILLA_FIVE_HOME} ..." |
1145 |
+ pax-mark m "${BUILD_DIR}"/dist/bin/geckodriver |
1146 |
+ exeinto "${MOZILLA_FIVE_HOME}" |
1147 |
+ doexe "${BUILD_DIR}"/dist/bin/geckodriver |
1148 |
+ |
1149 |
+ dosym ${MOZILLA_FIVE_HOME}/geckodriver /usr/bin/geckodriver |
1150 |
+ fi |
1151 |
+ |
1152 |
+ # Install icons |
1153 |
+ local icon_srcdir="${S}/browser/branding/official" |
1154 |
+ local icon_symbolic_file="${FILESDIR}/icon/firefox-symbolic.svg" |
1155 |
+ |
1156 |
+ insinto /usr/share/icons/hicolor/symbolic/apps |
1157 |
+ newins "${icon_symbolic_file}" ${PN}-symbolic.svg |
1158 |
+ |
1159 |
+ local icon size |
1160 |
+ for icon in "${icon_srcdir}"/default*.png ; do |
1161 |
+ size=${icon%.png} |
1162 |
+ size=${size##*/default} |
1163 |
+ |
1164 |
+ if [[ ${size} -eq 48 ]] ; then |
1165 |
+ newicon "${icon}" ${PN}.png |
1166 |
+ fi |
1167 |
+ |
1168 |
+ newicon -s ${size} "${icon}" ${PN}.png |
1169 |
+ done |
1170 |
+ |
1171 |
+ # Install menu |
1172 |
+ local app_name="Mozilla ${MOZ_PN^}" |
1173 |
+ local desktop_file="${FILESDIR}/icon/${PN}-r3.desktop" |
1174 |
+ local desktop_filename="${PN}.desktop" |
1175 |
+ local exec_command="${PN}" |
1176 |
+ local icon="${PN}" |
1177 |
+ local use_wayland="false" |
1178 |
+ |
1179 |
+ if use wayland ; then |
1180 |
+ use_wayland="true" |
1181 |
+ fi |
1182 |
+ |
1183 |
+ cp "${desktop_file}" "${WORKDIR}/${PN}.desktop-template" || die |
1184 |
+ |
1185 |
+ sed -i \ |
1186 |
+ -e "s:@NAME@:${app_name}:" \ |
1187 |
+ -e "s:@EXEC@:${exec_command}:" \ |
1188 |
+ -e "s:@ICON@:${icon}:" \ |
1189 |
+ "${WORKDIR}/${PN}.desktop-template" \ |
1190 |
+ || die |
1191 |
+ |
1192 |
+ newmenu "${WORKDIR}/${PN}.desktop-template" "${desktop_filename}" |
1193 |
+ |
1194 |
+ rm "${WORKDIR}/${PN}.desktop-template" || die |
1195 |
+ |
1196 |
+ # Install wrapper script |
1197 |
+ [[ -f "${ED}/usr/bin/${PN}" ]] && rm "${ED}/usr/bin/${PN}" |
1198 |
+ newbin "${FILESDIR}/${PN}-r1.sh" ${PN} |
1199 |
+ |
1200 |
+ # Update wrapper |
1201 |
+ sed -i \ |
1202 |
+ -e "s:@PREFIX@:${EPREFIX}/usr:" \ |
1203 |
+ -e "s:@MOZ_FIVE_HOME@:${MOZILLA_FIVE_HOME}:" \ |
1204 |
+ -e "s:@APULSELIB_DIR@:${apulselib}:" \ |
1205 |
+ -e "s:@DEFAULT_WAYLAND@:${use_wayland}:" \ |
1206 |
+ "${ED}/usr/bin/${PN}" \ |
1207 |
+ || die |
1208 |
+} |
1209 |
+ |
1210 |
+pkg_preinst() { |
1211 |
+ xdg_pkg_preinst |
1212 |
+ |
1213 |
+ # If the apulse libs are available in MOZILLA_FIVE_HOME then apulse |
1214 |
+ # does not need to be forced into the LD_LIBRARY_PATH |
1215 |
+ if use pulseaudio && has_version ">=media-sound/apulse-0.1.12-r4" ; then |
1216 |
+ einfo "APULSE found; Generating library symlinks for sound support ..." |
1217 |
+ local lib |
1218 |
+ pushd "${ED}${MOZILLA_FIVE_HOME}" &>/dev/null || die |
1219 |
+ for lib in ../apulse/libpulse{.so{,.0},-simple.so{,.0}} ; do |
1220 |
+ # A quickpkg rolled by hand will grab symlinks as part of the package, |
1221 |
+ # so we need to avoid creating them if they already exist. |
1222 |
+ if [[ ! -L ${lib##*/} ]] ; then |
1223 |
+ ln -s "${lib}" ${lib##*/} || die |
1224 |
+ fi |
1225 |
+ done |
1226 |
+ popd &>/dev/null || die |
1227 |
+ fi |
1228 |
+} |
1229 |
+ |
1230 |
+pkg_postinst() { |
1231 |
+ xdg_pkg_postinst |
1232 |
+ |
1233 |
+ if ! use gmp-autoupdate ; then |
1234 |
+ elog "USE='-gmp-autoupdate' has disabled the following plugins from updating or" |
1235 |
+ elog "installing into new profiles:" |
1236 |
+ local plugin |
1237 |
+ for plugin in "${MOZ_GMP_PLUGIN_LIST[@]}" ; do |
1238 |
+ elog "\t ${plugin}" |
1239 |
+ done |
1240 |
+ elog |
1241 |
+ fi |
1242 |
+ |
1243 |
+ if use pulseaudio && has_version ">=media-sound/apulse-0.1.12-r4" ; then |
1244 |
+ elog "Apulse was detected at merge time on this system and so it will always be" |
1245 |
+ elog "used for sound. If you wish to use pulseaudio instead please unmerge" |
1246 |
+ elog "media-sound/apulse." |
1247 |
+ elog |
1248 |
+ fi |
1249 |
+ |
1250 |
+ local show_doh_information |
1251 |
+ local show_normandy_information |
1252 |
+ local show_shortcut_information |
1253 |
+ |
1254 |
+ if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
1255 |
+ # New install; Tell user that DoH is disabled by default |
1256 |
+ show_doh_information=yes |
1257 |
+ show_normandy_information=yes |
1258 |
+ show_shortcut_information=no |
1259 |
+ else |
1260 |
+ local replacing_version |
1261 |
+ for replacing_version in ${REPLACING_VERSIONS} ; do |
1262 |
+ if ver_test "${replacing_version}" -lt 91.0 ; then |
1263 |
+ # Tell user that we no longer install a shortcut |
1264 |
+ # per supported display protocol |
1265 |
+ show_shortcut_information=yes |
1266 |
+ fi |
1267 |
+ done |
1268 |
+ fi |
1269 |
+ |
1270 |
+ if [[ -n "${show_doh_information}" ]] ; then |
1271 |
+ elog |
1272 |
+ elog "Note regarding Trusted Recursive Resolver aka DNS-over-HTTPS (DoH):" |
1273 |
+ elog "Due to privacy concerns (encrypting DNS might be a good thing, sending all" |
1274 |
+ elog "DNS traffic to Cloudflare by default is not a good idea and applications" |
1275 |
+ elog "should respect OS configured settings), \"network.trr.mode\" was set to 5" |
1276 |
+ elog "(\"Off by choice\") by default." |
1277 |
+ elog "You can enable DNS-over-HTTPS in ${PN^}'s preferences." |
1278 |
+ fi |
1279 |
+ |
1280 |
+ # bug 713782 |
1281 |
+ if [[ -n "${show_normandy_information}" ]] ; then |
1282 |
+ elog |
1283 |
+ elog "Upstream operates a service named Normandy which allows Mozilla to" |
1284 |
+ elog "push changes for default settings or even install new add-ons remotely." |
1285 |
+ elog "While this can be useful to address problems like 'Armagadd-on 2.0' or" |
1286 |
+ elog "revert previous decisions to disable TLS 1.0/1.1, privacy and security" |
1287 |
+ elog "concerns prevail, which is why we have switched off the use of this" |
1288 |
+ elog "service by default." |
1289 |
+ elog |
1290 |
+ elog "To re-enable this service set" |
1291 |
+ elog |
1292 |
+ elog " app.normandy.enabled=true" |
1293 |
+ elog |
1294 |
+ elog "in about:config." |
1295 |
+ fi |
1296 |
+ |
1297 |
+ if [[ -n "${show_shortcut_information}" ]] ; then |
1298 |
+ elog |
1299 |
+ elog "Since ${PN}-91.0 we no longer install multiple shortcuts for" |
1300 |
+ elog "each supported display protocol. Instead we will only install" |
1301 |
+ elog "one generic Mozilla ${PN^} shortcut." |
1302 |
+ elog "If you still want to be able to select between running Mozilla ${PN^}" |
1303 |
+ elog "on X11 or Wayland, you have to re-create these shortcuts on your own." |
1304 |
+ fi |
1305 |
+ |
1306 |
+ # bug 835078 |
1307 |
+ if use hwaccel && has_version "x11-drivers/xf86-video-nouveau"; then |
1308 |
+ ewarn "You have nouveau drivers installed in your system and 'hwaccel' " |
1309 |
+ ewarn "enabled for Firefox. Nouveau / your GPU might not supported the " |
1310 |
+ ewarn "required EGL, so either disable 'hwaccel' or try the workaround " |
1311 |
+ ewarn "explained in https://bugs.gentoo.org/835078#c5 if Firefox crashes." |
1312 |
+ fi |
1313 |
+ |
1314 |
+ elog |
1315 |
+ elog "Unfortunately Firefox-100.0 breaks compatibility with some sites using " |
1316 |
+ elog "useragent checks. To temporarily fix this, enter about:config and modify " |
1317 |
+ elog "network.http.useragent.forceVersion preference to \"99\"." |
1318 |
+ elog "Or install an addon to change your useragent." |
1319 |
+ elog "See: https://support.mozilla.org/en-US/kb/difficulties-opening-or-using-website-firefox-100" |
1320 |
+ elog |
1321 |
+} |