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