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 $
8 inherit flag-o-matic toolchain-funcs mozconfig-3 makeedit multilib mozextension autotools pax-utils python check-reqs
14 DESCRIPTION="Thunderbird Mail Client"
15 HOMEPAGE="http://www.mozilla.com/en-US/thunderbird/"
17 KEYWORDS="~alpha amd64 ~arm ~ppc ~ppc64 ~x86 ~x86-fbsd ~amd64-linux ~x86-linux"
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"
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"
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)
36 for X in "${LANGS[@]}" ; do
37 # en and en_US are handled internally
38 if [[ ${X} != en ]] && [[ ${X} != en-US ]]; then
40 linguas_${X/-/_}? ( ${FTP_URI}/${TB_PV}/linux-i686/xpi/${X}.xpi -> ${P}-${X}.xpi )"
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
47 linguas_${X%%-*}? ( ${FTP_URI}/${TB_PV}/linux-i686/xpi/${X}.xpi -> ${P}-${X}.xpi )"
48 IUSE="${IUSE} linguas_${X%%-*}"
53 RDEPEND=">=sys-devel/binutils-2.16.1
54 >=dev-libs/nss-3.12.10
56 crashreporter? ( net-misc/curl )
57 gconf? ( >=gnome-base/gconf-1.2.1:2 )
58 media-libs/libpng[apng]
59 webm? ( media-libs/libvpx
63 system-sqlite? ( >=dev-db/sqlite-3.7.5[fts3,secure-delete,unlock-notify,debug=] )
65 ( >=app-crypt/gnupg-2.0
67 app-crypt/pinentry[gtk]
68 app-crypt/pinentry[qt4]
76 S="${WORKDIR}"/comm-release
78 # TODO: Move all the linguas crap to an eclass
80 # Generate the list of language packs called "linguas"
81 # This list is used to install the xpi language packs
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
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//_/-})
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})
102 ewarn "Sorry, but ${P} does not support the ${LINGUA} locale"
109 export MOZILLA_DIR="${S}/mozilla"
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"
119 # Ensure we have enough disk space to compile
120 CHECKREQS_DISK_BUILD="4G"
127 if ! [[ ${PV} =~ alpha|beta ]]; then
129 for X in "${linguas[@]}"; do
130 xpi_unpack "${P}-${X}.xpi"
136 # Apply our Thunderbird patchset
137 EPATCH_SUFFIX="patch" \
139 epatch "${WORKDIR}/thunderbird"
141 # Apply our patchset from firefox to thunderbird as well
142 pushd "${S}"/mozilla &>/dev/null || die
143 EPATCH_SUFFIX="patch" \
145 epatch "${WORKDIR}/firefox"
146 popd &>/dev/null || die
148 if use lightning ; then
149 einfo "Fix lightning version to match upstream release"
151 sed -i -e 's:1.0b8pre:1.0:' "${S}"/calendar/sunbird/config/version.txt \
152 || die "Failed to correct lightning version"
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
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"
172 # Allow user to apply any additional patches without modifing ebuild
179 declare MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
180 MEXTENSIONS="default"
182 ####################################
184 # mozconfig, CFLAGS and CXXFLAGS setup
186 ####################################
191 # It doesn't compile on alpha without this LDFLAGS
192 use alpha && append-ldflags "-Wl,--no-relax"
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
200 # Use enable features
201 mozconfig_use_enable lightning calendar
202 mozconfig_use_enable gconf
206 MEXTENSIONS="${MEXTENSIONS},inspector"
209 # Finalize and report settings
212 ####################################
214 # Configure and build
216 ####################################
218 # Disable no-print-directory
219 MAKEOPTS=${MAKEOPTS/--no-print-directory/}
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
229 CPPFLAGS="${CPPFLAGS}" \
230 CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" \
237 # Only build enigmail extension if crypt enabled.
239 emake -C "${S}"/mailnews/extensions/enigmail || die "make enigmail failed"
240 emake -C "${S}"/mailnews/extensions/enigmail xpi || die "make enigmail xpi failed"
245 declare MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
248 # Pax mark xpcshell for hardened support, only used for startupcache creation.
249 pax-mark m "${S}"/mozilla/dist/bin/xpcshell
251 emake DESTDIR="${D}" install || die "emake install failed"
253 if ! use bindist; then
254 newicon "${S}"/other-licenses/branding/thunderbird/content/icon48.png thunderbird-icon.png
255 domenu "${FILESDIR}"/icon/${PN}.desktop
257 newicon "${S}"/mail/branding/unofficial/content/icon48.png thunderbird-icon-unbranded.png
258 newmenu "${FILESDIR}"/icon/${PN}-unbranded.desktop \
261 sed -i -e "s:Mozilla\ Thunderbird:Lanikai:g" \
262 "${ED}"/usr/share/applications/${PN}.desktop
267 unzip "${S}"/mozilla/dist/bin/enigmail*.xpi install.rdf || die
268 emid=$(sed -n '/<em:id>/!d; s/.*\({.*}\).*/\1/; p; q' install.rdf)
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
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
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
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
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
298 if ! [[ ${PV} =~ alpha|beta ]]; then
300 for X in "${linguas[@]}"; do
301 xpi_install "${WORKDIR}/${P}-${X}"
305 pax-mark m "${ED}"/${MOZILLA_FIVE_HOME}/thunderbird-bin
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"
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"