aboutsummaryrefslogtreecommitdiff
path: root/mail/thunderbird
diff options
context:
space:
mode:
Diffstat (limited to 'mail/thunderbird')
-rw-r--r--mail/thunderbird/Makefile71
-rw-r--r--mail/thunderbird/distinfo6
-rw-r--r--mail/thunderbird/files/extra-bug78053110
-rw-r--r--mail/thunderbird/files/patch-bug35118131
-rw-r--r--mail/thunderbird/files/patch-bug54324111
-rw-r--r--mail/thunderbird/files/patch-bug72386054
-rw-r--r--mail/thunderbird/files/patch-bug75304654
-rw-r--r--mail/thunderbird/files/patch-bug75945924
-rw-r--r--mail/thunderbird/files/patch-bug76089954
-rw-r--r--mail/thunderbird/files/patch-bug76103025
-rw-r--r--mail/thunderbird/files/patch-bug76141922
-rw-r--r--mail/thunderbird/files/patch-bug77467131
-rw-r--r--mail/thunderbird/files/patch-bug7780564
-rw-r--r--mail/thunderbird/files/patch-bug7780784
-rw-r--r--mail/thunderbird/files/patch-bug78147411
-rw-r--r--mail/thunderbird/files/patch-bug78477617
-rw-r--r--mail/thunderbird/files/patch-bug785638168
-rw-r--r--mail/thunderbird/files/patch-bug78810820
-rw-r--r--mail/thunderbird/files/patch-bug788955309
-rw-r--r--mail/thunderbird/files/patch-bug78943627
-rw-r--r--mail/thunderbird/files/patch-bug78965611
-rw-r--r--mail/thunderbird/files/patch-bug789693109
-rw-r--r--mail/thunderbird/files/patch-bug791305107
-rw-r--r--mail/thunderbird/files/patch-bug79136695
-rw-r--r--mail/thunderbird/files/patch-config-baseconfig.mk16
-rw-r--r--mail/thunderbird/files/patch-mozilla-config_autoconf.mk.in22
-rw-r--r--mail/thunderbird/files/patch-mozilla-content-media-nsAudioStream.cpp14
-rw-r--r--mail/thunderbird/files/patch-mozilla-extensions-spellcheck-hunspell-src-mozHunspell.cpp15
-rw-r--r--mail/thunderbird/files/patch-mozilla_toolkit_xre_glxtest.cpp25
29 files changed, 841 insertions, 526 deletions
diff --git a/mail/thunderbird/Makefile b/mail/thunderbird/Makefile
index af83f3bca19d..0c8ec0cd9367 100644
--- a/mail/thunderbird/Makefile
+++ b/mail/thunderbird/Makefile
@@ -6,22 +6,25 @@
#
PORTNAME= thunderbird
-DISTVERSION= 15.0.1
+DISTVERSION= 16.0
CATEGORIES= mail ipv6
MASTER_SITES= ${MASTER_SITE_MOZILLA}
MASTER_SITE_SUBDIR= ${PORTNAME}/releases/${DISTVERSION}/source
-DISTNAME= ${PORTNAME}-${DISTVERSION}.source
+DISTFILES= ${PORTNAME}-${DISTVERSION}.source${EXTRACT_SUFX}
+EXTRACT_ONLY= ${PORTNAME}-${DISTVERSION}.source${EXTRACT_SUFX}
MAINTAINER= gecko@FreeBSD.org
COMMENT= Mozilla Thunderbird is standalone mail and news that stands above
BUILD_DEPENDS= nspr>=4.9:${PORTSDIR}/devel/nspr \
- nss>=3.13.2:${PORTSDIR}/security/nss \
+ nss>=3.13.6_1:${PORTSDIR}/security/nss \
sqlite3>=3.7.12.1:${PORTSDIR}/databases/sqlite3 \
${PYTHON_SITELIBDIR}/_sqlite3.so:${PORTSDIR}/databases/py-sqlite3 \
cairo>=1.10.2_1,1:${PORTSDIR}/graphics/cairo \
unzip:${PORTSDIR}/archivers/unzip
+EM_VERSION= 1.4.5
+
USE_AUTOTOOLS= autoconf213:env
USE_PYTHON_BUILD=yes
USE_GECKO= gecko
@@ -52,7 +55,8 @@ PORTNAME_ICON_SRC= ${PREFIX}/lib/${MOZILLA}/chrome/icons/default/default48.png
SYSTEM_PREFS= ${FAKEDIR}/lib/${PORTNAME}/defaults/pref/${PORTNAME}.js
MOZ_PIS_SCRIPTS=moz_pis_S50cleanhome
-OPTIONS_DEFINE= GSTREAMER LIGHTNING
+OPTIONS_DEFINE= ENIGMAIL GSTREAMER LIGHTNING
+OPTIONS_DEFAULT=ENIGMAIL LIGHTNING
.include "${.CURDIR}/../../www/firefox/Makefile.options"
.include <bsd.port.pre.mk>
@@ -60,6 +64,8 @@ OPTIONS_DEFINE= GSTREAMER LIGHTNING
WRKSRC= ${WRKDIR}/comm-release
MOZSRC:= ${WRKSRC}/mozilla
+XPI_LIBDIR= ${PREFIX}/lib/xpi
+
.if ${ARCH} == amd64
CONFIGURE_TARGET=x86_64-portbld-freebsd${OSREL}
.elif ${ARCH} == powerpc64
@@ -75,12 +81,25 @@ CFLAGS+= -mminimal-toc
BUILD_DEPENDS+= yasm:${PORTSDIR}/devel/yasm
.endif
+.if ${PORT_OPTIONS:MENIGMAIL}
+MASTER_SITES+= http://www.enigmail.net/download/source/:enigmail
+DISTFILES+= ${EM_DISTFILE}:enigmail
+RUN_DEPENDS+= gpg:${PORTSDIR}/security/gnupg
+EM_DISTNAME= enigmail-${EM_VERSION}
+EM_DISTFILE= ${EM_DISTNAME}.tar.gz
+EM_XPI_FILE= ${MOZ_OBJDIR}/mozilla/dist/bin/${EM_DISTNAME}-freebsd-${ARCH:S/amd64/x86_64/}.xpi
+EM_ORIG_ID= {847b3a00-7ab1-11d4-8f02-006008948af5}
+EM_ID= ${PORTNAME}@mozilla-enigmail.org
+EM_ID_RFILES= ${XPI_LIBDIR}/${EM_ID}/install.rdf \
+ ${XPI_LIBDIR}/${EM_ID}/components/enigmail.js \
+ ${XPI_LIBDIR}/${EM_ID}/modules/enigmailCommon.jsm
+.endif
+
.if ${PORT_OPTIONS:MLIGHTNING}
MOZ_OPTIONS+= --enable-calendar
MOZ_MK_OPTIONS+= MOZ_CO_PROJECT=calendar
LIGHTNING_DIR= share/lightning
XPI_FILE= ${MOZ_OBJDIR}/mozilla/dist/xpi-stage/lightning.xpi
-XPI_LIBDIR= ${PREFIX}/lib/xpi
XPI_ORIG_ID= {e2fda1a4-762b-4020-b5ad-a41df1933103}
XPI_ID= lightning@thunderbird.mozilla.org
.else
@@ -90,16 +109,38 @@ MOZ_OPTIONS+= --disable-calendar
post-extract:
@${SED} -e 's|@PORTNAME_ICON@|${PORTNAME_ICON}|;s|@MOZILLA@|${MOZILLA}|' \
<${FILESDIR}/thunderbird.desktop.in >${WRKDIR}/${MOZILLA_EXEC_NAME}.desktop
+.if ${PORT_OPTIONS:MENIGMAIL}
+ @${TAR} -xf ${_DISTDIR}/${EM_DISTFILE} \
+ -C ${WRKSRC}/mailnews/extensions
+.endif
post-patch:
@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
${WRKSRC}/mail/app/nsMailApp.cpp
+.if ${PORT_OPTIONS:MENIGMAIL}
+ @${REINPLACE_CMD} -e 's,/usr/bin/perl,${PERL},' \
+ ${WRKSRC}/mailnews/extensions/enigmail/makemake
+ @${REINPLACE_CMD} -e '/^xpi/s/$$/ all/' \
+ -e '/^XPI_MODULE_VERS/s/= .*/= ${EM_VERSION}/' \
+ ${WRKSRC}/mailnews/extensions/enigmail/Makefile.in
+ @${REINPLACE_CMD} -e '/em:version/s,>[^<]*<,>${EM_VERSION}<,' \
+ -e '/em:maxVersion/s/pre//' \
+ ${WRKSRC}/mailnews/extensions/enigmail/package/install.rdf
+.endif
pre-configure:
(cd ${WRKSRC} && ${AUTOCONF})
(cd ${MOZSRC} && ${AUTOCONF})
(cd ${MOZSRC}/js/src/ && ${AUTOCONF})
+.if ${PORT_OPTIONS:MENIGMAIL}
+post-build:
+ cd ${WRKSRC}/mailnews/extensions/enigmail && \
+ ./makemake -r -o ${MOZ_OBJDIR}
+ ${SETENV} ${MAKE_ENV} ${GMAKE} ${_MAKE_JOBS} all xpi \
+ -C ${MOZ_OBJDIR}/mailnews/extensions/enigmail
+.endif
+
port-pre-install:
${MKDIR} ${FAKEDIR}/lib/${PORTNAME}/defaults
@@ -127,7 +168,25 @@ post-install:
@${ECHO_CMD} '@unexec ${RM} -f ${LOCALBASE}/lib/thunderbird/extensions/${XPI_ID}' >> ${TMPPLIST}
@(cd ${XPI_LIBDIR}; ${FIND} ${XPI_ID} -type d) | ${SORT} -r | \
${SED} -ne 's,^,@dirrm lib/xpi/,p' >> ${TMPPLIST}
- @${ECHO_CMD} '@unexec rmdir %D/lib/xpi/symlinks/thunderbird 2>/dev/null || true' >> ${TMPPLIST}
+.endif
+.if ${PORT_OPTIONS:MENIGMAIL}
+ @${MKDIR} ${XPI_LIBDIR}/${EM_ID} ${XPI_LIBDIR}/symlinks/${PORTNAME}
+ @(cd ${XPI_LIBDIR}/${EM_ID}; ${TAR} -xf ${EM_XPI_FILE})
+ @${CHOWN} -R ${SHAREOWN}:${SHAREGRP} ${XPI_LIBDIR}/${EM_ID}
+ @${REINPLACE_CMD} -i "" "s/${EM_ORIG_ID}/${EM_ID}/" ${EM_ID_RFILES}
+ @${CHMOD} -R a+rX,go-w ${XPI_LIBDIR}/${EM_ID}
+ @${LN} -sf ${XPI_LIBDIR}/${EM_ID} ${LOCALBASE}/lib/${PORTNAME}/extensions 2>/dev/null || true
+ @${LN} -sf ${XPI_LIBDIR}/${EM_ID} ${XPI_LIBDIR}/symlinks/${PORTNAME} 2>/dev/null || true
+ @(cd ${XPI_LIBDIR}; ${FIND} ${EM_ID} -not -type d) | ${SORT} | \
+ ${SED} -ne 's,^,lib/xpi/,p' >> ${TMPPLIST}
+ @${ECHO_CMD} 'lib/xpi/symlinks/${PORTNAME}/${EM_ID}' >> ${TMPPLIST}
+ @${ECHO_CMD} '@exec ${LN} -sf %D/lib/xpi/${EM_ID} ${LOCALBASE}/lib/${PORTNAME}/extensions 2>/dev/null || true' >> ${TMPPLIST}
+ @${ECHO_CMD} '@unexec ${RM} -f ${LOCALBASE}/lib/${PORTNAME}/extensions/${EM_ID}' >> ${TMPPLIST}
+ @(cd ${XPI_LIBDIR}; ${FIND} ${EM_ID} -type d) | ${SORT} -r | \
+ ${SED} -ne 's,^,@dirrm lib/xpi/,p' >> ${TMPPLIST}
+.endif
+.if ${PORT_OPTIONS:MLIGHTNING} || ${PORT_OPTIONS:MENIGMAIL}
+ @${ECHO_CMD} '@unexec rmdir %D/lib/xpi/symlinks/${PORTNAME} 2>/dev/null || true' >> ${TMPPLIST}
@${ECHO_CMD} '@unexec rmdir %D/lib/xpi/symlinks 2>/dev/null || true' >> ${TMPPLIST}
@${ECHO_CMD} '@unexec rmdir %D/lib/xpi 2>/dev/null || true' >> ${TMPPLIST}
.endif
diff --git a/mail/thunderbird/distinfo b/mail/thunderbird/distinfo
index c853790998fd..e44280bdd031 100644
--- a/mail/thunderbird/distinfo
+++ b/mail/thunderbird/distinfo
@@ -1,2 +1,4 @@
-SHA256 (thunderbird-15.0.1.source.tar.bz2) = bfa24c3595dae6c3ee3cbaca789e8b81bb47096127a7149c571d553f538cefc7
-SIZE (thunderbird-15.0.1.source.tar.bz2) = 105942872
+SHA256 (thunderbird-16.0.source.tar.bz2) = 868f8f0e333a363170f61074a92b2ee102ab8901077783a5d941424b51284d6b
+SIZE (thunderbird-16.0.source.tar.bz2) = 111414218
+SHA256 (enigmail-1.4.5.tar.gz) = fa59491fba21de9414a003933349074a8ec1833a1d64cac9f0a9f7020ed6c020
+SIZE (enigmail-1.4.5.tar.gz) = 1269207
diff --git a/mail/thunderbird/files/extra-bug780531 b/mail/thunderbird/files/extra-bug780531
index a63bcaed35fa..a035ce397cc7 100644
--- a/mail/thunderbird/files/extra-bug780531
+++ b/mail/thunderbird/files/extra-bug780531
@@ -1,13 +1,12 @@
--- mozilla/configure.in~
+++ mozilla/configure.in
-@@ -5585,10 +5585,13 @@ if test -n "$MOZ_OGG"; then
+@@ -5282,10 +5282,13 @@ if test -n "$MOZ_OGG"; then
MOZ_SYDNEYAUDIO=1
MOZ_CUBEB=1
MOZ_MEDIA=1
- case "$target_cpu" in
-- arm*)
+ case "$target" in
-+ arm-*-linux*)
+ arm*)
MOZ_TREMOR=1
;;
+ *-freebsd*)
@@ -16,14 +15,13 @@
*)
MOZ_VORBIS=1
;;
-@@ -5715,10 +5720,13 @@ if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIV
+@@ -5417,10 +5420,13 @@ if test "$MOZ_WEBM"; then
MOZ_SYDNEYAUDIO=1
MOZ_CUBEB=1
MOZ_MEDIA=1
- case "$target_cpu" in
-- arm*)
+ case "$target" in
-+ arm-*-linux*)
+ arm*)
MOZ_TREMOR=1
;;
+ *-freebsd*)
diff --git a/mail/thunderbird/files/patch-bug351181 b/mail/thunderbird/files/patch-bug351181
deleted file mode 100644
index fdf4840c1441..000000000000
--- a/mail/thunderbird/files/patch-bug351181
+++ /dev/null
@@ -1,31 +0,0 @@
---- mozilla/js/src/jsnum.cpp.orig 2010-01-05 22:35:17.000000000 -0500
-+++ mozilla/js/src/jsnum.cpp 2010-01-11 05:10:19.000000000 -0500
-@@ -49,6 +49,9 @@
- // Avoid warnings about ASSERT being defined by the assembler as well.
- #undef ASSERT
-
-+#if defined(__FreeBSD__)
-+#include <sys/param.h>
-+#endif
- #ifdef XP_OS2
- #define _PC_53 PC_53
- #define _MCW_EM MCW_EM
-@@ -691,8 +694,18 @@
-
- #else
-
-+#if defined(__FreeBSD__)
-+#if __BSD_VISIBLE == 0
-+#error __BSD_VISIBLE is zero, so fedisableexcept is not defined
-+#endif
-+#include <fenv.h>
-+#define FIX_FPU() ((void)fedisableexcept(FE_ALL_EXCEPT))
-+#else
-+
- #define FIX_FPU() ((void)0)
-
-+#endif /* defined(__FreeBSD__) && __FreeBSD_version >= 503000 */
-+
- #endif
-
- JSBool
diff --git a/mail/thunderbird/files/patch-bug543241 b/mail/thunderbird/files/patch-bug543241
index 3cb45f175317..2aac3bb44466 100644
--- a/mail/thunderbird/files/patch-bug543241
+++ b/mail/thunderbird/files/patch-bug543241
@@ -1,5 +1,16 @@
--- ./mozilla/xpcom/threads/nsThreadManager.cpp.orig 2011-08-25 02:37:45.000000000 +0200
+++ ./mozilla/xpcom/threads/nsThreadManager.cpp 2011-08-28 17:14:14.000000000 +0200
+@@ -12,6 +12,10 @@
+ #include "nsAutoPtr.h"
+ #include "nsCycleCollectorUtils.h"
+
++#if defined(__FreeBSD__)
++#include <osreldate.h>
++#endif
++
+ using namespace mozilla;
+
+ #ifdef XP_WIN
@@ -57,6 +57,11 @@
nsresult
nsThreadManager::Init()
diff --git a/mail/thunderbird/files/patch-bug723860 b/mail/thunderbird/files/patch-bug723860
deleted file mode 100644
index d76dbfe6d20c..000000000000
--- a/mail/thunderbird/files/patch-bug723860
+++ /dev/null
@@ -1,54 +0,0 @@
-commit 4e07587
-Author: Matthew Gregan <kinetik@flim.org>
-Date: Wed Jun 6 17:58:07 2012 +1200
-
- Bug 723860 - Early bail from reader's GetBuffered() if not yet initialized. r=doublec
----
- content/media/gstreamer/nsGStreamerReader.cpp | 4 ++++
- content/media/ogg/nsOggReader.cpp | 3 +--
- content/media/wave/nsWaveReader.cpp | 3 +++
- 3 files changed, 8 insertions(+), 2 deletions(-)
-
-diff --git mozilla/content/media/gstreamer/nsGStreamerReader.cpp mozilla/content/media/gstreamer/nsGStreamerReader.cpp
-index 164fb2e..06a09b5 100644
---- mozilla/content/media/gstreamer/nsGStreamerReader.cpp
-+++ mozilla/content/media/gstreamer/nsGStreamerReader.cpp
-@@ -505,6 +505,10 @@ nsresult nsGStreamerReader::Seek(PRInt64 aTarget,
- nsresult nsGStreamerReader::GetBuffered(nsTimeRanges* aBuffered,
- PRInt64 aStartTime)
- {
-+ if (!mInfo.mHasVideo && !mInfo.mHasAudio) {
-+ return NS_OK;
-+ }
-+
- GstFormat format = GST_FORMAT_TIME;
- MediaResource* resource = mDecoder->GetResource();
- gint64 resourceLength = resource->GetLength();
-diff --git mozilla/content/media/ogg/nsOggReader.cpp mozilla/content/media/ogg/nsOggReader.cpp
-index c6ff008..8d40e2c 100644
---- mozilla/content/media/ogg/nsOggReader.cpp
-+++ mozilla/content/media/ogg/nsOggReader.cpp
-@@ -1532,8 +1532,7 @@ nsresult nsOggReader::GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime)
- {
- // HasAudio and HasVideo are not used here as they take a lock and cause
- // a deadlock. Accessing mInfo doesn't require a lock - it doesn't change
-- // after metadata is read and GetBuffered isn't called before metadata is
-- // read.
-+ // after metadata is read.
- if (!mInfo.mHasVideo && !mInfo.mHasAudio) {
- // No need to search through the file if there are no audio or video tracks
- return NS_OK;
-diff --git mozilla/content/media/wave/nsWaveReader.cpp mozilla/content/media/wave/nsWaveReader.cpp
-index 7242eb5..60fc1e1 100644
---- mozilla/content/media/wave/nsWaveReader.cpp
-+++ mozilla/content/media/wave/nsWaveReader.cpp
-@@ -239,6 +239,9 @@ static double RoundToUsecs(double aSeconds) {
-
- nsresult nsWaveReader::GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime)
- {
-+ if (!mInfo.mHasAudio) {
-+ return NS_OK;
-+ }
- PRInt64 startOffset = mDecoder->GetResource()->GetNextCachedData(mWavePCMOffset);
- while (startOffset >= 0) {
- PRInt64 endOffset = mDecoder->GetResource()->GetCachedDataEnd(startOffset);
diff --git a/mail/thunderbird/files/patch-bug753046 b/mail/thunderbird/files/patch-bug753046
index d20eebb42a3c..658d47f827bb 100644
--- a/mail/thunderbird/files/patch-bug753046
+++ b/mail/thunderbird/files/patch-bug753046
@@ -456,7 +456,7 @@ $NetBSD: patch-ipc_chromium_src_base_platform__thread.h,v 1.1 2012/03/06 12:34:0
--- mozilla/ipc/chromium/src/base/platform_thread.h.orig 2011-12-20 23:28:19.000000000 +0000
+++ mozilla/ipc/chromium/src/base/platform_thread.h
-@@ -22,9 +22,11 @@ typedef void* PlatformThreadHandle; // HANDLE
+@@ -22,9 +22,12 @@ typedef void* PlatformThreadHandle; // HANDLE
#elif defined(OS_POSIX)
#include <pthread.h>
typedef pthread_t PlatformThreadHandle;
@@ -465,6 +465,7 @@ $NetBSD: patch-ipc_chromium_src_base_platform__thread.h,v 1.1 2012/03/06 12:34:0
#include <unistd.h>
typedef pid_t PlatformThreadId;
+#elif defined(OS_BSD)
++#include <sys/types.h>
+typedef lwpid_t PlatformThreadId;
#elif defined(OS_MACOSX)
#include <mach/mach.h>
@@ -978,57 +979,6 @@ $NetBSD: patch-ipc_chromium_src_base_sys__info__posix.cc,v 1.2 2011/11/27 13:09:
#else
long pages = sysconf(_SC_PHYS_PAGES);
long page_size = sysconf(_SC_PAGE_SIZE);
-$NetBSD: patch-ipc_chromium_src_base_third__party_nspr_prcpucfg.h,v 1.2 2012/03/06 12:34:09 ryoon Exp $
-
---- mozilla/ipc/chromium/src/base/third_party/nspr/prcpucfg.h.orig 2011-12-20 23:28:19.000000000 +0000
-+++ mozilla/ipc/chromium/src/base/third_party/nspr/prcpucfg.h
-@@ -34,7 +34,7 @@
- #include "base/third_party/nspr/prcpucfg_win.h"
- #elif defined(__APPLE__)
- #include "base/third_party/nspr/prcpucfg_mac.h"
--#elif defined(__linux__) || defined(ANDROID)
-+#elif defined(__linux__) || defined(ANDROID) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
- #include "base/third_party/nspr/prcpucfg_linux.h"
- #elif defined(__OpenBSD__)
- #include "base/third_party/nspr/prcpucfg_openbsd.h"
-$NetBSD: patch-ipc_chromium_src_base_third__party_nspr_prtime.cc,v 1.1 2012/03/06 12:34:09 ryoon Exp $
-
---- mozilla/ipc/chromium/src/base/third_party/nspr/prtime.cc.orig 2011-12-20 23:28:19.000000000 +0000
-+++ mozilla/ipc/chromium/src/base/third_party/nspr/prtime.cc
-@@ -212,7 +212,7 @@ PR_ImplodeTime(const PRExplodedTime *exp
- LL_ADD(retVal, retVal, temp);
-
- return retVal;
--#elif defined(OS_LINUX)
-+#elif defined(OS_LINUX) || defined(OS_DRAGONFLY)
- struct tm exp_tm = {0};
- exp_tm.tm_sec = exploded->tm_sec;
- exp_tm.tm_min = exploded->tm_min;
-@@ -245,6 +245,24 @@ PR_ImplodeTime(const PRExplodedTime *exp
- result *= kSecondsToMicroseconds;
- result += exploded->tm_usec;
- return result;
-+#elif defined(OS_FREEBSD) || defined(OS_NETBSD)
-+ struct tm exp_tm = {0};
-+ exp_tm.tm_sec = exploded->tm_sec;
-+ exp_tm.tm_min = exploded->tm_min;
-+ exp_tm.tm_hour = exploded->tm_hour;
-+ exp_tm.tm_mday = exploded->tm_mday;
-+ exp_tm.tm_mon = exploded->tm_month;
-+ exp_tm.tm_year = exploded->tm_year - 1900;
-+
-+ // time_t is 64bit
-+ time_t absolute_time = timegm(&exp_tm);
-+
-+ PRTime result = static_cast<PRTime>(absolute_time);
-+ result -= exploded->tm_params.tp_gmt_offset +
-+ exploded->tm_params.tp_dst_offset;
-+ result *= kSecondsToMicroseconds;
-+ result += exploded->tm_usec;
-+ return result;
- #else
- #error No PR_ImplodeTime implemented on your platform.
- #endif
diff --git ipc/chromium/src/base/time_posix.cc ipc/chromium/src/base/time_posix.cc
index abf2a56..48791f6 100644
--- mozilla/ipc/chromium/src/base/time_posix.cc
diff --git a/mail/thunderbird/files/patch-bug759459 b/mail/thunderbird/files/patch-bug759459
deleted file mode 100644
index 5434a759b353..000000000000
--- a/mail/thunderbird/files/patch-bug759459
+++ /dev/null
@@ -1,24 +0,0 @@
-commit 4d0c5b9
-Author: Marco Perez <bugmail@millibyte.net>
-Date: Sat Jun 9 12:24:56 2012 -0400
-
- Bug 759459 - Build broken on FreeBSD since patch for bug 745034 landed. r=terrence
----
- js/src/gc/Memory.cpp | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git js/src/gc/Memory.cpp js/src/gc/Memory.cpp
-index 815e90b..10c1a91 100644
---- mozilla/js/src/gc/Memory.cpp
-+++ mozilla/js/src/gc/Memory.cpp
-@@ -292,9 +292,9 @@ GetPageFaultCount()
- #elif defined(XP_UNIX) || defined(XP_MACOSX) || defined(DARWIN)
-
- #include <sys/mman.h>
--#include <unistd.h>
- #include <sys/time.h>
- #include <sys/resource.h>
-+#include <unistd.h>
-
- void
- InitMemorySubsystem()
diff --git a/mail/thunderbird/files/patch-bug760899 b/mail/thunderbird/files/patch-bug760899
deleted file mode 100644
index c81b855e7fc2..000000000000
--- a/mail/thunderbird/files/patch-bug760899
+++ /dev/null
@@ -1,54 +0,0 @@
-commit 667daed
-Author: Stephen Moehle <stephen.moehle@gmail.com>
-Date: Tue Jun 5 11:32:36 2012 +1200
-
- Bug 760899 - Fix debug builds with gstreamer enabled - r=kinetik
-
- --HG--
- extra : rebase_source : 22598bc470d35d94991ea9f1b14df11ba19a461a
----
- content/media/gstreamer/nsGStreamerReader.cpp | 10 +++++-----
- 1 file changed, 5 insertions(+), 5 deletions(-)
-
-diff --git content/media/gstreamer/nsGStreamerReader.cpp content/media/gstreamer/nsGStreamerReader.cpp
-index 6a50e09..164fb2e 100644
---- mozilla/content/media/gstreamer/nsGStreamerReader.cpp
-+++ mozilla/content/media/gstreamer/nsGStreamerReader.cpp
-@@ -278,7 +278,7 @@ nsresult nsGStreamerReader::ReadMetadata(nsVideoInfo* aInfo)
- if (gst_element_query_duration(GST_ELEMENT(mPlayBin),
- &format, &duration) && format == GST_FORMAT_TIME) {
- ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
-- LOG(PR_LOG_DEBUG, ("returning duration %"GST_TIME_FORMAT,
-+ LOG(PR_LOG_DEBUG, ("returning duration %" GST_TIME_FORMAT,
- GST_TIME_ARGS (duration)));
- duration = GST_TIME_AS_USECONDS (duration);
- mDecoder->GetStateMachine()->SetDuration(duration);
-@@ -422,8 +422,8 @@ bool nsGStreamerReader::DecodeVideoFrame(bool &aKeyFrameSkip,
- nextTimestamp += gst_util_uint64_scale(GST_USECOND, fpsNum, fpsDen);
-
- if (timestamp < aTimeThreshold) {
-- LOG(PR_LOG_DEBUG, ("skipping frame %"GST_TIME_FORMAT
-- " threshold %"GST_TIME_FORMAT,
-+ LOG(PR_LOG_DEBUG, ("skipping frame %" GST_TIME_FORMAT
-+ " threshold %" GST_TIME_FORMAT,
- GST_TIME_ARGS(timestamp), GST_TIME_ARGS(aTimeThreshold)));
- gst_buffer_unref(buffer);
- buffer = NULL;
-@@ -489,7 +489,7 @@ nsresult nsGStreamerReader::Seek(PRInt64 aTarget,
- NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
-
- gint64 seekPos = aTarget * GST_USECOND;
-- LOG(PR_LOG_DEBUG, ("%p About to seek to %"GST_TIME_FORMAT,
-+ LOG(PR_LOG_DEBUG, ("%p About to seek to %" GST_TIME_FORMAT,
- mDecoder, GST_TIME_ARGS(seekPos)));
-
- if (!gst_element_seek_simple(mPlayBin, GST_FORMAT_TIME,
-@@ -592,7 +592,7 @@ PRInt64 nsGStreamerReader::QueryDuration()
- if (gst_element_query_duration(GST_ELEMENT(mPlayBin),
- &format, &duration)) {
- if (format == GST_FORMAT_TIME) {
-- LOG(PR_LOG_DEBUG, ("pipeline duration %"GST_TIME_FORMAT,
-+ LOG(PR_LOG_DEBUG, ("pipeline duration %" GST_TIME_FORMAT,
- GST_TIME_ARGS (duration)));
- duration = GST_TIME_AS_USECONDS (duration);
- }
diff --git a/mail/thunderbird/files/patch-bug761030 b/mail/thunderbird/files/patch-bug761030
deleted file mode 100644
index d6b96cc697f3..000000000000
--- a/mail/thunderbird/files/patch-bug761030
+++ /dev/null
@@ -1,25 +0,0 @@
-commit 8bc9e15
-Author: Stephen Moehle <stephen.moehle@gmail.com>
-Date: Tue Jun 5 11:31:13 2012 +1200
-
- Bug 761030 - Fix crash with HTML 5 video with GStreamer enabled - r=kinetik
-
- --HG--
- extra : rebase_source : 5e884550f9870bd2fda247d50bebd472e8368588
----
- content/media/gstreamer/nsGStreamerReader.cpp | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git mozilla/content/media/gstreamer/nsGStreamerReader.cpp mozilla/content/media/gstreamer/nsGStreamerReader.cpp
-index 17374a3..6a50e09 100644
---- mozilla/content/media/gstreamer/nsGStreamerReader.cpp
-+++ mozilla/content/media/gstreamer/nsGStreamerReader.cpp
-@@ -452,6 +452,8 @@ bool nsGStreamerReader::DecodeVideoFrame(bool &aKeyFrameSkip,
- i, height);
- b.mPlanes[i].mWidth = gst_video_format_get_component_width(format,
- i, width);
-+ b.mPlanes[i].mOffset = 0;
-+ b.mPlanes[i].mSkip = 0;
- }
-
- bool isKeyframe = !GST_BUFFER_FLAG_IS_SET(buffer,
diff --git a/mail/thunderbird/files/patch-bug761419 b/mail/thunderbird/files/patch-bug761419
deleted file mode 100644
index 0c8c3d1d155a..000000000000
--- a/mail/thunderbird/files/patch-bug761419
+++ /dev/null
@@ -1,22 +0,0 @@
-commit f0a73aa
-Author: Paul Adenot <paul@paul.cx>
-Date: Thu Jun 21 20:44:39 2012 -0400
-
- Bug 761419 - Build failure in content/media/gstreamer/nsGStreamerReader.cpp when using clang r=kinetik
----
- content/media/gstreamer/nsGStreamerReader.cpp | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git content/media/gstreamer/nsGStreamerReader.cpp content/media/gstreamer/nsGStreamerReader.cpp
-index 06a09b5..c48f92e 100644
---- mozilla/content/media/gstreamer/nsGStreamerReader.cpp
-+++ mozilla/content/media/gstreamer/nsGStreamerReader.cpp
-@@ -191,7 +191,7 @@ nsresult nsGStreamerReader::ReadMetadata(nsVideoInfo* aInfo)
- * stream but that are otherwise decodeable.
- */
- guint flags[3] = {GST_PLAY_FLAG_VIDEO|GST_PLAY_FLAG_AUDIO,
-- ~GST_PLAY_FLAG_AUDIO, ~GST_PLAY_FLAG_VIDEO};
-+ static_cast<guint>(~GST_PLAY_FLAG_AUDIO), static_cast<guint>(~GST_PLAY_FLAG_VIDEO)};
- guint default_flags, current_flags;
- g_object_get(mPlayBin, "flags", &default_flags, NULL);
-
diff --git a/mail/thunderbird/files/patch-bug774671 b/mail/thunderbird/files/patch-bug774671
index 35fbe946041c..bc1c63bc2245 100644
--- a/mail/thunderbird/files/patch-bug774671
+++ b/mail/thunderbird/files/patch-bug774671
@@ -1,6 +1,31 @@
---- mozilla/js/src/jsprvtd.h.orig 2012-08-25 02:31:13.000000000 +0200
-+++ mozilla/js/src/jsprvtd.h 2012-09-06 17:14:09.000000000 +0200
-@@ -149,9 +149,9 @@
+commit 7e9eda2
+Author: Rafael Ávila de Espíndola <respindola@mozilla.com>
+Date: Tue Jul 17 12:54:41 2012 -0400
+
+ Bug 774671 - Fix mismatched declarations. r=luke.
+---
+ mozilla/js/src/jsproxy.h | 2 +-
+ mozilla/js/src/jsprvtd.h | 6 +++---
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git mozilla/js/src/jsproxy.h mozilla/js/src/jsproxy.h
+index ec26e3a..aa0e782 100644
+--- mozilla/js/src/jsproxy.h
++++ mozilla/js/src/jsproxy.h
+@@ -13,7 +13,7 @@
+
+ namespace js {
+
+-class Wrapper;
++class JS_FRIEND_API(Wrapper);
+
+ /*
+ * A proxy is a JSObject that implements generic behavior by providing custom
+diff --git mozilla/js/src/jsprvtd.h mozilla/js/src/jsprvtd.h
+index 19b5aef..93e1216 100644
+--- mozilla/js/src/jsprvtd.h
++++ mozilla/js/src/jsprvtd.h
+@@ -146,9 +146,9 @@ struct TreeContext;
class UpvarCookie;
class Proxy;
diff --git a/mail/thunderbird/files/patch-bug778056 b/mail/thunderbird/files/patch-bug778056
index 72eba848047d..468c103e4bf5 100644
--- a/mail/thunderbird/files/patch-bug778056
+++ b/mail/thunderbird/files/patch-bug778056
@@ -4,9 +4,9 @@
#if defined(XP_UNIX)
# include <unistd.h> // for valloc on *BSD
#endif //if defined(XP_UNIX)
-+#ifdef __FreeBSD__
++#if defined(__FreeBSD__)
+# include <malloc_np.h> // for malloc_usable_size
-+#endif
++#endif // if defined(__FreeBSD__)
#if defined(XP_WIN) || (defined(XP_OS2) && defined(__declspec))
# define MOZALLOC_EXPORT __declspec(dllexport)
diff --git a/mail/thunderbird/files/patch-bug778078 b/mail/thunderbird/files/patch-bug778078
index fc29c1ca5ecb..27be88312b95 100644
--- a/mail/thunderbird/files/patch-bug778078
+++ b/mail/thunderbird/files/patch-bug778078
@@ -1,9 +1,9 @@
--- mozilla/toolkit/xre/nsAppRunner.cpp~
+++ mozilla/toolkit/xre/nsAppRunner.cpp
-@@ -3819,7 +3819,7 @@ XREMain::XRE_main(int argc, char* argv[]
+@@ -3833,7 +3833,7 @@ XREMain::XRE_main(int argc, char* argv[]
ScopedLogging log;
- #if defined(MOZ_WIDGET_GTK2)
+ #if defined(MOZ_WIDGET_GTK)
-#ifdef MOZ_MEMORY
+#if defined(MOZ_MEMORY) || defined(__FreeBSD__) || defined(__NetBSD__)
// Disable the slice allocator, since jemalloc already uses similar layout
diff --git a/mail/thunderbird/files/patch-bug781474 b/mail/thunderbird/files/patch-bug781474
deleted file mode 100644
index 358d40c1f988..000000000000
--- a/mail/thunderbird/files/patch-bug781474
+++ /dev/null
@@ -1,11 +0,0 @@
---- mozilla/content/base/public/nsContentUtils.h.orig 2011-07-07 10:44:49.000000000 +0200
-+++ mozilla/content/base/public/nsContentUtils.h 2011-07-07 10:46:12.000000000 +0200
-@@ -54,7 +54,7 @@
- //A trick to handle IEEE floating point exceptions on FreeBSD - E.D.
- #ifdef __FreeBSD__
- #include <ieeefp.h>
--#ifdef __alpha__
-+#if !defined(__amd64__) && !defined(__i386__)
- static fp_except_t allmask = FP_X_INV|FP_X_OFL|FP_X_UFL|FP_X_DZ|FP_X_IMP;
- #else
- static fp_except_t allmask = FP_X_INV|FP_X_OFL|FP_X_UFL|FP_X_DZ|FP_X_IMP|FP_X_DNML;
diff --git a/mail/thunderbird/files/patch-bug784776 b/mail/thunderbird/files/patch-bug784776
index fbc597902017..95d60a104809 100644
--- a/mail/thunderbird/files/patch-bug784776
+++ b/mail/thunderbird/files/patch-bug784776
@@ -1,20 +1,3 @@
---- mozilla/content/media/MediaEngineDefault.cpp~
-+++ mozilla/content/media/MediaEngineDefault.cpp
-@@ -232,12 +232,12 @@ nsresult
- MediaEngineDefaultAudioSource::Start(SourceMediaStream* aStream, TrackID aID)
- {
- if (mState != kAllocated) {
-- return NULL;
-+ return 0;
- }
-
- mTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
- if (!mTimer) {
-- return NULL;
-+ return 0;
- }
-
- mSource = aStream;
--- mozilla/gfx/layers/opengl/ImageLayerOGL.cpp~
+++ mozilla/gfx/layers/opengl/ImageLayerOGL.cpp
@@ -936,7 +936,7 @@ ShadowImageLayerOGL::CleanupResources()
diff --git a/mail/thunderbird/files/patch-bug785638 b/mail/thunderbird/files/patch-bug785638
deleted file mode 100644
index 2ce1cd35a78a..000000000000
--- a/mail/thunderbird/files/patch-bug785638
+++ /dev/null
@@ -1,168 +0,0 @@
-diff --git configure.in configure.in
-index cef992b..3bd39ca 100644
---- mozilla/configure.in
-+++ mozilla/configure.in
-@@ -5353,22 +5353,6 @@ if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
-
- dnl See if we have assembly on this platform.
- case "$OS_ARCH:$CPU_ARCH" in
-- Linux:x86)
-- VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
-- VPX_X86_ASM=1
-- ;;
-- Linux:x86_64)
-- VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
-- VPX_X86_ASM=1
-- ;;
-- SunOS:x86)
-- VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
-- VPX_X86_ASM=1
-- ;;
-- SunOS:x86_64)
-- VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
-- VPX_X86_ASM=1
-- ;;
- Darwin:x86)
- VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
- VPX_X86_ASM=1
-@@ -5412,6 +5388,19 @@ if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
- VPX_ASM_SUFFIX="$ASM_SUFFIX"
- VPX_ARM_ASM=1
- fi
-+ ;;
-+ *:x86)
-+ if $CC -E -dM -</dev/null | grep -q __ELF__; then
-+ VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
-+ VPX_X86_ASM=1
-+ fi
-+ ;;
-+ *:x86_64)
-+ if $CC -E -dM -</dev/null | grep -q __ELF__; then
-+ VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
-+ VPX_X86_ASM=1
-+ fi
-+ ;;
- esac
-
- if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
-@@ -5843,22 +5832,6 @@ if test -n "$MOZ_LIBJPEG_TURBO"; then
-
- dnl Do we support libjpeg-turbo on this platform?
- case "$OS_ARCH:$OS_TEST" in
-- Linux:x86|Linux:i?86)
-- LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
-- LIBJPEG_TURBO_X86_ASM=1
-- ;;
-- Linux:x86_64)
-- LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
-- LIBJPEG_TURBO_X64_ASM=1
-- ;;
-- SunOS:i?86)
-- LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
-- LIBJPEG_TURBO_X86_ASM=1
-- ;;
-- SunOS:x86_64)
-- LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
-- LIBJPEG_TURBO_X64_ASM=1
-- ;;
- Darwin:i?86)
- LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
- LIBJPEG_TURBO_X86_ASM=1
-@@ -5879,6 +5852,18 @@ if test -n "$MOZ_LIBJPEG_TURBO"; then
- LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
- LIBJPEG_TURBO_ARM_ASM=1
- ;;
-+ *:x86|*:i?86)
-+ if $CC -E -dM -</dev/null | grep -q __ELF__; then
-+ LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
-+ LIBJPEG_TURBO_X86_ASM=1
-+ fi
-+ ;;
-+ *:x86_64)
-+ if $CC -E -dM -</dev/null | grep -q __ELF__; then
-+ LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
-+ LIBJPEG_TURBO_X64_ASM=1
-+ fi
-+ ;;
- esac
-
- fi
-diff --git media/libvpx/update.sh media/libvpx/update.sh
-index 79e0fb1..51956af 100755
---- mozilla/media/libvpx/update.sh
-+++ mozilla/media/libvpx/update.sh
-@@ -363,12 +363,12 @@ cp $1/objdir/x86-win32-vs8/vpx_config.h vpx_config_x86-win32-vs8.h
- # Should be same for all platforms...
- cp $1/objdir/x86-win32-vs8/vpx_version.h vpx_version.h
-
--# Config files for x86-linux-gcc and Solaris x86
-+# Config files for x86-linux-gcc and other x86 elf platforms
- cp $1/objdir/x86-linux-gcc/vpx_config.c vpx_config_x86-linux-gcc.c
- cp $1/objdir/x86-linux-gcc/vpx_config.asm vpx_config_x86-linux-gcc.asm
- cp $1/objdir/x86-linux-gcc/vpx_config.h vpx_config_x86-linux-gcc.h
-
--# Config files for x86_64-linux-gcc and Solaris x86_64
-+# Config files for x86_64-linux-gcc and other x86_64 elf platforms
- cp $1/objdir/x86_64-linux-gcc/vpx_config.c vpx_config_x86_64-linux-gcc.c
- cp $1/objdir/x86_64-linux-gcc/vpx_config.asm vpx_config_x86_64-linux-gcc.asm
- cp $1/objdir/x86_64-linux-gcc/vpx_config.h vpx_config_x86_64-linux-gcc.h
-diff --git media/libvpx/vpx_config.h media/libvpx/vpx_config.h
-index 55433f3..36e1780 100644
---- mozilla/media/libvpx/vpx_config.h
-+++ mozilla/media/libvpx/vpx_config.h
-@@ -16,20 +16,12 @@
- /* 32 bit MacOS. */
- #include "vpx_config_x86-darwin9-gcc.h"
-
--#elif defined(__linux__) && defined(__i386__)
--/* 32 bit Linux. */
-+#elif defined(__ELF__) && (defined(__i386) || defined(__i386__))
-+/* 32 bit ELF platforms. */
- #include "vpx_config_x86-linux-gcc.h"
-
--#elif defined(__linux__) && defined(__x86_64__)
--/* 64 bit Linux. */
--#include "vpx_config_x86_64-linux-gcc.h"
--
--#elif defined(__sun) && defined(__i386)
--/* 32 bit Solaris. */
--#include "vpx_config_x86-linux-gcc.h"
--
--#elif defined(__sun) && defined(__x86_64)
--/* 64 bit Solaris. */
-+#elif defined(__ELF__) && (defined(__x86_64) || defined(__x86_64__))
-+/* 64 bit ELF platforms. */
- #include "vpx_config_x86_64-linux-gcc.h"
-
- #else
-diff --git media/libvpx/vpx_config_c.c media/libvpx/vpx_config_c.c
-index eedd515..c8b5375 100644
---- mozilla/media/libvpx/vpx_config_c.c
-+++ mozilla/media/libvpx/vpx_config_c.c
-@@ -15,22 +15,14 @@
- /* 32 bit MacOS. */
- #include "vpx_config_x86-darwin9-gcc.c"
-
--#elif defined(__linux__) && defined(__i386__)
--/* 32 bit Linux. */
-+#elif defined(__ELF__) && (defined(__i386) || defined(__i386__))
-+/* 32 bit ELF platforms. */
- #include "vpx_config_x86-linux-gcc.c"
-
--#elif defined(__linux__) && defined(__x86_64__)
--/* 64 bit Linux. */
-+#elif defined(__ELF__) && (defined(__x86_64) || defined(__x86_64__))
-+/* 64 bit ELF platforms. */
- #include "vpx_config_x86_64-linux-gcc.c"
-
--#elif defined(__sun) && defined(__i386)
--/* 32 bit Solaris. */
--#include "vpx_config_x86-linux-gcc.h"
--
--#elif defined(__sun) && defined(__x86_64)
--/* 64 bit Solaris. */
--#include "vpx_config_x86_64-linux-gcc.h"
--
- #else
- #error VPX_X86_ASM is defined, but assembly not supported on this platform!
- #endif
diff --git a/mail/thunderbird/files/patch-bug788108 b/mail/thunderbird/files/patch-bug788108
new file mode 100644
index 000000000000..db2399499397
--- /dev/null
+++ b/mail/thunderbird/files/patch-bug788108
@@ -0,0 +1,20 @@
+--- mozilla/content/base/public/nsContentUtils.h~
++++ mozilla/content/base/public/nsContentUtils.h
+@@ -18,17 +18,6 @@
+ #include <ieeefp.h>
+ #endif
+
+-//A trick to handle IEEE floating point exceptions on FreeBSD - E.D.
+-#ifdef __FreeBSD__
+-#include <ieeefp.h>
+-#ifdef __alpha__
+-static fp_except_t allmask = FP_X_INV|FP_X_OFL|FP_X_UFL|FP_X_DZ|FP_X_IMP;
+-#else
+-static fp_except_t allmask = FP_X_INV|FP_X_OFL|FP_X_UFL|FP_X_DZ|FP_X_IMP|FP_X_DNML;
+-#endif
+-static fp_except_t oldmask = fpsetmask(~allmask);
+-#endif
+-
+ #include "nsAString.h"
+ #include "nsIStatefulFrame.h"
+ #include "nsNodeInfoManager.h"
diff --git a/mail/thunderbird/files/patch-bug788955 b/mail/thunderbird/files/patch-bug788955
new file mode 100644
index 000000000000..3f6263c901b6
--- /dev/null
+++ b/mail/thunderbird/files/patch-bug788955
@@ -0,0 +1,309 @@
+diff --git Makefile.in Makefile.in
+index e341462..f75bd55 100644
+--- mozilla/Makefile.in
++++ mozilla/Makefile.in
+@@ -48,8 +48,10 @@ endif
+ ifdef MOZ_MEMORY
+ tier_base_dirs += memory/mozjemalloc
+ ifdef MOZ_JEMALLOC
++ifndef MOZ_NATIVE_JEMALLOC
+ tier_base_dirs += memory/jemalloc
+ endif
++endif
+ tier_base_dirs += memory/build
+ endif
+ ifndef MOZ_NATIVE_ZLIB
+diff --git allmakefiles.sh allmakefiles.sh
+index 6a9be4b..d2e49e3 100755
+--- mozilla/allmakefiles.sh
++++ mozilla/allmakefiles.sh
+@@ -59,7 +59,7 @@ if [ ! "$LIBXUL_SDK" ]; then
+ mozglue/Makefile
+ mozglue/build/Makefile
+ "
+- if [ "$MOZ_JEMALLOC" ]; then
++ if [ "$MOZ_JEMALLOC" -a -z "$MOZ_NATIVE_JEMALLOC" ]; then
+ add_makefiles "
+ memory/jemalloc/Makefile
+ "
+--- mozilla/config/autoconf.mk.in
++++ mozilla/config/autoconf.mk.in
+@@ -74,6 +74,7 @@ MOZ_JSDEBUGGER = @MOZ_JSDEBUGGER@
+ MOZ_IPDL_TESTS = @MOZ_IPDL_TESTS@
+ MOZ_MEMORY = @MOZ_MEMORY@
+ MOZ_JEMALLOC = @MOZ_JEMALLOC@
++MOZ_NATIVE_JEMALLOC = @MOZ_NATIVE_JEMALLOC@
+ MOZ_PROFILING = @MOZ_PROFILING@
+ MOZ_ENABLE_PROFILER_SPS = @MOZ_ENABLE_PROFILER_SPS@
+ MOZ_JPROF = @MOZ_JPROF@
+diff --git configure.in configure.in
+index bb05782..2f32516 100644
+--- mozilla/configure.in
++++ mozilla/configure.in
+@@ -3711,21 +3711,22 @@ fi
+
+ dnl Check for the existence of various allocation headers/functions
+
++MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
+ MALLOC_H=
+-MOZ_CHECK_HEADER(malloc.h, [MALLOC_H=malloc.h])
+-if test "$MALLOC_H" = ""; then
+- MOZ_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
+- if test "$MALLOC_H" = ""; then
+- MOZ_CHECK_HEADER(sys/malloc.h, [MALLOC_H=sys/malloc.h])
++
++for file in $MALLOC_HEADERS; do
++ MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
++ if test "$MALLOC_H" != ""; then
++ AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
++ break
+ fi
+-fi
+-if test "$MALLOC_H" != ""; then
+- AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
+-fi
++done
+
+ MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
+ AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
+
++AC_CHECK_FUNCS(malloc_usable_size)
++
+ dnl See if compiler supports some gcc-style attributes
+
+ AC_CACHE_CHECK(for __attribute__((always_inline)),
+@@ -6939,6 +6940,18 @@ else
+ fi
+
+ if test -z "$MOZ_MEMORY"; then
++ if test -n "$MOZ_JEMALLOC"; then
++ MOZ_NATIVE_JEMALLOC=1
++ AC_CHECK_FUNCS(mallctl nallocm,,
++ [MOZ_NATIVE_JEMALLOC=
++ break])
++ if test -n "$MOZ_NATIVE_JEMALLOC"; then
++ MOZ_MEMORY=1
++ AC_DEFINE(MOZ_MEMORY)
++ AC_DEFINE(MOZ_JEMALLOC)
++ AC_DEFINE(MOZ_NATIVE_JEMALLOC)
++ fi
++ fi
+ case "${target}" in
+ *-mingw*)
+ if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
+@@ -7033,6 +7046,7 @@ else
+ fi # MOZ_MEMORY
+ AC_SUBST(MOZ_MEMORY)
+ AC_SUBST(MOZ_JEMALLOC)
++AC_SUBST(MOZ_NATIVE_JEMALLOC)
+ AC_SUBST(MOZ_GLUE_LDFLAGS)
+ AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
+ AC_SUBST(WIN32_CRT_LIBS)
+@@ -8820,10 +8834,22 @@ fi
+
+ # Run jemalloc configure script
+
+-if test "$MOZ_JEMALLOC" -a "$MOZ_MEMORY"; then
++if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_JEMALLOC" -a "$MOZ_MEMORY" ; then
+ ac_configure_args="$_SUBDIR_CONFIG_ARGS --build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
+- if test "$OS_ARCH" = "Linux"; then
+- MANGLE="malloc calloc valloc free realloc memalign posix_memalign malloc_usable_size"
++ case "$OS_ARCH" in
++ Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
++ MANGLE="malloc calloc valloc free realloc posix_memalign"
++ case "$OS_ARCH" in
++ Linux)
++ MANGLE="$MANGLE memalign malloc_usable_size"
++ ;;
++ FreeBSD)
++ MANGLE="$MANGLE malloc_usable_size"
++ ;;
++ esac
++ ;;
++ esac
++ if test -n "$MANGLE"; then
+ MANGLED=
+ JEMALLOC_WRAPPER=
+ if test -n "$_WRAP_MALLOC"; then
+diff --git memory/build/Makefile.in memory/build/Makefile.in
+index dca0f48..af93ee0 100644
+--- mozilla/memory/build/Makefile.in
++++ mozilla/memory/build/Makefile.in
+@@ -22,7 +22,9 @@ CSRCS = extraMallocFuncs.c
+
+ ifdef MOZ_JEMALLOC
+ CSRCS += mozjemalloc_compat.c
++ifndef MOZ_NATIVE_JEMALLOC
+ SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,jemalloc,$(DEPTH)/memory/jemalloc)
++endif
+ else
+ SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,jemalloc,$(DEPTH)/memory/mozjemalloc)
+ endif
+diff --git memory/build/extraMallocFuncs.c memory/build/extraMallocFuncs.c
+index 9d87629..03c8320 100644
+--- mozilla/memory/build/extraMallocFuncs.c
++++ mozilla/memory/build/extraMallocFuncs.c
+@@ -94,8 +94,16 @@ wrap(wcsdup)(const wchar_t *src)
+ #endif
+
+ #ifdef MOZ_JEMALLOC
++
++#undef wrap
++#if defined(MOZ_NATIVE_JEMALLOC)
++#define wrap(a) a
++#else
++#define wrap(a) je_ ## a
++#endif
++
+ /* Override some jemalloc defaults */
+-const char *je_malloc_conf = "narenas:1,lg_chunk:20";
++MOZ_EXPORT_DATA(const char *) wrap(malloc_conf) = "narenas:1,lg_chunk:20";
+
+ #ifdef ANDROID
+ #include <android/log.h>
+diff --git memory/build/mozjemalloc_compat.c memory/build/mozjemalloc_compat.c
+index 10a845a..94ad96e 100644
+--- mozilla/memory/build/mozjemalloc_compat.c
++++ mozilla/memory/build/mozjemalloc_compat.c
+@@ -5,14 +5,21 @@
+ #include "mozilla/Types.h"
+ #include "jemalloc_types.h"
+
+-extern int je_mallctl(const char*, void*, size_t*, void*, size_t);
++#if defined(MOZ_NATIVE_JEMALLOC)
++#define wrap(a) a
++#else
++#define wrap(a) je_ ## a
++#endif
+
+-MOZ_EXPORT_API (void)
++extern MOZ_IMPORT_API(int)
++wrap(mallctl)(const char*, void*, size_t*, void*, size_t);
++
++MOZ_EXPORT_API(void)
+ jemalloc_stats(jemalloc_stats_t *stats)
+ {
+ size_t size = sizeof(stats->mapped);
+- je_mallctl("stats.mapped", &stats->mapped, &size, NULL, 0);
+- je_mallctl("stats.allocated", &stats->allocated, &size, NULL, 0);
++ wrap(mallctl)("stats.mapped", &stats->mapped, &size, NULL, 0);
++ wrap(mallctl)("stats.allocated", &stats->allocated, &size, NULL, 0);
+ stats->committed = -1;
+ stats->dirty = -1;
+ }
+diff --git memory/jemalloc/src/src/mutex.c memory/jemalloc/src/src/mutex.c
+index 37a843e..55e18c2 100644
+--- mozilla/memory/jemalloc/src/src/mutex.c
++++ mozilla/memory/jemalloc/src/src/mutex.c
+@@ -64,7 +64,7 @@ pthread_create(pthread_t *__restrict thread,
+ /******************************************************************************/
+
+ #ifdef JEMALLOC_MUTEX_INIT_CB
+-int _pthread_mutex_init_calloc_cb(pthread_mutex_t *mutex,
++JEMALLOC_EXPORT int _pthread_mutex_init_calloc_cb(pthread_mutex_t *mutex,
+ void *(calloc_cb)(size_t, size_t));
+ #endif
+
+diff --git memory/mozalloc/mozalloc.cpp memory/mozalloc/mozalloc.cpp
+index 5b61050b..5b3399a 100644
+--- mozilla/memory/mozalloc/mozalloc.cpp
++++ mozilla/memory/mozalloc/mozalloc.cpp
+@@ -12,16 +12,13 @@
+ #include <sys/types.h>
+
+ #if defined(MALLOC_H)
+-# include MALLOC_H // for memalign, valloc where available
++# include MALLOC_H // for memalign, valloc, malloc_size, malloc_usable_size
+ #endif // if defined(MALLOC_H)
+ #include <stddef.h> // for size_t
+ #include <stdlib.h> // for malloc, free
+ #if defined(XP_UNIX)
+ # include <unistd.h> // for valloc on *BSD
+ #endif //if defined(XP_UNIX)
+-#if defined(__FreeBSD__)
+-# include <malloc_np.h> // for malloc_usable_size
+-#endif // if defined(__FreeBSD__)
+
+ #if defined(XP_WIN) || (defined(XP_OS2) && defined(__declspec))
+ # define MOZALLOC_EXPORT __declspec(dllexport)
+@@ -213,8 +210,7 @@ moz_malloc_usable_size(void *ptr)
+
+ #if defined(XP_MACOSX)
+ return malloc_size(ptr);
+-#elif defined(MOZ_MEMORY) || (defined(XP_LINUX) && !defined(ANDROID)) || defined(__FreeBSD__)
+- // Android bionic libc doesn't have malloc_usable_size.
++#elif defined(HAVE_MALLOC_USABLE_SIZE) || defined(MOZ_MEMORY)
+ return malloc_usable_size(ptr);
+ #elif defined(XP_WIN)
+ return _msize(ptr);
+diff --git memory/mozjemalloc/jemalloc.h memory/mozjemalloc/jemalloc.h
+index f0e0878..2486e83 100644
+--- mozilla/memory/mozjemalloc/jemalloc.h
++++ mozilla/memory/mozjemalloc/jemalloc.h
+@@ -37,22 +37,29 @@
+ #endif
+ #include "jemalloc_types.h"
+
++#if defined(MOZ_NATIVE_JEMALLOC)
++#define wrap(a) a
++#else
++#define wrap(a) je_ ## a
++#endif
++
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+
+-#if defined(MOZ_MEMORY_LINUX)
++#if defined(MOZ_NATIVE_JEMALLOC) \
++ || defined(MOZ_MEMORY_LINUX) || defined(MOZ_MEMORY_BSD)
+ __attribute__((weak))
+ #endif
+ void jemalloc_stats(jemalloc_stats_t *stats);
+
+ /* Computes the usable size in advance. */
+ #if !defined(MOZ_MEMORY_DARWIN)
+-#if defined(MOZ_MEMORY_LINUX)
++#if defined(MOZ_MEMORY_LINUX) || defined(MOZ_MEMORY_BSD)
+ __attribute__((weak))
+ #endif
+ #if defined(MOZ_JEMALLOC)
+-int je_nallocm(size_t *rsize, size_t size, int flags);
++MOZ_IMPORT_API(int) wrap(nallocm)(size_t *rsize, size_t size, int flags);
+ #else
+ size_t je_malloc_good_size(size_t size);
+ #endif
+@@ -62,11 +69,11 @@ static inline size_t je_malloc_usable_size_in_advance(size_t size) {
+ #if defined(MOZ_MEMORY_DARWIN)
+ return malloc_good_size(size);
+ #elif defined(MOZ_JEMALLOC)
+- if (je_nallocm) {
++ if (wrap(nallocm)) {
+ size_t ret;
+ if (size == 0)
+ size = 1;
+- if (!je_nallocm(&ret, size, 0))
++ if (!wrap(nallocm)(&ret, size, 0))
+ return ret;
+ }
+ return size;
+@@ -113,4 +120,6 @@ void jemalloc_purge_freed_pages();
+ } /* extern "C" */
+ #endif
+
++#undef wrap
++
+ #endif /* _JEMALLOC_H_ */
+diff --git mozglue/build/Makefile.in mozglue/build/Makefile.in
+index c333647..15ba505 100644
+--- mozilla/mozglue/build/Makefile.in
++++ mozilla/mozglue/build/Makefile.in
+@@ -23,7 +23,7 @@ FORCE_STATIC_LIB = 1
+ endif
+
+ # Keep jemalloc separated when mozglue is statically linked
+-ifeq (1_1,$(MOZ_MEMORY)_$(FORCE_SHARED_LIB))
++ifeq (1_1,$(MOZ_MEMORY)_$(or $(MOZ_NATIVE_JEMALLOC),$(FORCE_SHARED_LIB)))
+ SHARED_LIBRARY_LIBS = $(call EXPAND_LIBNAME_PATH,memory,$(DEPTH)/memory/build)
+ else
+ # Temporary, until bug 662814 lands
diff --git a/mail/thunderbird/files/patch-bug789436 b/mail/thunderbird/files/patch-bug789436
new file mode 100644
index 000000000000..2479d8e69c78
--- /dev/null
+++ b/mail/thunderbird/files/patch-bug789436
@@ -0,0 +1,27 @@
+--- mozilla/toolkit/xre/nsAppRunner.cpp~
++++ mozilla/toolkit/xre/nsAppRunner.cpp
+@@ -1388,11 +1388,6 @@ static int MSCRTReportHook( int aReportType, char *aMessage, int *oReturnValue)
+
+ #endif
+
+-#if defined(FREEBSD)
+-// pick up fpsetmask prototype.
+-#include <ieeefp.h>
+-#endif
+-
+ static inline void
+ DumpVersion()
+ {
+@@ -4136,12 +4131,5 @@ SetupErrorHandling(const char* progname)
+
+ // Unbuffer stdout, needed for tinderbox tests.
+ setbuf(stdout, 0);
+-
+-#if defined(FREEBSD)
+- // Disable all SIGFPE's on FreeBSD, as it has non-IEEE-conformant fp
+- // trap behavior that trips up on floating-point tests performed by
+- // the JS engine. See bugzilla bug 9967 details.
+- fpsetmask(0);
+-#endif
+ }
+
diff --git a/mail/thunderbird/files/patch-bug789656 b/mail/thunderbird/files/patch-bug789656
new file mode 100644
index 000000000000..17f1419897cc
--- /dev/null
+++ b/mail/thunderbird/files/patch-bug789656
@@ -0,0 +1,11 @@
+--- mozilla/media/libopus/Makefile.in~
++++ mozilla/media/libopus/Makefile.in
+@@ -20,7 +20,7 @@ DEFINES += \
+ -Drestrict= \
+ $(NULL)
+
+-ifneq ($(filter $(OS_ARCH),Linux Darwin),)
++ifneq ($(filter $(OS_ARCH),Linux Darwin DragonFly FreeBSD NetBSD OpenBSD),)
+ DEFINES += -DHAVE_LRINTF
+ endif
+ ifeq ($(OS_ARCH), WINNT)
diff --git a/mail/thunderbird/files/patch-bug789693 b/mail/thunderbird/files/patch-bug789693
new file mode 100644
index 000000000000..f88228f5498b
--- /dev/null
+++ b/mail/thunderbird/files/patch-bug789693
@@ -0,0 +1,109 @@
+--- mozilla/toolkit/components/startup/nsAppStartup.cpp
++++ mozilla/toolkit/components/startup/nsAppStartup.cpp
+@@ -50,18 +50,41 @@
+ #include <sys/syscall.h>
+ #endif
+
+-#ifdef XP_MACOSX
++#if defined(XP_MACOSX) || defined(__DragonFly__) || defined(__FreeBSD__) \
++ || defined(__NetBSD__) || defined(__OpenBSD__)
++#include <sys/param.h>
+ #include <sys/sysctl.h>
+ #endif
+
+-#ifdef __OpenBSD__
+-#include <sys/param.h>
+-#include <sys/sysctl.h>
++#if defined(__DragonFly__) || defined(__FreeBSD__)
++#include <sys/user.h>
+ #endif
+
+ #include "mozilla/Telemetry.h"
+ #include "mozilla/StartupTimeline.h"
+
++#if defined(__NetBSD__)
++#undef KERN_PROC
++#define KERN_PROC KERN_PROC2
++#define KINFO_PROC struct kinfo_proc2
++#else
++#define KINFO_PROC struct kinfo_proc
++#endif
++
++#if defined(XP_MACOSX)
++#define KP_START_SEC kp_proc.p_un.__p_starttime.tv_sec
++#define KP_START_USEC kp_proc.p_un.__p_starttime.tv_usec
++#elif defined(__DragonFly__)
++#define KP_START_SEC kp_start.tv_sec
++#define KP_START_USEC kp_start.tv_usec
++#elif defined(__FreeBSD__)
++#define KP_START_SEC ki_start.tv_sec
++#define KP_START_USEC ki_start.tv_usec
++#else
++#define KP_START_SEC p_ustart_sec
++#define KP_START_USEC p_ustart_usec
++#endif
++
+ static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
+
+ #define kPrefLastSuccess "toolkit.startup.last_success"
+@@ -836,42 +859,30 @@ CalculateProcessCreationTimestamp()
+ #endif
+ return timestamp;
+ }
+-#elif defined(XP_MACOSX)
++#elif defined(XP_MACOSX) || defined(__DragonFly__) || defined(__FreeBSD__) \
++ || defined(__NetBSD__) || defined(__OpenBSD__)
+ static PRTime
+ CalculateProcessCreationTimestamp()
+ {
+- int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid() };
+- size_t buffer_size;
+- if (sysctl(mib, 4, NULL, &buffer_size, NULL, 0))
+- return 0;
++ int mib[] = {
++ CTL_KERN,
++ KERN_PROC,
++ KERN_PROC_PID,
++ getpid(),
++#if defined(__NetBSD__) || defined(__OpenBSD__)
++ sizeof(KINFO_PROC),
++ 1,
++#endif
++ };
++ u_int miblen = sizeof(mib) / sizeof(mib[0]);
+
+- struct kinfo_proc *proc = (kinfo_proc*) malloc(buffer_size);
+- if (sysctl(mib, 4, proc, &buffer_size, NULL, 0)) {
+- free(proc);
+- return 0;
+- }
+- PRTime starttime = static_cast<PRTime>(proc->kp_proc.p_un.__p_starttime.tv_sec) * PR_USEC_PER_SEC;
+- starttime += proc->kp_proc.p_un.__p_starttime.tv_usec;
+- free(proc);
+- return starttime;
+-}
+-#elif defined(__OpenBSD__)
+-static PRTime
+-CalculateProcessCreationTimestamp()
+-{
+- int mib[6] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid(), sizeof(struct kinfo_proc), 1 };
+- size_t buffer_size;
+- if (sysctl(mib, 6, NULL, &buffer_size, NULL, 0))
++ KINFO_PROC proc;
++ size_t buffer_size = sizeof(proc);
++ if (sysctl(mib, miblen, &proc, &buffer_size, NULL, 0))
+ return 0;
+
+- struct kinfo_proc *proc = (struct kinfo_proc*) malloc(buffer_size);
+- if (sysctl(mib, 6, proc, &buffer_size, NULL, 0)) {
+- free(proc);
+- return 0;
+- }
+- PRTime starttime = static_cast<PRTime>(proc->p_ustart_sec) * PR_USEC_PER_SEC;
+- starttime += proc->p_ustart_usec;
+- free(proc);
++ PRTime starttime = static_cast<PRTime>(proc.KP_START_SEC) * PR_USEC_PER_SEC;
++ starttime += proc.KP_START_USEC;
+ return starttime;
+ }
+ #else
diff --git a/mail/thunderbird/files/patch-bug791305 b/mail/thunderbird/files/patch-bug791305
new file mode 100644
index 000000000000..e4c44a405f57
--- /dev/null
+++ b/mail/thunderbird/files/patch-bug791305
@@ -0,0 +1,107 @@
+commit c269a16
+Author: Jeff Muizelaar <jmuizelaar@mozilla.com>
+Date: Fri Sep 14 15:54:55 2012 -0400
+
+ Bug 791305. Use libjpeg's color conversion code instead of our own. r=joe,r=khuey
+
+ libjpeg-turbo supports converting directly to a format compatible with cairo's
+ FORMAT_RGB24. Use that instead of our own handcoded function. This also gives
+ us SSE2 and NEON version of this function.
+
+ --HG--
+ extra : rebase_source : 18f48925f023a33ec2a097d4f4e5cc2ab40be1e9
+---
+ configure.in | 6 +-
+ image/decoders/nsJPEGDecoder.cpp | 311 ++-------------------------------------
+ 2 files changed, 20 insertions(+), 297 deletions(-)
+
+diff --git mozilla/image/decoders/nsJPEGDecoder.cpp mozilla/image/decoders/nsJPEGDecoder.cpp
+index c1fb515..1d2a259 100644
+--- mozilla/image/decoders/nsJPEGDecoder.cpp
++++ mozilla/image/decoders/nsJPEGDecoder.cpp
+@@ -22,6 +22,13 @@
+ extern "C" {
+ #include "iccjpeg.h"
+
++#ifdef JCS_EXTENSIONS
++#if defined(IS_BIG_ENDIAN)
++#define MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB JCS_EXT_XRGB
++#else
++#define MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB JCS_EXT_BGRX
++#endif
++#else
+ /* Colorspace conversion (copied from jpegint.h) */
+ struct jpeg_color_deconverter {
+ JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
+@@ -34,6 +41,7 @@ METHODDEF(void)
+ ycc_rgb_convert_argb (j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
+ JSAMPARRAY output_buf, int num_rows);
++#endif
+ }
+
+ static void cmyk_convert_rgb(JSAMPROW row, JDIMENSION width);
+@@ -329,7 +340,18 @@ nsJPEGDecoder::WriteInternal(const char *aBuffer, PRUint32 aCount)
+ case JCS_GRAYSCALE:
+ case JCS_RGB:
+ case JCS_YCbCr:
++#ifdef JCS_EXTENSIONS
++ // if we're not color managing we can decode directly to
++ // MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB
++ if (mCMSMode != eCMSMode_All) {
++ mInfo.out_color_space = MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB;
++ mInfo.out_color_components = 4;
++ } else {
++ mInfo.out_color_space = JCS_RGB;
++ }
++#else
+ mInfo.out_color_space = JCS_RGB;
++#endif
+ break;
+ case JCS_CMYK:
+ case JCS_YCCK:
+@@ -397,6 +419,7 @@ nsJPEGDecoder::WriteInternal(const char *aBuffer, PRUint32 aCount)
+ return; /* I/O suspension */
+ }
+
++#ifndef JCS_EXTENSIONS
+ /* Force to use our YCbCr to Packed RGB converter when possible */
+ if (!mTransform && (mCMSMode != eCMSMode_All) &&
+ mInfo.jpeg_color_space == JCS_YCbCr && mInfo.out_color_space == JCS_RGB) {
+@@ -404,6 +427,7 @@ nsJPEGDecoder::WriteInternal(const char *aBuffer, PRUint32 aCount)
+ mInfo.out_color_components = 4; /* Packed ARGB pixels are always 4 bytes...*/
+ mInfo.cconvert->color_convert = ycc_rgb_convert_argb;
+ }
++#endif
+
+ /* If this is a progressive JPEG ... */
+ mState = mInfo.buffered_image ? JPEG_DECOMPRESS_PROGRESSIVE : JPEG_DECOMPRESS_SEQUENTIAL;
+@@ -542,7 +566,11 @@ nsJPEGDecoder::OutputScanlines(bool* suspend)
+ PRUint32 *imageRow = ((PRUint32*)mImageData) +
+ (mInfo.output_scanline * mInfo.output_width);
+
++#ifdef JCS_EXTENSIONS
++ if (mInfo.out_color_space == MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB) {
++#else
+ if (mInfo.cconvert->color_convert == ycc_rgb_convert_argb) {
++#endif
+ /* Special case: scanline will be directly converted into packed ARGB */
+ if (jpeg_read_scanlines(&mInfo, (JSAMPARRAY)&imageRow, 1) != 1) {
+ *suspend = true; /* suspend */
+@@ -858,6 +887,7 @@ term_source (j_decompress_ptr jd)
+ } // namespace mozilla
+
+
++#ifndef JCS_EXTENSIONS
+ /**************** YCbCr -> Cairo's RGB24/ARGB32 conversion: most common case **************/
+
+ /*
+@@ -1130,7 +1160,8 @@ ycc_rgb_convert_argb (j_decompress_ptr cinfo,
+ }
+ }
+ }
++#endif
+
+
+ /**************** Inverted CMYK -> RGB conversion **************/
+ /*
diff --git a/mail/thunderbird/files/patch-bug791366 b/mail/thunderbird/files/patch-bug791366
new file mode 100644
index 000000000000..90e9e523bbbe
--- /dev/null
+++ b/mail/thunderbird/files/patch-bug791366
@@ -0,0 +1,95 @@
+diff --git mozilla/xpcom/base/nsMemoryReporterManager.cpp mozilla/xpcom/base/nsMemoryReporterManager.cpp
+index a9aff58..674e757 100644
+--- mozilla/xpcom/base/nsMemoryReporterManager.cpp
++++ mozilla/xpcom/base/nsMemoryReporterManager.cpp
+@@ -32,7 +32,7 @@ using namespace mozilla;
+ # include "jemalloc.h"
+ #endif // MOZ_MEMORY
+
+-#if defined(XP_LINUX) || defined(XP_MACOSX) || defined(SOLARIS)
++#ifdef XP_UNIX
+
+ #include <sys/time.h>
+ #include <sys/resource.h>
+@@ -95,6 +95,81 @@ static nsresult GetResident(PRInt64 *n)
+ return GetProcSelfStatmField(1, n);
+ }
+
++#elif defined(__DragonFly__) || defined(__FreeBSD__) \
++ || defined(__NetBSD__) || defined(__OpenBSD__)
++
++#include <sys/param.h>
++#include <sys/sysctl.h>
++#if defined(__DragonFly__) || defined(__FreeBSD__)
++#include <sys/user.h>
++#endif
++
++#include <unistd.h>
++
++#if defined(__NetBSD__)
++#undef KERN_PROC
++#define KERN_PROC KERN_PROC2
++#define KINFO_PROC struct kinfo_proc2
++#else
++#define KINFO_PROC struct kinfo_proc
++#endif
++
++#if defined(__DragonFly__)
++#define KP_SIZE(kp) (kp.kp_vm_map_size)
++#define KP_RSS(kp) (kp.kp_vm_rssize * getpagesize())
++#elif defined(__FreeBSD__)
++#define KP_SIZE(kp) (kp.ki_size)
++#define KP_RSS(kp) (kp.ki_rssize * getpagesize())
++#elif defined(__NetBSD__)
++#define KP_SIZE(kp) (kp.p_vm_msize * getpagesize())
++#define KP_RSS(kp) (kp.p_vm_rssize * getpagesize())
++#elif defined(__OpenBSD__)
++#define KP_SIZE(kp) ((kp.p_vm_dsize + kp.p_vm_ssize \
++ + kp.p_vm_tsize) * getpagesize())
++#define KP_RSS(kp) (kp.p_vm_rssize * getpagesize())
++#endif
++
++static nsresult GetKinfoProcSelf(KINFO_PROC *proc)
++{
++ int mib[] = {
++ CTL_KERN,
++ KERN_PROC,
++ KERN_PROC_PID,
++ getpid(),
++#if defined(__NetBSD__) || defined(__OpenBSD__)
++ sizeof(KINFO_PROC),
++ 1,
++#endif
++ };
++ u_int miblen = sizeof(mib) / sizeof(mib[0]);
++ size_t size = sizeof(KINFO_PROC);
++ if (sysctl(mib, miblen, proc, &size, NULL, 0))
++ return NS_ERROR_FAILURE;
++
++ return NS_OK;
++}
++
++#define HAVE_VSIZE_AND_RESIDENT_REPORTERS 1
++static nsresult GetVsize(PRInt64 *n)
++{
++ KINFO_PROC proc;
++ nsresult rv = GetKinfoProcSelf(&proc);
++ if (NS_SUCCEEDED(rv))
++ *n = KP_SIZE(proc);
++
++ return rv;
++}
++
++static nsresult GetResident(PRInt64 *n)
++{
++ KINFO_PROC proc;
++ nsresult rv = GetKinfoProcSelf(&proc);
++ if (NS_SUCCEEDED(rv))
++ *n = KP_RSS(proc);
++
++ return rv;
++}
++
+ #elif defined(SOLARIS)
+
+ #include <procfs.h>
diff --git a/mail/thunderbird/files/patch-config-baseconfig.mk b/mail/thunderbird/files/patch-config-baseconfig.mk
new file mode 100644
index 000000000000..f789129c3ba4
--- /dev/null
+++ b/mail/thunderbird/files/patch-config-baseconfig.mk
@@ -0,0 +1,16 @@
+--- mozilla/config/baseconfig.mk~
++++ mozilla/config/baseconfig.mk
+@@ -1,9 +1,9 @@
+ INCLUDED_AUTOCONF_MK = 1
+
+-includedir := $(includedir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
+-idldir = $(datadir)/idl/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
+-installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
+-sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION)
++includedir := $(includedir)/%%MOZILLA%%
++idldir = $(datadir)/idl/%%MOZILLA%%
++installdir = $(libdir)/%%MOZILLA%%
++sdkdir = $(libdir)/%%MOZILLA%%
+ DIST = $(DEPTH)/dist
+
+ # We do magic with OBJ_SUFFIX in config.mk, the following ensures we don't
diff --git a/mail/thunderbird/files/patch-mozilla-config_autoconf.mk.in b/mail/thunderbird/files/patch-mozilla-config_autoconf.mk.in
deleted file mode 100644
index 7d3316500fa7..000000000000
--- a/mail/thunderbird/files/patch-mozilla-config_autoconf.mk.in
+++ /dev/null
@@ -1,22 +0,0 @@
---- mozilla/config/autoconf.mk.in.orig 2007-08-28 12:02:43.000000000 -0400
-+++ mozilla/config/autoconf.mk.in 2007-09-26 14:21:51.000000000 -0400
-@@ -58,14 +58,14 @@
- prefix = @prefix@
- exec_prefix = @exec_prefix@
- bindir = @bindir@
--includedir = @includedir@/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
-+includedir = @includedir@/%%MOZILLA%%
- libdir = @libdir@
- datadir = @datadir@
- mandir = @mandir@
--idldir = $(datadir)/idl/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
-+idldir = $(datadir)/idl/%%MOZILLA%%
-
--installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
--sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION)
-+installdir = $(libdir)/%%MOZILLA%%
-+sdkdir = $(libdir)/%%MOZILLA%%
-
- DIST = $(DEPTH)/dist
- LIBXUL_SDK = @LIBXUL_SDK@
-
diff --git a/mail/thunderbird/files/patch-mozilla-content-media-nsAudioStream.cpp b/mail/thunderbird/files/patch-mozilla-content-media-nsAudioStream.cpp
new file mode 100644
index 000000000000..f31ba356b0ab
--- /dev/null
+++ b/mail/thunderbird/files/patch-mozilla-content-media-nsAudioStream.cpp
@@ -0,0 +1,14 @@
+--- mozilla/content/media/nsAudioStream.cpp~
++++ mozilla/content/media/nsAudioStream.cpp
+@@ -298,7 +298,11 @@ static int PrefChanged(const char* aPref
+ gVolumeScale = NS_MAX<double>(0, PR_strtod(utf8.get(), nsnull));
+ }
+ } else if (strcmp(aPref, PREF_USE_CUBEB) == 0) {
++#if defined(__FreeBSD__) && __FreeBSD_version < 800097
++ bool value = Preferences::GetBool(aPref, false);
++#else
+ bool value = Preferences::GetBool(aPref, true);
++#endif
+ mozilla::MutexAutoLock lock(*gAudioPrefsLock);
+ gUseCubeb = value;
+ } else if (strcmp(aPref, PREF_CUBEB_LATENCY) == 0) {
diff --git a/mail/thunderbird/files/patch-mozilla-extensions-spellcheck-hunspell-src-mozHunspell.cpp b/mail/thunderbird/files/patch-mozilla-extensions-spellcheck-hunspell-src-mozHunspell.cpp
new file mode 100644
index 000000000000..32241fdfe270
--- /dev/null
+++ b/mail/thunderbird/files/patch-mozilla-extensions-spellcheck-hunspell-src-mozHunspell.cpp
@@ -0,0 +1,15 @@
+--- mozilla/extensions/spellcheck/hunspell/src/mozHunspell.cpp~
++++ mozilla/extensions/spellcheck/hunspell/src/mozHunspell.cpp
+@@ -400,6 +400,12 @@ mozHunspell::LoadDictionaryList()
+ }
+ }
+
++ // load system hunspell dictionaries
++ nsIFile* hunDir;
++ NS_NewNativeLocalFile(NS_LITERAL_CSTRING("%%LOCALBASE%%/share/hunspell"),
++ true, &hunDir);
++ LoadDictionariesFromDir(hunDir);
++
+ // find dictionaries from extensions requiring restart
+ nsCOMPtr<nsISimpleEnumerator> dictDirs;
+ rv = dirSvc->Get(DICTIONARY_SEARCH_DIRECTORY_LIST,
diff --git a/mail/thunderbird/files/patch-mozilla_toolkit_xre_glxtest.cpp b/mail/thunderbird/files/patch-mozilla_toolkit_xre_glxtest.cpp
deleted file mode 100644
index f338b4bdedb5..000000000000
--- a/mail/thunderbird/files/patch-mozilla_toolkit_xre_glxtest.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
---- mozilla/toolkit/xre/glxtest.cpp.orig 2011-08-19 18:57:10.604870746 +0300
-+++ mozilla/toolkit/xre/glxtest.cpp 2011-08-19 18:59:43.620447963 +0300
-@@ -51,6 +51,8 @@
- // which runs the glxtest() static function. This creates a X connection, a GLX context, calls glGetString, and writes that
- // to the 'write' end of the pipe.
-
-+#include <sys/types.h>
-+#include <sys/wait.h>
- #include <cstdio>
- #include <cstdlib>
- #include <unistd.h>
-@@ -224,6 +226,7 @@
- void fire_glxtest_process()
- {
- int pfd[2];
-+ int status;
- if (pipe(pfd) == -1) {
- perror("pipe");
- exit(EXIT_FAILURE);
-@@ -244,4 +247,5 @@
- close(pfd[1]);
- mozilla::widget::glxtest_pipe = pfd[0];
- mozilla::widget::glxtest_pid = pid;
-+ waitpid(pid, &status, 0);
- }