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