]> CyberLeo.Net >> Repos - CDN/portage-cdn.git/blob - mail-client/thunderbird/thunderbird-8.0-r2.ebuild
net-p2p/freenet: revbump
[CDN/portage-cdn.git] / mail-client / thunderbird / thunderbird-8.0-r2.ebuild
1 # Copyright 1999-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/mail-client/thunderbird/thunderbird-8.0-r1.ebuild,v 1.3 2011/11/29 22:55:58 chainsaw Exp $
4
5 EAPI="3"
6 WANT_AUTOCONF="2.1"
7
8 inherit flag-o-matic toolchain-funcs mozconfig-3 makeedit multilib mozextension autotools pax-utils python check-reqs
9
10 TB_PV="${PV/_beta/b}"
11 TB_P="${PN}-${TB_PV}"
12 EMVER="1.3.4"
13
14 DESCRIPTION="Thunderbird Mail Client"
15 HOMEPAGE="http://www.mozilla.com/en-US/thunderbird/"
16
17 KEYWORDS="~alpha amd64 ~arm ~ppc ~ppc64 ~x86 ~x86-fbsd ~amd64-linux ~x86-linux"
18 SLOT="0"
19 LICENSE="|| ( MPL-1.1 GPL-2 LGPL-2.1 )"
20 IUSE="bindist gconf +crashreporter +crypt +ipc +lightning mozdom +webm"
21 PATCH="${PN}-${PV}-patches-0.1"
22 PATCHFF="firefox-${PV}-patches-0.2"
23
24 FTP_URI="ftp://ftp.mozilla.org/pub/${PN}/releases/"
25 SRC_URI="${FTP_URI}/${TB_PV}/source/${TB_P}.source.tar.bz2
26         crypt? ( http://www.mozilla-enigmail.org/download/source/enigmail-${EMVER}.tar.gz )
27         http://dev.gentoo.org/~anarchy/mozilla/patchsets/${PATCH}.tar.xz
28         http://dev.gentoo.org/~anarchy/mozilla/patchsets/${PATCHFF}.tar.xz"
29
30 if ! [[ ${PV} =~ alpha|beta ]]; then
31         # This list can be updated using scripts/get_langs.sh from the mozilla overlay
32         LANGS=(ar be bg bn-BD br ca cs da de el en en-GB en-US es-AR es-ES et eu fi
33         fr fy-NL ga-IE gd gl he hu id is it ja ko lt nb-NO nl nn-NO pa-IN pl pt-BR
34         pt-PT rm ro ru si sk sl sq sv-SE ta-LK tr uk vi zh-CN zh-TW)
35
36         for X in "${LANGS[@]}" ; do
37                 # en and en_US are handled internally
38                 if [[ ${X} != en ]] && [[ ${X} != en-US ]]; then
39                         SRC_URI="${SRC_URI}
40                                 linguas_${X/-/_}? ( ${FTP_URI}/${TB_PV}/linux-i686/xpi/${X}.xpi -> ${P}-${X}.xpi )"
41                 fi
42                 IUSE="${IUSE} linguas_${X/-/_}"
43                 # Install all the specific locale xpis if there's no generic locale xpi
44                 # Example: there's no pt.xpi, so install all pt-*.xpi
45                 if ! has ${X%%-*} "${LANGS[@]}"; then
46                         SRC_URI="${SRC_URI}
47                                 linguas_${X%%-*}? ( ${FTP_URI}/${TB_PV}/linux-i686/xpi/${X}.xpi -> ${P}-${X}.xpi )"
48                         IUSE="${IUSE} linguas_${X%%-*}"
49                 fi
50         done
51 fi
52
53 RDEPEND=">=sys-devel/binutils-2.16.1
54         >=dev-libs/nss-3.12.10
55         >=dev-libs/nspr-4.8.8
56         crashreporter? ( net-misc/curl )
57         gconf? ( >=gnome-base/gconf-1.2.1:2 )
58         media-libs/libpng[apng]
59         webm? ( media-libs/libvpx
60                 media-libs/alsa-lib )
61         virtual/libffi
62         !x11-plugins/enigmail
63         system-sqlite? ( >=dev-db/sqlite-3.7.5[fts3,secure-delete,unlock-notify,debug=] )
64         crypt?  ( || (
65                 ( >=app-crypt/gnupg-2.0
66                         || (
67                                 app-crypt/pinentry[gtk]
68                                 app-crypt/pinentry[qt4]
69                         )
70                 )
71                 =app-crypt/gnupg-1.4*
72         ) )"
73
74 DEPEND="${RDEPEND}"
75
76 S="${WORKDIR}"/comm-release
77
78 # TODO: Move all the linguas crap to an eclass
79 linguas() {
80         # Generate the list of language packs called "linguas"
81         # This list is used to install the xpi language packs
82         local LINGUA
83         for LINGUA in ${LINGUAS}; do
84                 if has ${LINGUA} en en_US; then
85                         # For mozilla products, en and en_US are handled internally
86                         continue
87                 # If this language is supported by ${P},
88                 elif has ${LINGUA} "${LANGS[@]//-/_}"; then
89                         # Add the language to linguas, if it isn't already there
90                         has ${LINGUA//_/-} "${linguas[@]}" || linguas+=(${LINGUA//_/-})
91                         continue
92                 # For each short LINGUA that isn't in LANGS,
93                 # add *all* long LANGS to the linguas list
94                 elif ! has ${LINGUA%%-*} "${LANGS[@]}"; then
95                         for LANG in "${LANGS[@]}"; do
96                                 if [[ ${LANG} == ${LINGUA}-* ]]; then
97                                         has ${LANG} "${linguas[@]}" || linguas+=(${LANG})
98                                         continue 2
99                                 fi
100                         done
101                 fi
102                 ewarn "Sorry, but ${P} does not support the ${LINGUA} locale"
103         done
104 }
105
106 pkg_setup() {
107         moz_pkgsetup
108
109         export MOZILLA_DIR="${S}/mozilla"
110
111         if ! use bindist ; then
112                 elog "You are enabling official branding. You may not redistribute this build"
113                 elog "to any users on your network or the internet. Doing so puts yourself into"
114                 elog "a legal problem with Mozilla Foundation"
115                 elog "You can disable it by emerging ${PN} _with_ the bindist USE-flag"
116                 elog
117         fi
118
119         # Ensure we have enough disk space to compile
120         CHECKREQS_DISK_BUILD="4G"
121         check-reqs_pkg_setup
122 }
123
124 src_unpack() {
125         unpack ${A}
126
127         if ! [[ ${PV} =~ alpha|beta ]]; then
128                 linguas
129                 for X in "${linguas[@]}"; do
130                         xpi_unpack "${P}-${X}.xpi"
131                 done
132         fi
133 }
134
135 src_prepare() {
136         # Apply our Thunderbird patchset
137         EPATCH_SUFFIX="patch" \
138         EPATCH_FORCE="yes" \
139         epatch "${WORKDIR}/thunderbird"
140
141         # Apply our patchset from firefox to thunderbird as well
142         pushd "${S}"/mozilla &>/dev/null || die
143         EPATCH_SUFFIX="patch" \
144         EPATCH_FORCE="yes" \
145         epatch "${WORKDIR}/firefox"
146         popd &>/dev/null || die
147
148         if use lightning ; then
149                 einfo "Fix lightning version to match upstream release"
150                 einfo
151                 sed -i -e 's:1.0b8pre:1.0:' "${S}"/calendar/sunbird/config/version.txt \
152                         || die "Failed to correct lightning version"
153         fi
154
155         if use crypt ; then
156                 mv "${WORKDIR}"/enigmail "${S}"/mailnews/extensions/enigmail
157                 # Ensure enigmail can find its scripts for gpg
158                 epatch "${FILESDIR}"/enigmail-1.3.3-bug373733.patch
159                 cd "${S}"/mailnews/extensions/enigmail || die
160                 ./makemake -r 2&> /dev/null
161                 sed -i -e 's:@srcdir@:${S}/mailnews/extensions/enigmail:' Makefile.in
162                 cd "${S}"
163         fi
164
165         #Fix compilation with curl-7.21.7 bug 376027
166         sed -e '/#include <curl\/types.h>/d'  \
167                 -i "${S}"/mozilla/toolkit/crashreporter/google-breakpad/src/common/linux/http_upload.cc \
168                 -i "${S}"/mozilla/toolkit/crashreporter/google-breakpad/src/common/linux/libcurl_wrapper.cc \
169                 -i "${S}"/mozilla/config/system-headers \
170                 -i "${S}"/mozilla/js/src/config/system-headers || die "Sed failed"
171
172         # Allow user to apply any additional patches without modifing ebuild
173         epatch_user
174
175         eautoreconf
176 }
177
178 src_configure() {
179         declare MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
180         MEXTENSIONS="default"
181
182         ####################################
183         #
184         # mozconfig, CFLAGS and CXXFLAGS setup
185         #
186         ####################################
187
188         mozconfig_init
189         mozconfig_config
190
191         # It doesn't compile on alpha without this LDFLAGS
192         use alpha && append-ldflags "-Wl,--no-relax"
193
194         mozconfig_annotate '' --enable-extensions="${MEXTENSIONS}"
195         mozconfig_annotate '' --with-default-mozilla-five-home="${EPREFIX}${MOZILLA_FIVE_HOME}"
196         mozconfig_annotate '' --with-user-appdir=.thunderbird
197         mozconfig_annotate '' --with-system-png
198         mozconfig_annotate '' --enable-system-ffi
199
200         # Use enable features
201         mozconfig_use_enable lightning calendar
202         mozconfig_use_enable gconf
203
204         # Bug #72667
205         if use mozdom; then
206                 MEXTENSIONS="${MEXTENSIONS},inspector"
207         fi
208
209         # Finalize and report settings
210         mozconfig_final
211
212         ####################################
213         #
214         #  Configure and build
215         #
216         ####################################
217
218         # Disable no-print-directory
219         MAKEOPTS=${MAKEOPTS/--no-print-directory/}
220
221         if [[ $(gcc-major-version) -lt 4 ]]; then
222                 append-cxxflags -fno-stack-protector
223         elif [[ $(gcc-major-version) -gt 4 || $(gcc-minor-version) -gt 3 ]]; then
224                 if use amd64 || use x86; then
225                         append-flags -mno-avx
226                 fi
227         fi
228
229         CPPFLAGS="${CPPFLAGS}" \
230         CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" \
231         econf || die
232 }
233
234 src_compile() {
235         emake || die
236
237         # Only build enigmail extension if crypt enabled.
238         if use crypt ; then
239                 emake -C "${S}"/mailnews/extensions/enigmail || die "make enigmail failed"
240                 emake -C "${S}"/mailnews/extensions/enigmail xpi || die "make enigmail xpi failed"
241         fi
242 }
243
244 src_install() {
245         declare MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
246         declare emid
247
248         # Pax mark xpcshell for hardened support, only used for startupcache creation.
249         pax-mark m "${S}"/mozilla/dist/bin/xpcshell
250
251         emake DESTDIR="${D}" install || die "emake install failed"
252
253         if ! use bindist; then
254                 newicon "${S}"/other-licenses/branding/thunderbird/content/icon48.png thunderbird-icon.png
255                 domenu "${FILESDIR}"/icon/${PN}.desktop
256         else
257                 newicon "${S}"/mail/branding/unofficial/content/icon48.png thunderbird-icon-unbranded.png
258                 newmenu "${FILESDIR}"/icon/${PN}-unbranded.desktop \
259                         ${PN}.desktop
260
261                 sed -i -e "s:Mozilla\ Thunderbird:Lanikai:g" \
262                         "${ED}"/usr/share/applications/${PN}.desktop
263         fi
264
265         if use crypt ; then
266                 cd "${T}" || die
267                 unzip "${S}"/mozilla/dist/bin/enigmail*.xpi install.rdf || die
268                 emid=$(sed -n '/<em:id>/!d; s/.*\({.*}\).*/\1/; p; q' install.rdf)
269
270                 dodir ${MOZILLA_FIVE_HOME}/extensions/${emid} || die
271                 cd "${D}"${MOZILLA_FIVE_HOME}/extensions/${emid} || die
272                 unzip "${S}"/mozilla/dist/bin/enigmail*.xpi || die
273         fi
274
275         if use lightning ; then
276                 emid="{a62ef8ec-5fdc-40c2-873c-223b8a6925cc}"
277                 dodir ${MOZILLA_FIVE_HOME}/extensions/${emid}
278                 cd "${ED}"${MOZILLA_FIVE_HOME}/extensions/${emid}
279                 unzip "${S}"/mozilla/dist/xpi-stage/gdata-provider.xpi
280
281                 emid="calendar-timezones@mozilla.org"
282                 dodir ${MOZILLA_FIVE_HOME}/extensions/${emid}
283                 cd "${ED}"${MOZILLA_FIVE_HOME}/extensions/${emid}
284                 unzip "${S}"/mozilla/dist/xpi-stage/calendar-timezones.xpi
285
286                 emid="{e2fda1a4-762b-4020-b5ad-a41df1933103}"
287                 dodir ${MOZILLA_FIVE_HOME}/extensions/${emid}
288                 cd "${ED}"${MOZILLA_FIVE_HOME}/extensions/${emid}
289                 unzip "${S}"/mozilla/dist/xpi-stage/lightning.xpi
290
291                 # Fix mimetype so it shows up as a calendar application in GNOME 3
292                 # This requires that the .desktop file was already installed earlier
293                 sed -e "s:^\(MimeType=\):\1text/calendar;:" \
294                         -e "s:^\(Categories=\):\1Calendar;:" \
295                         -i "${ED}"/usr/share/applications/${PN}.desktop
296         fi
297
298         if ! [[ ${PV} =~ alpha|beta ]]; then
299                 linguas
300                 for X in "${linguas[@]}"; do
301                         xpi_install "${WORKDIR}/${P}-${X}"
302                 done
303         fi
304
305         pax-mark m "${ED}"/${MOZILLA_FIVE_HOME}/thunderbird-bin
306
307         # Enable very specific settings for thunderbird-3
308         cp "${FILESDIR}"/thunderbird-gentoo-default-prefs-1.js \
309                 "${ED}/${MOZILLA_FIVE_HOME}/defaults/pref/all-gentoo.js" || \
310                 die "failed to cp thunderbird-gentoo-default-prefs.js"
311 }
312
313 pkg_postinst() {
314         elog
315         elog "If you are experience problems with plugins please issue the"
316         elog "following command : rm \${HOME}/.thunderbird/*/extensions.sqlite ,"
317         elog "then restart thunderbird"
318 }