Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: mail-client/thunderbird/, mail-client/thunderbird/files/
Date: Thu, 27 Sep 2018 22:23:23
Message-Id: 1538086876.88610f0bebc7914926e2bedcafee21e8991a89e9.whissi@gentoo
1 commit: 88610f0bebc7914926e2bedcafee21e8991a89e9
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Thu Sep 27 22:21:16 2018 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 27 22:21:16 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=88610f0b
7
8 mail-client/thunderbird: ebuild rewritten
9
10 - Ebuild no longer uses mozconfig-v6.60 eclass
11
12 - Lots of changes/fixes from firefox-60.x ebuild backported
13
14 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
15 Package-Manager: Portage-2.3.50, Repoman-2.3.11
16
17 .../files/thunderbird-60.0-blessings-TERM.patch | 70 +++
18 mail-client/thunderbird/thunderbird-60.0-r3.ebuild | 563 +++++++++++++++++++++
19 2 files changed, 633 insertions(+)
20
21 diff --git a/mail-client/thunderbird/files/thunderbird-60.0-blessings-TERM.patch b/mail-client/thunderbird/files/thunderbird-60.0-blessings-TERM.patch
22 new file mode 100644
23 index 00000000000..975e0cf6fe7
24 --- /dev/null
25 +++ b/mail-client/thunderbird/files/thunderbird-60.0-blessings-TERM.patch
26 @@ -0,0 +1,70 @@
27 +https://github.com/erikrose/blessings/pull/137
28 +
29 +Fixes: https://bugs.gentoo.org/654316
30 +
31 +From 5fefc65c306cf9ec492e7b422d6bb4842385afbc Mon Sep 17 00:00:00 2001
32 +From: Jay Kamat <jaygkamat@×××××.com>
33 +Date: Fri, 24 Aug 2018 11:11:57 -0700
34 +Subject: [PATCH 1/2] Fix error when TERM is unset or improperly set
35 +
36 +---
37 + blessings/__init__.py | 9 +++++++--
38 + 1 file changed, 7 insertions(+), 2 deletions(-)
39 +
40 +diff --git a/blessings/__init__.py b/blessings/__init__.py
41 +index 98b75c3..3872b5f 100644
42 +--- a/third_party/python/blessings/blessings/__init__.py
43 ++++ b/third_party/python/blessings/blessings/__init__.py
44 +@@ -94,8 +94,13 @@ def __init__(self, kind=None, stream=None, force_styling=False):
45 + # init sequences to the stream if it has a file descriptor, and
46 + # send them to stdout as a fallback, since they have to go
47 + # somewhere.
48 +- setupterm(kind or environ.get('TERM', 'unknown'),
49 +- self._init_descriptor)
50 ++ try:
51 ++ setupterm(kind or environ.get('TERM', 'dumb') or 'dumb',
52 ++ self._init_descriptor)
53 ++ except:
54 ++ # There was an error setting up the terminal, either curses is
55 ++ # not supported or TERM is incorrectly set. Fall back to dumb.
56 ++ self._does_styling = False
57 +
58 + self.stream = stream
59 +
60 +
61 +From d885df78c6f931abf3259343aaaa897e16c8cba1 Mon Sep 17 00:00:00 2001
62 +From: Jay Kamat <jaygkamat@×××××.com>
63 +Date: Sat, 1 Sep 2018 13:20:32 -0700
64 +Subject: [PATCH 2/2] Explicitly catch curses.error
65 +
66 +---
67 + blessings/__init__.py | 2 +-
68 + 1 file changed, 1 insertion(+), 1 deletion(-)
69 +
70 +diff --git a/blessings/__init__.py b/blessings/__init__.py
71 +index 3872b5f..fdceb09 100644
72 +--- a/third_party/python/blessings/blessings/__init__.py
73 ++++ b/third_party/python/blessings/blessings/__init__.py
74 +@@ -97,7 +97,7 @@ def __init__(self, kind=None, stream=None, force_styling=False):
75 + try:
76 + setupterm(kind or environ.get('TERM', 'dumb'),
77 + self._init_descriptor)
78 +- except:
79 ++ except curses.error:
80 + # There was an error setting up the terminal, either curses is
81 + # not supported or TERM is incorrectly set. Fall back to dumb.
82 + self._does_styling = False
83 +
84 +
85 +--- a/python/mach/mach/logging.py
86 ++++ b/python/mach/mach/logging.py
87 +@@ -93,7 +93,7 @@
88 +
89 + def set_terminal(self, terminal):
90 + self.terminal = terminal
91 +- self._sgr0 = blessings.tigetstr('sgr0') or '' if terminal and blessings else ''
92 ++ self._sgr0 = terminal.normal if terminal and blessings else ''
93 +
94 + def format(self, record):
95 + f = record.msg.format(**record.params)
96 +
97
98 diff --git a/mail-client/thunderbird/thunderbird-60.0-r3.ebuild b/mail-client/thunderbird/thunderbird-60.0-r3.ebuild
99 new file mode 100644
100 index 00000000000..98e373db77a
101 --- /dev/null
102 +++ b/mail-client/thunderbird/thunderbird-60.0-r3.ebuild
103 @@ -0,0 +1,563 @@
104 +# Copyright 1999-2018 Gentoo Authors
105 +# Distributed under the terms of the GNU General Public License v2
106 +
107 +EAPI=6
108 +VIRTUALX_REQUIRED="pgo"
109 +WANT_AUTOCONF="2.1"
110 +MOZ_ESR=""
111 +MOZ_LIGHTNING_VER="6.2"
112 +MOZ_LIGHTNING_GDATA_VER="4.4.1"
113 +
114 +# This list can be updated using scripts/get_langs.sh from the mozilla overlay
115 +MOZ_LANGS=(ar ast be bg br ca cs cy da de el en en-GB en-US es-AR
116 +es-ES et eu fi fr fy-NL ga-IE gd gl he hr hsb hu hy-AM id is it ja ko lt
117 +nb-NO nl nn-NO pl pt-BR pt-PT rm ro ru si sk sl sq sr sv-SE tr
118 +uk vi zh-CN zh-TW )
119 +
120 +# Convert the ebuild version to the upstream mozilla version, used by mozlinguas
121 +MOZ_PV="${PV/_beta/b}"
122 +
123 +# Patches
124 +PATCHTB="thunderbird-60.0-patches-0"
125 +PATCHFF="firefox-60.0-patches-02"
126 +
127 +MOZ_HTTP_URI="https://archive.mozilla.org/pub/${PN}/releases"
128 +
129 +# ESR releases have slightly version numbers
130 +if [[ ${MOZ_ESR} == 1 ]]; then
131 + MOZ_PV="${MOZ_PV}esr"
132 +fi
133 +MOZ_P="${PN}-${MOZ_PV}"
134 +
135 +inherit check-reqs flag-o-matic toolchain-funcs gnome2-utils llvm mozcoreconf-v6 pax-utils xdg-utils autotools mozlinguas-v2
136 +
137 +DESCRIPTION="Thunderbird Mail Client"
138 +HOMEPAGE="https://www.mozilla.org/thunderbird"
139 +
140 +KEYWORDS="~amd64 ~x86 ~x86-fbsd ~amd64-linux ~x86-linux"
141 +SLOT="0"
142 +LICENSE="MPL-2.0 GPL-2 LGPL-2.1"
143 +IUSE="bindist clang dbus debug hardened jack lightning mozdom neon pulseaudio
144 + selinux startup-notification system-harfbuzz system-icu system-jpeg
145 + system-libevent system-libvpx system-sqlite wifi"
146 +RESTRICT="!bindist? ( bindist )"
147 +
148 +PATCH_URIS=( https://dev.gentoo.org/~{anarchy,axs,polynomial-c}/mozilla/patchsets/{${PATCHTB},${PATCHFF}}.tar.xz )
149 +SRC_URI="${SRC_URI}
150 + ${MOZ_HTTP_URI}/${MOZ_PV}/source/${MOZ_P}.source.tar.xz
151 + https://dev.gentoo.org/~axs/distfiles/lightning-${MOZ_LIGHTNING_VER}.tar.xz
152 + lightning? ( https://dev.gentoo.org/~axs/distfiles/gdata-provider-${MOZ_LIGHTNING_GDATA_VER}.tar.xz )
153 + ${PATCH_URIS[@]}"
154 +
155 +ASM_DEPEND=">=dev-lang/yasm-1.1"
156 +
157 +CDEPEND="
158 + >=dev-libs/nss-3.36.4
159 + >=dev-libs/nspr-4.19
160 + >=app-text/hunspell-1.5.4:=
161 + dev-libs/atk
162 + dev-libs/expat
163 + >=x11-libs/cairo-1.10[X]
164 + >=x11-libs/gtk+-2.18:2
165 + >=x11-libs/gtk+-3.4.0:3
166 + x11-libs/gdk-pixbuf
167 + >=x11-libs/pango-1.22.0
168 + >=media-libs/libpng-1.6.34:0=[apng]
169 + >=media-libs/mesa-10.2:*
170 + media-libs/fontconfig
171 + >=media-libs/freetype-2.4.10
172 + kernel_linux? ( !pulseaudio? ( media-libs/alsa-lib ) )
173 + virtual/freedesktop-icon-theme
174 + dbus? (
175 + >=sys-apps/dbus-0.60
176 + >=dev-libs/dbus-glib-0.72
177 + )
178 + startup-notification? ( >=x11-libs/startup-notification-0.8 )
179 + >=x11-libs/pixman-0.19.2
180 + >=dev-libs/glib-2.26:2
181 + >=sys-libs/zlib-1.2.3
182 + >=virtual/libffi-3.0.10
183 + virtual/ffmpeg
184 + x11-libs/libX11
185 + x11-libs/libXcomposite
186 + x11-libs/libXdamage
187 + x11-libs/libXext
188 + x11-libs/libXfixes
189 + x11-libs/libXrender
190 + x11-libs/libXt
191 + system-harfbuzz? (
192 + >=media-libs/harfbuzz-1.4.2:0=
193 + >=media-gfx/graphite2-1.3.9-r1
194 + )
195 + system-icu? ( >=dev-libs/icu-59.1:= )
196 + system-jpeg? ( >=media-libs/libjpeg-turbo-1.2.1:= )
197 + system-libevent? ( >=dev-libs/libevent-2.0:0= )
198 + system-libvpx? ( >=media-libs/libvpx-1.5.0:0=[postproc] )
199 + system-sqlite? ( >=dev-db/sqlite-3.23.1:3[secure-delete,debug=] )
200 + wifi? (
201 + kernel_linux? (
202 + >=sys-apps/dbus-0.60
203 + >=dev-libs/dbus-glib-0.72
204 + net-misc/networkmanager
205 + )
206 + )
207 + jack? ( virtual/jack )"
208 +
209 +DEPEND="${CDEPEND}
210 + app-arch/zip
211 + app-arch/unzip
212 + >=sys-devel/binutils-2.30
213 + sys-apps/findutils
214 + >=sys-devel/llvm-4.0.1
215 + >=sys-devel/clang-4.0.1
216 + clang? (
217 + >=sys-devel/llvm-4.0.1[gold]
218 + >=sys-devel/lld-4.0.1
219 + )
220 + pulseaudio? ( media-sound/pulseaudio )
221 + elibc_glibc? (
222 + virtual/cargo
223 + virtual/rust
224 + )
225 + elibc_musl? (
226 + virtual/cargo
227 + virtual/rust
228 + )
229 + amd64? (
230 + ${ASM_DEPEND}
231 + virtual/opengl
232 + )
233 + x86? (
234 + ${ASM_DEPEND}
235 + virtual/opengl
236 + )"
237 +
238 +RDEPEND="${CDEPEND}
239 + pulseaudio? (
240 + || (
241 + media-sound/pulseaudio
242 + >=media-sound/apulse-0.1.9
243 + )
244 + )
245 + selinux? (
246 + sec-policy/selinux-mozilla
247 + sec-policy/selinux-thunderbird
248 + )"
249 +
250 +REQUIRED_USE="wifi? ( dbus )"
251 +
252 +S="${WORKDIR}/${MOZ_P%b[0-9]*}"
253 +
254 +BUILD_OBJ_DIR="${S}/tbird"
255 +
256 +pkg_setup() {
257 + moz_pkgsetup
258 +
259 + # Avoid PGO profiling problems due to enviroment leakage
260 + # These should *always* be cleaned up anyway
261 + unset DBUS_SESSION_BUS_ADDRESS \
262 + DISPLAY \
263 + ORBIT_SOCKETDIR \
264 + SESSION_MANAGER \
265 + XDG_SESSION_COOKIE \
266 + XAUTHORITY
267 +
268 + if ! use bindist ; then
269 + elog "You are enabling official branding. You may not redistribute this build"
270 + elog "to any users on your network or the internet. Doing so puts yourself into"
271 + elog "a legal problem with Mozilla Foundation"
272 + elog "You can disable it by emerging ${PN} _with_ the bindist USE-flag"
273 + elog
274 + fi
275 +
276 + addpredict /proc/self/oom_score_adj
277 +
278 + llvm_pkg_setup
279 +}
280 +
281 +pkg_pretend() {
282 + # Ensure we have enough disk space to compile
283 + CHECKREQS_DISK_BUILD="4G"
284 + check-reqs_pkg_setup
285 +}
286 +
287 +src_unpack() {
288 + unpack ${A}
289 +
290 + # Unpack language packs
291 + mozlinguas_src_unpack
292 +}
293 +
294 +src_prepare() {
295 + # Apply our patchset from firefox to thunderbird as well
296 + rm -f "${WORKDIR}"/firefox/2007_fix_nvidia_latest.patch \
297 + "${WORKDIR}"/firefox/2005_ffmpeg4.patch \
298 + || die
299 + eapply "${WORKDIR}/firefox"
300 + eapply "${FILESDIR}"/${PN}-60.0-blessings-TERM.patch # 654316
301 +
302 + # Ensure that are plugins dir is enabled as default
303 + sed -i -e "s:/usr/lib/mozilla/plugins:/usr/lib/nsbrowser/plugins:" \
304 + "${S}"/xpcom/io/nsAppFileLocationProvider.cpp || die "sed failed to replace plugin path for 32bit!"
305 + sed -i -e "s:/usr/lib64/mozilla/plugins:/usr/lib64/nsbrowser/plugins:" \
306 + "${S}"/xpcom/io/nsAppFileLocationProvider.cpp || die "sed failed to replace plugin path for 64bit!"
307 +
308 + # Don't error out when there's no files to be removed:
309 + sed 's@\(xargs rm\)$@\1 -f@' \
310 + -i "${S}"/toolkit/mozapps/installer/packager.mk || die
311 +
312 + # Don't exit with error when some libs are missing which we have in
313 + # system.
314 + sed '/^MOZ_PKG_FATAL_WARNINGS/s@= 1@= 0@' \
315 + -i "${S}"/comm/mail/installer/Makefile.in || die
316 +
317 + # Apply our Thunderbird patchset
318 + pushd "${S}"/comm &>/dev/null || doe
319 + eapply "${WORKDIR}"/thunderbird
320 +
321 + # simulate old directory structure just in case it helps eapply_user
322 + ln -s .. mozilla || die
323 + # Allow user to apply any additional patches without modifing ebuild
324 + eapply_user
325 + # remove the symlink
326 + rm -f mozilla
327 +
328 + # Confirm the version of lightning being grabbed for langpacks is the same
329 + # as that used in thunderbird
330 + local THIS_MOZ_LIGHTNING_VER=$(${PYTHON} calendar/lightning/build/makeversion.py ${PV})
331 + if [[ ${MOZ_LIGHTNING_VER} != ${THIS_MOZ_LIGHTNING_VER} ]]; then
332 + eqawarn "The version of lightning used for localization differs from the version"
333 + eqawarn "in thunderbird. Please update MOZ_LIGHTNING_VER in the ebuild from ${MOZ_LIGHTNING_VER}"
334 + eqawarn "to ${THIS_MOZ_LIGHTNING_VER}"
335 + fi
336 +
337 + popd &>/dev/null || die
338 +
339 + eautoreconf old-configure.in
340 + # Ensure we run eautoreconf in spidermonkey to regenerate configure
341 + cd "${S}"/js/src || die
342 + eautoconf old-configure.in
343 +}
344 +
345 +src_configure() {
346 + MEXTENSIONS="default"
347 +
348 + # Add information about TERM to output (build.log) to aid debugging
349 + # blessings problems
350 + if [[ -n "${TERM}" ]] ; then
351 + einfo "TERM is set to: \"${TERM}\""
352 + else
353 + einfo "TERM is unset."
354 + fi
355 +
356 + if use clang && ! tc-is-clang ; then
357 + # Force clang
358 + einfo "Enforcing the use of clang due to USE=clang ..."
359 + CC=${CHOST}-clang
360 + CXX=${CHOST}-clang++
361 + strip-unsupported-flags
362 + elif ! use clang && ! tc-is-gcc ; then
363 + # Force gcc
364 + einfo "Enforcing the use of gcc due to USE=-clang ..."
365 + CC=${CHOST}-gcc
366 + CXX=${CHOST}-gcc++
367 + strip-unsupported-flags
368 + fi
369 +
370 + ####################################
371 + #
372 + # mozconfig, CFLAGS and CXXFLAGS setup
373 + #
374 + ####################################
375 +
376 + mozconfig_init
377 + # common config components
378 + mozconfig_annotate 'system_libs' \
379 + --with-system-zlib \
380 + --with-system-bz2
381 +
382 + # Must pass release in order to properly select linker
383 + mozconfig_annotate 'Enable by Gentoo' --enable-release
384 +
385 + # Avoid auto-magic on linker
386 + if use clang ; then
387 + # This is upstream's default
388 + mozconfig_annotate "forcing ld=lld due to USE=clang" --enable-linker=lld
389 + elif tc-ld-is-gold ; then
390 + mozconfig_annotate "linker is set to gold" --enable-linker=gold
391 + else
392 + mozconfig_annotate "linker is set to bfd" --enable-linker=bfd
393 + fi
394 +
395 + # It doesn't compile on alpha without this LDFLAGS
396 + use alpha && append-ldflags "-Wl,--no-relax"
397 +
398 + # Add full relro support for hardened
399 + if use hardened; then
400 + append-ldflags "-Wl,-z,relro,-z,now"
401 + mozconfig_use_enable hardened hardening
402 + fi
403 +
404 + # Modifications to better support ARM, bug 553364
405 + if use neon ; then
406 + mozconfig_annotate '' --with-fpu=neon
407 +
408 + if ! tc-is-clang ; then
409 + # thumb options aren't supported when using clang, bug 666966
410 + mozconfig_annotate '' --with-thumb=yes
411 + mozconfig_annotate '' --with-thumb-interwork=no
412 + fi
413 + fi
414 + if [[ ${CHOST} == armv*h* ]] ; then
415 + mozconfig_annotate '' --with-float-abi=hard
416 + if ! use system-libvpx ; then
417 + sed -i -e "s|softfp|hard|" \
418 + "${S}"/media/libvpx/moz.build
419 + fi
420 + fi
421 +
422 + mozconfig_use_enable !bindist official-branding
423 + # Enable position independent executables
424 + mozconfig_annotate 'enabled by Gentoo' --enable-pie
425 +
426 + mozconfig_use_enable debug
427 + mozconfig_use_enable debug tests
428 + if ! use debug ; then
429 + mozconfig_annotate 'disabled by Gentoo' --disable-debug-symbols
430 + else
431 + mozconfig_annotate 'enabled by Gentoo' --enable-debug-symbols
432 + fi
433 + # These are enabled by default in all mozilla applications
434 + mozconfig_annotate '' --with-system-nspr --with-nspr-prefix="${SYSROOT}${EPREFIX}"/usr
435 + mozconfig_annotate '' --with-system-nss --with-nss-prefix="${SYSROOT}${EPREFIX}"/usr
436 + mozconfig_annotate '' --x-includes="${SYSROOT}${EPREFIX}"/usr/include \
437 + --x-libraries="${SYSROOT}${EPREFIX}"/usr/$(get_libdir)
438 + mozconfig_annotate '' --prefix="${EPREFIX}"/usr
439 + mozconfig_annotate '' --libdir="${EPREFIX}"/usr/$(get_libdir)
440 + mozconfig_annotate 'Gentoo default' --enable-system-hunspell
441 + mozconfig_annotate '' --disable-crashreporter
442 + mozconfig_annotate 'Gentoo default' --with-system-png
443 + mozconfig_annotate '' --enable-system-ffi
444 + mozconfig_annotate '' --disable-gconf
445 + mozconfig_annotate '' --with-intl-api
446 + mozconfig_annotate '' --enable-system-pixman
447 + # Instead of the standard --build= and --host=, mozilla uses --host instead
448 + # of --build, and --target intstead of --host.
449 + # Note, mozilla also has --build but it does not do what you think it does.
450 + # Set both --target and --host as mozilla uses python to guess values otherwise
451 + mozconfig_annotate '' --target="${CHOST}"
452 + mozconfig_annotate '' --host="${CBUILD:-${CHOST}}"
453 + if use system-libevent; then
454 + mozconfig_annotate '' --with-system-libevent="${SYSROOT}${EPREFIX}"/usr
455 + fi
456 +
457 + # skia has no support for big-endian platforms
458 + if [[ $(tc-endian) == "big" ]]; then
459 + mozconfig_annotate 'big endian target' --disable-skia
460 + else
461 + mozconfig_annotate '' --enable-skia
462 + fi
463 +
464 + # use the gtk3 toolkit (the only one supported at this point)
465 + mozconfig_annotate '' --enable-default-toolkit=cairo-gtk3
466 +
467 + mozconfig_use_enable startup-notification
468 + mozconfig_use_enable system-sqlite
469 + mozconfig_use_with system-jpeg
470 + mozconfig_use_with system-icu
471 + mozconfig_use_with system-libvpx
472 + mozconfig_use_with system-harfbuzz
473 + mozconfig_use_with system-harfbuzz system-graphite2
474 + mozconfig_use_enable pulseaudio
475 + # force the deprecated alsa sound code if pulseaudio is disabled
476 + if use kernel_linux && ! use pulseaudio ; then
477 + mozconfig_annotate '-pulseaudio' --enable-alsa
478 + fi
479 +
480 + mozconfig_use_enable dbus
481 +
482 + mozconfig_use_enable wifi necko-wifi
483 +
484 + # enable JACK, bug 600002
485 + mozconfig_use_enable jack
486 +
487 + # Other tb-specific settings
488 + mozconfig_annotate '' --with-user-appdir=.thunderbird
489 +
490 + mozconfig_annotate '' --enable-ldap
491 +
492 + # Bug #72667
493 + if use mozdom; then
494 + MEXTENSIONS="${MEXTENSIONS},inspector"
495 + fi
496 +
497 + mozconfig_annotate '' --enable-extensions="${MEXTENSIONS}"
498 +
499 + mozconfig_annotate '' --enable-calendar
500 +
501 + # Disable built-in ccache support to avoid sandbox violation, #665420
502 + # Use FEATURES=ccache instead!
503 + mozconfig_annotate '' --without-ccache
504 + sed -i -e 's/ccache_stats = None/return None/' \
505 + python/mozbuild/mozbuild/controller/building.py || \
506 + die "Failed to disable ccache stats call"
507 +
508 + # Stylo is only broken on x86 builds
509 + use x86 && mozconfig_annotate 'Upstream bug 1341234' --disable-stylo
510 +
511 + # Stylo is horribly broken on arm, renders GUI unusable
512 + use arm && mozconfig_annotate 'breaks UI on arm' --disable-stylo
513 +
514 + if use clang ; then
515 + # libprldap60.so: terminate called after throwing an instance of 'std::runtime_error', bug 667186
516 + mozconfig_annotate 'elf-hack is broken when using clang' --disable-elf-hack
517 + elif use arm ; then
518 + mozconfig_annotate 'elf-hack is broken on arm' --disable-elf-hack
519 + fi
520 +
521 + # Use an objdir to keep things organized.
522 + echo "mk_add_options MOZ_OBJDIR=${BUILD_OBJ_DIR}" >> "${S}"/.mozconfig
523 + echo "mk_add_options XARGS=/usr/bin/xargs" >> "${S}"/.mozconfig
524 +
525 + # Finalize and report settings
526 + mozconfig_final
527 +
528 + ####################################
529 + #
530 + # Configure and build
531 + #
532 + ####################################
533 +
534 + # Disable no-print-directory
535 + MAKEOPTS=${MAKEOPTS/--no-print-directory/}
536 +
537 + if [[ $(gcc-major-version) -lt 4 ]]; then
538 + append-cxxflags -fno-stack-protector
539 + fi
540 +
541 + # workaround for funky/broken upstream configure...
542 + SHELL="${SHELL:-${EPREFIX}/bin/bash}" MOZ_NOSPAM=1 \
543 + ./mach configure || die
544 +}
545 +
546 +src_compile() {
547 + MOZ_MAKE_FLAGS="${MAKEOPTS}" SHELL="${SHELL:-${EPREFIX}/bin/bash}" MOZ_NOSPAM=1 \
548 + ./mach build --verbose || die
549 +}
550 +
551 +src_install() {
552 + declare emid
553 + cd "${BUILD_OBJ_DIR}" || die
554 +
555 + # Pax mark xpcshell for hardened support, only used for startupcache creation.
556 + pax-mark m "${BUILD_OBJ_DIR}"/dist/bin/xpcshell
557 +
558 + # Copy our preference before omnijar is created.
559 + cp "${FILESDIR}"/thunderbird-gentoo-default-prefs.js-2 \
560 + "${BUILD_OBJ_DIR}/dist/bin/defaults/pref/all-gentoo.js" \
561 + || die
562 +
563 + # set dictionary path, to use system hunspell
564 + echo "pref(\"spellchecker.dictionary_path\", \"${EPREFIX}/usr/share/myspell\");" \
565 + >>"${BUILD_OBJ_DIR}/dist/bin/defaults/pref/all-gentoo.js" || die
566 +
567 + # force the graphite pref if system-harfbuzz is enabled, since the pref cant disable it
568 + if use system-harfbuzz ; then
569 + echo "sticky_pref(\"gfx.font_rendering.graphite.enabled\",true);" \
570 + >>"${BUILD_OBJ_DIR}/dist/bin/defaults/pref/all-gentoo.js" || die
571 + fi
572 +
573 + # force cairo as the canvas renderer on platforms without skia support
574 + if [[ $(tc-endian) == "big" ]] ; then
575 + echo "sticky_pref(\"gfx.canvas.azure.backends\",\"cairo\");" \
576 + >>"${BUILD_OBJ_DIR}/dist/bin/defaults/pref/all-gentoo.js" || die
577 + echo "sticky_pref(\"gfx.content.azure.backends\",\"cairo\");" \
578 + >>"${BUILD_OBJ_DIR}/dist/bin/defaults/pref/all-gentoo.js" || die
579 + fi
580 +
581 + # dev-db/sqlite does not have FTS3_TOKENIZER support.
582 + # gloda needs it to function, and bad crashes happen when its enabled and doesn't work
583 + if use system-sqlite ; then
584 + echo "sticky_pref(\"mailnews.database.global.indexer.enabled\", false);" \
585 + >>"${BUILD_OBJ_DIR}/dist/bin/defaults/pref/all-gentoo.js" || die
586 + fi
587 +
588 + cd "${S}" || die
589 + MOZ_MAKE_FLAGS="${MAKEOPTS}" SHELL="${SHELL:-${EPREFIX}/bin/bash}" MOZ_NOSPAM=1 \
590 + DESTDIR="${D}" ./mach install || die
591 +
592 + # Install language packs
593 + MOZ_INSTALL_L10N_XPIFILE="1" mozlinguas_src_install
594 +
595 + local size sizes icon_path icon
596 + if ! use bindist; then
597 + icon_path="${S}/comm/mail/branding/thunderbird"
598 + icon="${PN}-icon"
599 +
600 + domenu "${FILESDIR}"/icon/${PN}.desktop
601 + else
602 + icon_path="${S}/comm/mail/branding/nightly"
603 + icon="${PN}-icon-unbranded"
604 +
605 + newmenu "${FILESDIR}"/icon/${PN}-unbranded.desktop \
606 + ${PN}.desktop
607 +
608 + sed -i -e "s:Mozilla\ Thunderbird:EarlyBird:g" \
609 + "${ED}"/usr/share/applications/${PN}.desktop
610 + fi
611 +
612 + # Install a 48x48 icon into /usr/share/pixmaps for legacy DEs
613 + newicon "${icon_path}"/default48.png "${icon}".png
614 + # Install icons for menu entry
615 + sizes="16 22 24 32 48 256"
616 + for size in ${sizes}; do
617 + newicon -s ${size} "${icon_path}/default${size}.png" "${icon}.png"
618 + done
619 +
620 + local emid
621 + # stage extra locales for lightning and install over existing
622 + rm -f "${ED}"/${MOZILLA_FIVE_HOME}/distribution/extensions/${emid}.xpi || die
623 + mozlinguas_xpistage_langpacks "${BUILD_OBJ_DIR}"/dist/bin/distribution/extensions/${emid} \
624 + "${WORKDIR}"/lightning-${MOZ_LIGHTNING_VER} lightning calendar
625 +
626 + emid='{e2fda1a4-762b-4020-b5ad-a41df1933103}'
627 + mkdir -p "${T}/${emid}" || die
628 + cp -RLp -t "${T}/${emid}" "${BUILD_OBJ_DIR}"/dist/bin/distribution/extensions/${emid}/* || die
629 + insinto ${MOZILLA_FIVE_HOME}/distribution/extensions
630 + doins -r "${T}/${emid}"
631 +
632 + if use lightning; then
633 + # move lightning out of distribution/extensions and into extensions for app-global install
634 + mv "${ED}"/${MOZILLA_FIVE_HOME}/{distribution,}/extensions/${emid} || die
635 +
636 + # stage extra locales for gdata-provider and install app-global
637 + mozlinguas_xpistage_langpacks "${BUILD_OBJ_DIR}"/dist/xpi-stage/gdata-provider \
638 + "${WORKDIR}"/gdata-provider-${MOZ_LIGHTNING_GDATA_VER}
639 + emid='{a62ef8ec-5fdc-40c2-873c-223b8a6925cc}'
640 + mkdir -p "${T}/${emid}" || die
641 + cp -RLp -t "${T}/${emid}" "${BUILD_OBJ_DIR}"/dist/xpi-stage/gdata-provider/* || die
642 + insinto ${MOZILLA_FIVE_HOME}/extensions
643 + doins -r "${T}/${emid}"
644 + fi
645 +
646 + # thunderbird and thunderbird-bin are identical
647 + rm "${ED%/}"${MOZILLA_FIVE_HOME}/thunderbird-bin || die
648 + dosym thunderbird ${MOZILLA_FIVE_HOME}/thunderbird-bin
649 +
650 + # Required in order to use plugins and even run thunderbird on hardened.
651 + pax-mark pm "${ED%/}"${MOZILLA_FIVE_HOME}/{thunderbird,plugin-container}
652 +}
653 +
654 +pkg_preinst() {
655 + gnome2_icon_savelist
656 +}
657 +
658 +pkg_postinst() {
659 + gnome2_icon_cache_update
660 + xdg_desktop_database_update
661 +}
662 +
663 +pkg_postrm() {
664 + gnome2_icon_cache_update
665 + xdg_desktop_database_update
666 +}