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