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