aboutsummaryrefslogtreecommitdiffstats
path: root/mail/thunderbird-esr
diff options
context:
space:
mode:
authorflo <flo@FreeBSD.org>2012-07-27 05:49:58 +0800
committerflo <flo@FreeBSD.org>2012-07-27 05:49:58 +0800
commit85b904b679203420da0f901ae5b1f3bb29dfb7cd (patch)
tree89c0045d73cc71a8a86842d8aa10f24e71cb5f26 /mail/thunderbird-esr
parent864283a90c51467eba734e03bd14aeec892b4542 (diff)
downloadfreebsd-ports-gnome-85b904b679203420da0f901ae5b1f3bb29dfb7cd.tar.gz
freebsd-ports-gnome-85b904b679203420da0f901ae5b1f3bb29dfb7cd.tar.zst
freebsd-ports-gnome-85b904b679203420da0f901ae5b1f3bb29dfb7cd.zip
- update firefox/thunderbird ESR versions to 10.0.6
- update firefox 14.0.1 - update thunderbird to 14.0 - update seamonkey to 2.11 - switch to new options framework - add experimental rendering via cairo-qt (QT4 option) - add audio backend options (ALSA and PulseAudio) - rename SMB option to GNOMEVFS2 - turn on LOGGING by default (like upstream linux builds) - improve about:memory output - unbreak PGO - use system libs [1] - switch to libevent2 [2] - fix conflict with devel/libunwind and base gcc [3] - unbreak clang/libc++ build [4] - unbreak build with base gcc on >= 9.x [5] - use common IPC code with other BSDs[6] - and *miscellaneous improvements* PR: ports/146231 [1], ports/161421 [2] ports/150631, ports/168369, ports/168637, ports/168793, ports/168978 [3] ports/163454, ports/164905, ports/169231 [4] ports/169389, ports/169479 [5] Obtained from: pkgsrc via bugzilla #753046 [6] In collaboration with: Jan Beich (who did the major part of this work and deserves a special thank you!)
Diffstat (limited to 'mail/thunderbird-esr')
-rw-r--r--mail/thunderbird-esr/Makefile76
-rw-r--r--mail/thunderbird-esr/distinfo4
-rw-r--r--mail/thunderbird-esr/files/patch-alsapulse119
-rw-r--r--mail/thunderbird-esr/files/patch-bug68525817
-rw-r--r--mail/thunderbird-esr/files/patch-bug74173790
-rw-r--r--mail/thunderbird-esr/files/patch-bug7530461267
-rw-r--r--mail/thunderbird-esr/files/patch-configure.in112
-rw-r--r--mail/thunderbird-esr/files/patch-ipc-chromium-src-base-atomicops_internals_mutex.cc10
-rw-r--r--mail/thunderbird-esr/files/patch-ipc-chromium-src-base-file_util_linux.cc15
-rw-r--r--mail/thunderbird-esr/files/patch-ipc-chromium-src-base-file_util_posix.cc11
-rw-r--r--mail/thunderbird-esr/files/patch-ipc-chromium-src-base-platform_file_posix.cc10
-rw-r--r--mail/thunderbird-esr/files/patch-ipc-chromium-src-base-platform_thread_posix.cc12
-rw-r--r--mail/thunderbird-esr/files/patch-ipc-chromium-src-base-third_party-nspr-prcpucfg.h11
-rw-r--r--mail/thunderbird-esr/files/patch-ipc-chromium-src-base-time_posix.cc10
-rw-r--r--mail/thunderbird-esr/files/patch-ipc-chromium-src-build-build_config.h11
-rw-r--r--mail/thunderbird-esr/files/patch-ldap-sdks-c-sdk-ldap-libraries-libssldap-Makefile.in12
-rw-r--r--mail/thunderbird-esr/files/patch-mail-app-nsMailApp.cpp10
-rw-r--r--mail/thunderbird-esr/files/patch-mailnews-addrbook-src-nsDirPrefs.cpp20
-rw-r--r--mail/thunderbird-esr/files/patch-mailnews-compose-src-nsSmtpProtocol.cpp29
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-build-autoconf-config.sub12
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-configure.in50
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-db-sqlite3-src-Makefile.in11
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-dom-plugins-ipc-PluginMessageUtils.cpp11
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-gfx-qcms-Makefile.in14
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-gfx-ycbcr-Makefile.in21
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-ipc-chromium-Makefile.in28
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-ipc-chromium-src-base-dir_reader_linux.h45
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-ipc-chromium-src-base-message_pump_libevent.cc19
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-js-src-Makefile.in19
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-js-src-config-mkdepend-Makefile.in2
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-js-src-config_config.mk2
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-js-src-configure.in54
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-js-src-methodjit-MethodJIT.cpp20
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-media-libsydneyaudio-include-sydney_audio.h11
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-media-libsydneyaudio-src-sydney_audio_oss.c13
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-memory-mozalloc-mozalloc.cpp21
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-security-coreconf-FreeBSD.mk16
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-security-nss-lib-Makefile11
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-toolkit-library-Makefile.in12
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-toolkit-xre-nsAppRunner.cpp11
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-widget-src-qt-nsNativeThemeQt.cpp12
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-widget-src-qt-nsSound.cpp10
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-widget-src-qt-nsWindow.cpp10
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-xpcom-base-nsStackWalk.cpp8
-rw-r--r--mail/thunderbird-esr/files/patch-mozilla-xpcom-reflect-xptcall-src-md-unix-Makefile.in76
45 files changed, 1865 insertions, 500 deletions
diff --git a/mail/thunderbird-esr/Makefile b/mail/thunderbird-esr/Makefile
index 8829354123ce..44618e494fc9 100644
--- a/mail/thunderbird-esr/Makefile
+++ b/mail/thunderbird-esr/Makefile
@@ -6,7 +6,7 @@
#
PORTNAME= thunderbird
-DISTVERSION= 10.0.5
+DISTVERSION= 10.0.6
CATEGORIES= mail ipv6
MASTER_SITES= ${MASTER_SITE_MOZILLA}
MASTER_SITE_SUBDIR= ${PORTNAME}/releases/${DISTVERSION}esr/source
@@ -15,39 +15,34 @@ DISTNAME= ${PORTNAME}-${DISTVERSION}esr.source
MAINTAINER= gecko@FreeBSD.org
COMMENT= Mozilla Thunderbird is standalone mail and news that stands above
-BUILD_DEPENDS= nspr>=4.8.7:${PORTSDIR}/devel/nspr \
+BUILD_DEPENDS= nspr>=4.8.8:${PORTSDIR}/devel/nspr \
+ nss>=3.13.1:${PORTSDIR}/security/nss \
+ sqlite3>=3.7.7.1:${PORTSDIR}/databases/sqlite3 \
cairo>=1.10.2_1,1:${PORTSDIR}/graphics/cairo \
unzip:${PORTSDIR}/archivers/unzip
-LIB_DEPENDS= execinfo.1:${PORTSDIR}/devel/libexecinfo \
- event-1.4:${PORTSDIR}/devel/libevent
CONFLICTS_BUILD= spidermonkey-*
-USE_AUTOTOOLS= autoconf213
+USE_AUTOTOOLS= autoconf213:env
LATEST_LINK= thunderbird-esr
USE_GECKO= gecko
CONFLICTS= thunderbird-1[1-9].*
-USE_MOZILLA= -png -nss -dbm -jpeg -xft
-MOZ_TOOLKIT= cairo-gtk2
+USE_MOZILLA= # empty
MAKE_JOBS_SAFE= yes
WANT_GNOME= yes
+USE_QT4= # empty
+QT_NONSTANDARD= yes
ALL_TARGET= default
-CONFIGURE_ENV= LOCALBASE=${LOCALBASE}
-MAKE_ENV= PTHREAD_LDFLAGS="${PTHREAD_LIBS}"
-HAS_CONFIGURE= yes
+GNU_CONFIGURE= yes
USE_BZIP2= yes
USE_GMAKE= yes
USE_GL= gl
MOZ_PROTOCOLS= http,ftp,file,viewsource,res,data,wyciwyg,websocket
-MOZ_GRAPHICS= default,-xbm
MOZ_OPTIONS= --program-transform-name='s/thunderbird/${MOZILLA}/' \
- --with-default-mozilla-five-home=${PREFIX}/lib/${MOZILLA} \
--enable-single-profile --disable-profilesharing \
- --enable-application=mail --enable-official-branding \
- --disable-updater --disable-necko-wifi \
- --with-system-libevent=${LOCALBASE}
+ --enable-application=mail --enable-official-branding
MOZ_MK_OPTIONS= MOZ_MOZ_THUNDERBIRD=1 MAIL_PKG_SHARED=1
MOZ_EXPORT= MOZ_THUNDERBIRD=1 MAIL_PKG_SHARED=1
MOZ_PKGCONFIG_FILES=
@@ -58,45 +53,38 @@ 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= LIGHTNING "Enable calendar extension" off
+OPTIONS_DEFINE= LIGHTNING
+.include "${.CURDIR}/../../www/firefox/Makefile.options"
.include <bsd.port.pre.mk>
WRKSRC= ${WRKDIR}/comm-esr10
MOZSRC:= ${WRKSRC}/mozilla
-.if ${ARCH} == powerpc64
+.if ${ARCH} == amd64
+CONFIGURE_TARGET=x86_64-portbld-freebsd${OSREL}
+.elif ${ARCH} == powerpc64
.if ${OSVERSION} < 900033
BROKEN= Needs binutils 2.17.50 to build
.else
-CONFIGURE_ENV+= UNAME_m="powerpc64"
+MOZ_EXPORT+= UNAME_m="powerpc64"
CFLAGS+= -mminimal-toc
.endif
.endif
-.if ${HAVE_GNOME:Mlibgnomeui}!=""
-USE_GNOME+= libgnomeui
-MOZ_OPTIONS+= --enable-gnomeui
-.else
-MOZ_OPTIONS+= --disable-gnomeui
-.endif
-
-.if defined(WITHOUT_DBUS)
-MOZ_OPTIONS+= --disable-dbus --disable-libnotify
-.else
-LIB_DEPENDS+= dbus-glib-1.2:${PORTSDIR}/devel/dbus-glib \
- notify.4:${PORTSDIR}/devel/libnotify
-.endif
-
.if ${ARCH} == amd64 || ${ARCH} == i386
BUILD_DEPENDS+= yasm:${PORTSDIR}/devel/yasm
.endif
-.if defined(WITH_LIGHTNING)
+.if !empty(CXX:M*clang++*)
+CFLAGS+= -Wno-return-type-c-linkage
+.endif
+
+.if ${PORT_OPTIONS:MLIGHTNING}
MOZ_OPTIONS+= --enable-calendar
MOZ_MK_OPTIONS+= MOZ_CO_PROJECT=calendar
LIGHTNING_DIR= share/lightning
-XPI_FILE= ${MOZSRC}/dist/xpi-stage/lightning.xpi
+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
@@ -109,22 +97,8 @@ post-extract:
<${FILESDIR}/thunderbird.desktop.in >${WRKDIR}/${MOZILLA_EXEC_NAME}.desktop
post-patch:
- @${GREP} -Flr \"/proc ${MOZSRC}/ipc/chromium/src/base | ${XARGS} ${REINPLACE_CMD} \
- -e 's|/proc/self/fd|/dev/fd|' \
- -e 's|/proc["/]|/compat/linux&|'
- @${REINPLACE_CMD} -e 's|%%PTHREAD_LIBS%%|${PTHREAD_LIBS}|' \
- ${MOZSRC}/storage/build/Makefile.in \
- ${MOZSRC}/toolkit/library/Makefile.in \
- ${MOZSRC}/db/sqlite3/src/Makefile.in
- @${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|' \
- ${MOZSRC}/security/manager/ssl/src/Makefile.in \
- ${MOZSRC}/js/src/config/mkdepend/Makefile.in \
- ${MOZSRC}/js/src/config/config.mk
- @${REINPLACE_CMD} -e 's|-lc_r|${PTHREAD_LIBS}|g ; \
- s|-lpthread|${PTHREAD_LIBS}|g ; \
- s|echo aout|echo elf|g ; \
- s|/usr/X11R6|${LOCALBASE}|g' \
- ${MOZSRC}/js/src/configure
+ @${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
+ ${WRKSRC}/mail/app/nsMailApp.cpp
pre-configure:
(cd ${WRKSRC} && ${AUTOCONF})
@@ -143,7 +117,7 @@ post-install:
${MKDIR} ${PREFIX}/share/applications
${INSTALL_DATA} ${WRKDIR}/${MOZILLA_EXEC_NAME}.desktop ${PREFIX}/share/applications
${LN} -sf ${PORTNAME_ICON_SRC} ${PREFIX}/share/pixmaps/${PORTNAME_ICON}
-.if defined(WITH_LIGHTNING)
+.if ${PORT_OPTIONS:MLIGHTNING}
@${MKDIR} ${XPI_LIBDIR}/${XPI_ID} ${XPI_LIBDIR}/symlinks/thunderbird
@(cd ${XPI_LIBDIR}/${XPI_ID}; ${TAR} -xf ${XPI_FILE})
@${CHOWN} -R ${SHAREOWN}:${SHAREGRP} ${XPI_LIBDIR}/${XPI_ID}
diff --git a/mail/thunderbird-esr/distinfo b/mail/thunderbird-esr/distinfo
index 6333e4c500a5..7dccd06e81a7 100644
--- a/mail/thunderbird-esr/distinfo
+++ b/mail/thunderbird-esr/distinfo
@@ -1,2 +1,2 @@
-SHA256 (thunderbird-10.0.5esr.source.tar.bz2) = d9e94cf730b6ce8974a63cbc240f27671a74c662942c26a6f4264ed24af4281f
-SIZE (thunderbird-10.0.5esr.source.tar.bz2) = 97617123
+SHA256 (thunderbird-10.0.6esr.source.tar.bz2) = 0962399e13ea4b97816730ea81260ec304a6da49c9562840c776f4d1a536c1e8
+SIZE (thunderbird-10.0.6esr.source.tar.bz2) = 97779445
diff --git a/mail/thunderbird-esr/files/patch-alsapulse b/mail/thunderbird-esr/files/patch-alsapulse
new file mode 100644
index 000000000000..47580cd562b3
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-alsapulse
@@ -0,0 +1,119 @@
+--- mozilla/config/autoconf.mk.in~
++++ mozilla/config/autoconf.mk.in
+@@ -568,7 +568,13 @@ MOZ_LIBNOTIFY_CFLAGS = @MOZ_LIBNOTIFY_CF
+ MOZ_LIBNOTIFY_LIBS = @MOZ_LIBNOTIFY_LIBS@
+ MOZ_ENABLE_LIBNOTIFY = @MOZ_ENABLE_LIBNOTIFY@
+
++MOZ_ALSA = @MOZ_ALSA@
+ MOZ_ALSA_LIBS = @MOZ_ALSA_LIBS@
++MOZ_ALSA_CFLAGS = @MOZ_ALSA_CFLAGS@
++
++MOZ_PULSEAUDIO = @MOZ_PULSEAUDIO@
++MOZ_PULSEAUDIO_LIBS = @MOZ_PULSEAUDIO_LIBS@
++MOZ_PULSEAUDIO_CFLAGS = @MOZ_PULSEAUDIO_CFLAGS@
+
+ GLIB_CFLAGS = @GLIB_CFLAGS@
+ GLIB_LIBS = @GLIB_LIBS@
+--- mozilla/configure.in~
++++ mozilla/configure.in
+@@ -5758,17 +5775,48 @@ dnl ====================================
+ dnl = Check alsa availability on Linux if using sydneyaudio
+ dnl ========================================================
+
++MOZ_ARG_ENABLE_BOOL(alsa,
++[ --enable-alsa Enable Alsa support],
++MOZ_ALSA=1,
++MOZ_ALSA= MOZ_ALSA_FORCE=$enableval)
++
+ dnl If using sydneyaudio with Linux, ensure that the alsa library is available
+-if test -n "$MOZ_SYDNEYAUDIO"; then
++if test -n "$MOZ_SYDNEYAUDIO" -a "$MOZ_ALSA_FORCE" != "no"; then
+ case "$target_os" in
+ linux*)
++ MOZ_ALSA=1
++ ;;
++ esac
++fi
++
++if test -n "$MOZ_ALSA"; then
+ PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
+ [echo "$MOZ_ALSA_PKG_ERRORS"
+ AC_MSG_ERROR([Need alsa for Ogg, Wave or WebM decoding on Linux. Disable with --disable-ogg --disable-wave --disable-webm. (On Ubuntu, you might try installing the package libasound2-dev.)])])
+- ;;
+- esac
+ fi
+
++AC_SUBST(MOZ_ALSA_CFLAGS)
++AC_SUBST(MOZ_ALSA)
++
++dnl ========================================================
++dnl = Enable PulseAudio
++dnl ========================================================
++
++MOZ_ARG_ENABLE_BOOL(pulseaudio,
++[ --enable-pulseaudio Enable PulseAudio support],
++MOZ_PULSEAUDIO=1,
++MOZ_PULSEAUDIO=)
++
++if test -n "$MOZ_PULSEAUDIO"; then
++ PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
++ [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
++ AC_MSG_ERROR([pulseaudio audio backend requires libpulse package])])
++fi
++
++AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
++AC_SUBST(MOZ_PULSEAUDIO_LIBS)
++AC_SUBST(MOZ_PULSEAUDIO)
++
+ dnl ========================================================
+ dnl Permissions System
+ dnl ========================================================
+--- mozilla/media/libsydneyaudio/src/Makefile.in~
++++ mozilla/media/libsydneyaudio/src/Makefile.in
+@@ -30,10 +30,6 @@ else ifeq ($(MOZ_WIDGET_TOOLKIT),android)
+ CSRCS = \
+ sydney_audio_android.c \
+ $(NULL)
+-else ifeq ($(OS_ARCH),Linux)
+-CSRCS = \
+- sydney_audio_alsa.c \
+- $(NULL)
+ endif
+
+ ifeq ($(OS_ARCH),WINNT)
+@@ -68,6 +64,18 @@ CSRCS = \
+ $(NULL)
+ endif
+
++ifdef MOZ_ALSA
++CSRCS = \
++ sydney_audio_alsa.c \
++ $(NULL)
++endif
++
++ifdef MOZ_PULSEAUDIO
++CSRCS = \
++ sydney_audio_pulseaudio.c \
++ $(NULL)
++endif
++
+ ifeq ($(OS_ARCH),WINNT)
+ OS_LIBS += winmm.lib
+ endif
+--- mozilla/toolkit/library/libxul-config.mk~
++++ mozilla/toolkit/library/libxul-config.mk
+@@ -348,10 +348,12 @@ ifdef MOZ_NATIVE_LIBVPX
+ EXTRA_DSO_LDOPTS += $(MOZ_LIBVPX_LIBS)
+ endif
+
+-ifdef MOZ_SYDNEYAUDIO
+-ifeq ($(OS_ARCH),Linux)
++ifdef MOZ_ALSA
+ EXTRA_DSO_LDOPTS += $(MOZ_ALSA_LIBS)
+ endif
++
++ifdef MOZ_PULSEAUDIO
++EXTRA_DSO_LDOPTS += $(MOZ_PULSEAUDIO_LIBS)
+ endif
+
+ ifdef HAVE_CLOCK_MONOTONIC
diff --git a/mail/thunderbird-esr/files/patch-bug685258 b/mail/thunderbird-esr/files/patch-bug685258
new file mode 100644
index 000000000000..cac425d6adba
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-bug685258
@@ -0,0 +1,17 @@
+# HG changeset patch
+# User Oleg Romashin <romaxa@gmail.com>
+# Parent a2291c212856ad27622416e83c8311b6a33b52f1
+Bug 685258 - Pulse audio backend does not check provided playback and crashes r=derf
+
+diff --git a/content/media/nsAudioStream.cpp b/content/media/nsAudioStream.cpp
+--- mozilla/content/media/nsAudioStream.cpp
++++ mozilla/content/media/nsAudioStream.cpp
+@@ -429,7 +429,7 @@ nsresult nsNativeAudioStream::Init(PRInt32 aNumChannels, PRInt32 aRate, SampleFo
+ mFormat = aFormat;
+
+ if (sa_stream_create_pcm(reinterpret_cast<sa_stream_t**>(&mAudioHandle),
+- NULL,
++ "Mozilla",
+ SA_MODE_WRONLY,
+ SA_PCM_FORMAT_S16_NE,
+ aRate,
diff --git a/mail/thunderbird-esr/files/patch-bug741737 b/mail/thunderbird-esr/files/patch-bug741737
new file mode 100644
index 000000000000..d4ceffbe8cef
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-bug741737
@@ -0,0 +1,90 @@
+changeset: 91900:eee73897136b
+user: Martin Stransky <stransky@redhat.com>
+date: Tue Apr 17 19:57:40 2012 -0400
+summary: Bug 741737 - Configure libvpx with pkgconfig. r=khuey, a=npotb
+
+diff --git a/configure.in b/configure.in
+--- mozilla/configure.in
++++ mozilla/configure.in
+@@ -5588,12 +5588,10 @@ MOZ_ARG_DISABLE_BOOL(webm,
+
+ dnl system libvpx Support
+ dnl ========================================================
+-MOZ_ARG_WITH_STRING(system-libvpx,
+-[ --with-system-libvpx=[PFX]
+- Use system libvpx [installed at prefix PFX]],
+- LIBVPX_DIR=$withval)
++MOZ_ARG_WITH_BOOL(system-libvpx,
++[ --with-system-libvpx Use system libvpx (located with pkgconfig)],
++ MOZ_NATIVE_LIBVPX=1)
+
+-MOZ_NATIVE_LIBVPX=
+ MOZ_LIBVPX_INCLUDES=
+ MOZ_LIBVPX_LIBS=
+
+@@ -5606,53 +5604,18 @@ if test -n "$MOZ_WEBM"; then
+ AC_DEFINE(MOZ_VP8_ENCODER)
+ fi
+
+- if test -n "$LIBVPX_DIR" -a "$LIBVPX_DIR" != no; then
+- _SAVE_CFLAGS=$CFLAGS
+- _SAVE_LDFLAGS=$LDFLAGS
+- _SAVE_LIBS=$LIBS
+- if test "${LIBVPX_DIR}" = "yes"; then
+- LIBVPX_DIR=/usr
+- fi
+- CFLAGS="-I${LIBVPX_DIR}/include $CFLAGS"
+- LDFLAGS="-L${LIBVPX_DIR}/lib $LDFLAGS"
+- MOZ_NATIVE_LIBVPX_DEC_TEST=
+- MOZ_CHECK_HEADER(vpx/vpx_decoder.h,
+- [if test ! -f "${LIBVPX_DIR}/include/vpx/vpx_decoder.h"; then
+- AC_MSG_ERROR([vpx/vpx_decoder.h found, but is not in ${LIBVPX_DIR}/include])
+- fi],
+- AC_MSG_ERROR([--with-system-libvpx requested but vpx/vpx_decoder.h not found]))
+- AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver,
+- [MOZ_NATIVE_LIBVPX_DEC_TEST=1],
+- ([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found]))
+- if test -n "$MOZ_NATIVE_LIBVPX_DEC_TEST" ; then
+- AC_MSG_CHECKING([for libvpx version >= v0.9.7])
+- dnl We need at least v0.9.7 to fix several crash bugs (for which we
+- dnl had local patches prior to v0.9.7).
+- dnl
+- dnl This is a terrible test for the library version, but we don't
+- dnl have a good one. There is no version number in a public header,
+- dnl and testing the headers still doesn't guarantee we link against
+- dnl the right version. While we could call vpx_codec_version() at
+- dnl run-time, that would break cross-compiling. There are no
+- dnl additional exported symbols between the v0.9.7 release and the
+- dnl v0.9.6 one to check for.
+- AC_TRY_COMPILE([
+- #include <vpx/vpx_decoder.h>
+- #if !defined(VPX_CODEC_USE_INPUT_PARTITION)
+- #error "test failed."
+- #endif
+- ],
+- [return 0;],
+- [AC_MSG_RESULT([yes])
+- MOZ_NATIVE_LIBVPX=1
+- MOZ_LIBVPX_INCLUDES="-I${LIBVPX_DIR}/include"
+- MOZ_LIBVPX_LIBS="-L${LIBVPX_DIR}/lib -lvpx"],
+- [AC_MSG_RESULT([no])
+- AC_MSG_ERROR([--with-system-libvpx requested but it is not v0.9.7 or later])])
+- fi
+- CFLAGS=$_SAVE_CFLAGS
+- LDFLAGS=$_SAVE_LDFLAGS
+- LIBS=$_SAVE_LIBS
++ if test -n "$MOZ_NATIVE_LIBVPX"; then
++ dnl ============================
++ dnl === libvpx Version check ===
++ dnl ============================
++ dnl Check to see if we have a system libvpx package.
++ PKG_CHECK_MODULES(LIBVPX, vpx >= 0.9.7)
++
++ MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
++ [AC_MSG_ERROR([Couldn't find vpx/vpx_decoder.h which is required for build with system libvpx. Use --without-system-libvpx to build with in-tree libvpx.])])
++
++ AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
++ [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
+ fi
+ fi
+
diff --git a/mail/thunderbird-esr/files/patch-bug753046 b/mail/thunderbird-esr/files/patch-bug753046
new file mode 100644
index 000000000000..ba42ffbde6c4
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-bug753046
@@ -0,0 +1,1267 @@
+# Bug 753046 - Add support for DragonFly/NetBSD
+
+$NetBSD: patch-dom_plugins_ipc_PluginModuleChild.cpp,v 1.1 2012/03/06 12:34:09 ryoon Exp $
+
+--- mozilla/dom/plugins/ipc/PluginModuleChild.cpp.orig 2011-12-20 23:28:14.000000000 +0000
++++ mozilla/dom/plugins/ipc/PluginModuleChild.cpp
+@@ -33,6 +33,8 @@
+ #include "nsPluginsDir.h"
+ #include "nsXULAppAPI.h"
+
++#include <unistd.h>
++
+ #ifdef MOZ_X11
+ # include "mozilla/X11Util.h"
+ #endif
+@@ -228,7 +228,7 @@ PluginModuleChild::Init(const std::strin
+
+ // TODO: use PluginPRLibrary here
+
+-#if defined(OS_LINUX)
++#if defined(OS_LINUX) || defined(OS_BSD)
+ mShutdownFunc =
+ (NP_PLUGINSHUTDOWN) PR_FindFunctionSymbol(mLibrary, "NP_Shutdown");
+
+@@ -1790,7 +1790,7 @@ PluginModuleChild::AnswerNP_GetEntryPoin
+ PLUGIN_LOG_DEBUG_METHOD;
+ AssertPluginThread();
+
+-#if defined(OS_LINUX)
++#if defined(OS_LINUX) || defined(OS_BSD)
+ return true;
+ #elif defined(OS_WIN) || defined(OS_MACOSX)
+ *_retval = mGetEntryPointsFunc(&mFunctions);
+@@ -1823,7 +1823,7 @@ PluginModuleChild::AnswerNP_Initialize(N
+ SendBackUpXResources(FileDescriptor(xSocketFd, false/*don't close*/));
+ #endif
+
+-#if defined(OS_LINUX)
++#if defined(OS_LINUX) || defined(OS_BSD)
+ *_retval = mInitializeFunc(&sBrowserFuncs, &mFunctions);
+ return true;
+ #elif defined(OS_WIN) || defined(OS_MACOSX)
+$NetBSD: patch-dom_plugins_ipc_PluginModuleChild.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $
+
+--- mozilla/dom/plugins/ipc/PluginModuleChild.h.orig 2011-12-20 23:28:14.000000000 +0000
++++ mozilla/dom/plugins/ipc/PluginModuleChild.h
+@@ -340,7 +340,7 @@ private:
+
+ // we get this from the plugin
+ NP_PLUGINSHUTDOWN mShutdownFunc;
+-#ifdef OS_LINUX
++#if defined(OS_LINUX) || defined(OS_BSD)
+ NP_PLUGINUNIXINIT mInitializeFunc;
+ #elif defined(OS_WIN) || defined(OS_MACOSX)
+ NP_PLUGININIT mInitializeFunc;
+$NetBSD: patch-ipc_chromium_Makefile.in,v 1.1 2012/03/06 12:34:09 ryoon Exp $
+
+--- mozilla/ipc/chromium/Makefile.in.orig 2012-02-16 06:40:33.000000000 +0000
++++ mozilla/ipc/chromium/Makefile.in
+@@ -278,6 +278,34 @@ endif
+
+ endif # } OS_LINUX
+
++ifdef OS_BSD # {
++
++CPPSRCS += \
++ atomicops_internals_x86_gcc.cc \
++ file_util_bsd.cc \
++ process_util_bsd.cc \
++ time_posix.cc \
++ $(NULL)
++
++ifdef MOZ_ENABLE_GTK2
++CPPSRCS += \
++ message_pump_glib.cc \
++ $(NULL)
++endif
++
++ifdef MOZ_ENABLE_QT
++MOCSRCS = \
++ moc_message_pump_qt.cc \
++ $(NULL)
++
++CPPSRCS += \
++ $(MOCSRCS) \
++ message_pump_qt.cc \
++ $(NULL)
++endif
++
++endif # } OS_BSD
++
+ # libevent
+
+ ifndef MOZ_NATIVE_LIBEVENT # {
+$NetBSD: patch-ipc_chromium_chromium-config.mk,v 1.2 2012/03/15 08:30:06 ryoon Exp $
+
+--- mozilla/ipc/chromium/chromium-config.mk.orig 2012-02-16 07:40:33.000000000 +0100
++++ mozilla/ipc/chromium/chromium-config.mk 2012-03-11 11:05:40.397182000 +0100
+@@ -56,17 +56,6 @@
+ -I$(DEPTH)/ipc/ipdl/_ipdlheaders \
+ $(NULL)
+
+-ifeq ($(OS_ARCH),Darwin) # {
+-
+-OS_MACOSX = 1
+-OS_POSIX = 1
+-
+-DEFINES += \
+- -DOS_MACOSX=1 \
+- -DOS_POSIX=1 \
+- $(NULL)
+-
+-else # } {
+ ifeq ($(OS_ARCH),WINNT) # {
+ OS_LIBS += $(call EXPAND_LIBNAME,psapi shell32 dbghelp)
+
+@@ -93,13 +82,65 @@
+ endif
+
+ else # } {
+-
+-OS_LINUX = 1
+ OS_POSIX = 1
++DEFINES += -DOS_POSIX=1
++
++ifeq ($(OS_ARCH),Darwin) # {
++
++OS_MACOSX = 1
++DEFINES += \
++ -DOS_MACOSX=1 \
++ $(NULL)
++
++else # } {
++ifeq ($(OS_ARCH),DragonFly) # {
++
++OS_DRAGONFLY = 1
++OS_BSD = 1
++OS_LIBS += $(call EXPAND_LIBNAME,kvm)
++DEFINES += \
++ -DOS_DRAGONFLY=1 \
++ -DOS_BSD=1 \
++ $(NULL)
++
++else # } {
++ifeq ($(OS_ARCH),FreeBSD) # {
++
++OS_FREEBSD = 1
++OS_BSD = 1
++OS_LIBS += $(call EXPAND_LIBNAME,kvm)
++DEFINES += \
++ -DOS_FREEBSD=1 \
++ -DOS_BSD=1 \
++ $(NULL)
+
++else # } {
++ifeq ($(OS_ARCH),NetBSD) # {
++
++OS_NETBSD = 1
++OS_BSD = 1
++OS_LIBS += $(call EXPAND_LIBNAME,kvm)
++DEFINES += \
++ -DOS_NETBSD=1 \
++ -DOS_BSD=1 \
++ $(NULL)
++
++else # } {
++ifeq ($(OS_ARCH),OpenBSD) # {
++
++OS_OPENBSD = 1
++OS_BSD = 1
++OS_LIBS += $(call EXPAND_LIBNAME,kvm)
++DEFINES += \
++ -DOS_OPENBSD=1 \
++ -DOS_BSD=1 \
++ $(NULL)
++
++else # } {
++
++OS_LINUX = 1
+ DEFINES += \
+ -DOS_LINUX=1 \
+- -DOS_POSIX=1 \
+ $(NULL)
+
+ # NB: to stop gcc warnings about exporting template instantiation
+@@ -107,4 +147,8 @@
+
+ endif # }
+ endif # }
++endif # }
++endif # }
++endif # }
++endif # }
+
+$NetBSD: patch-ipc_chromium_src_base_base__paths.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $
+
+--- mozilla/ipc/chromium/src/base/base_paths.h.orig 2011-12-20 23:28:19.000000000 +0000
++++ mozilla/ipc/chromium/src/base/base_paths.h
+@@ -13,7 +13,7 @@
+ #include "base/base_paths_win.h"
+ #elif defined(OS_MACOSX)
+ #include "base/base_paths_mac.h"
+-#elif defined(OS_LINUX)
++#elif defined(OS_LINUX) || defined(OS_BSD)
+ #include "base/base_paths_linux.h"
+ #endif
+ #include "base/path_service.h"
+$NetBSD: patch-ipc_chromium_src_base_debug__util__posic.cc,v 1.3 2012/04/01 15:18:45 ryoon Exp $
+
+--- mozilla/ipc/chromium/src/base/debug_util_posix.cc.orig 2012-03-13 01:36:53.000000000 +0000
++++ mozilla/ipc/chromium/src/base/debug_util_posix.cc
+@@ -5,7 +5,7 @@
+ #include "build/build_config.h"
+ #include "base/debug_util.h"
+
+-#define MOZ_HAVE_EXECINFO_H (!defined(ANDROID) && !defined(__OpenBSD__))
++#define MOZ_HAVE_EXECINFO_H (defined(OS_LINUX) && !defined(ANDROID))
+
+ #include <errno.h>
+ #include <fcntl.h>
+@@ -17,8 +17,13 @@
+ #include <unistd.h>
+ #if MOZ_HAVE_EXECINFO_H
+ #include <execinfo.h>
+-#include <sys/sysctl.h>
+ #endif
++#if defined(OS_DRAGONFLY) || defined(OS_FREEBSD)
++#include <sys/user.h>
++#elif defined(OS_FREEBSD)
++#include <sys/proc.h>
++#endif
++#include <sys/sysctl.h>
+
+ #include "base/basictypes.h"
+ #include "base/eintr_wrapper.h"
+@@ -32,7 +37,7 @@ bool DebugUtil::SpawnDebuggerOnProcess(u
+ return false;
+ }
+
+-#if defined(OS_MACOSX)
++#if defined(OS_MACOSX) || defined(OS_BSD)
+
+ // Based on Apple's recommended method as described in
+ // http://developer.apple.com/qa/qa2004/qa1361.html
+@@ -71,7 +76,13 @@ bool DebugUtil::BeingDebugged() {
+
+ // This process is being debugged if the P_TRACED flag is set.
+ is_set = true;
++#if defined(OS_DRAGONFLY)
++ being_debugged = (info.kp_flags & P_TRACED) != 0;
++#elif defined(OS_FREEBSD)
++ being_debugged = (info.ki_flag & P_TRACED) != 0;
++#else
+ being_debugged = (info.kp_proc.p_flag & P_TRACED) != 0;
++#endif
+ return being_debugged;
+ }
+
+diff --git ipc/chromium/src/base/dir_reader_bsd.h ipc/chromium/src/base/dir_reader_bsd.h
+new file mode 100644
+index 0000000..3fc1a87
+--- /dev/null
++++ mozilla/ipc/chromium/src/base/dir_reader_bsd.h
+@@ -0,0 +1,108 @@
++// Copyright (c) 2010 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// derived from dir_reader_linux.h
++
++#ifndef BASE_DIR_READER_BSD_H_
++#define BASE_DIR_READER_BSD_H_
++#pragma once
++
++#include <dirent.h>
++#include <errno.h>
++#include <fcntl.h>
++#include <stdint.h>
++#include <unistd.h>
++
++#include "base/logging.h"
++#include "base/eintr_wrapper.h"
++
++// See the comments in dir_reader_posix.h about this.
++
++namespace base {
++
++class DirReaderBSD {
++ public:
++ explicit DirReaderBSD(const char* directory_path)
++#ifdef O_DIRECTORY
++ : fd_(open(directory_path, O_RDONLY | O_DIRECTORY)),
++#else
++ : fd_(open(directory_path, O_RDONLY)),
++#endif
++ offset_(0),
++ size_(0) {
++ memset(buf_, 0, sizeof(buf_));
++ }
++
++ ~DirReaderBSD() {
++ if (fd_ >= 0) {
++ if (HANDLE_EINTR(close(fd_)))
++ DLOG(ERROR) << "Failed to close directory handle";
++ }
++ }
++
++ bool IsValid() const {
++ return fd_ >= 0;
++ }
++
++ // Move to the next entry returning false if the iteration is complete.
++ bool Next() {
++ if (size_) {
++ struct dirent* dirent = reinterpret_cast<struct dirent*>(&buf_[offset_]);
++ offset_ += dirent->d_reclen;
++ }
++
++ if (offset_ != size_)
++ return true;
++
++#ifdef OS_OPENBSD
++ const int r = getdirentries(fd_, buf_, sizeof(buf_), basep_);
++#else
++ const int r = getdents(fd_, buf_, sizeof(buf_));
++#endif
++ if (r == 0)
++ return false;
++ if (r == -1) {
++#ifdef OS_OPENBSD
++ DLOG(ERROR) << "getdirentries returned an error: " << errno;
++#else
++ DLOG(ERROR) << "getdents returned an error: " << errno;
++#endif
++ return false;
++ }
++ size_ = r;
++ offset_ = 0;
++ return true;
++ }
++
++ const char* name() const {
++ if (!size_)
++ return NULL;
++
++ const struct dirent* dirent =
++ reinterpret_cast<const struct dirent*>(&buf_[offset_]);
++ return dirent->d_name;
++ }
++
++ int fd() const {
++ return fd_;
++ }
++
++ static bool IsFallback() {
++ return false;
++ }
++
++ private:
++ const int fd_;
++ char buf_[512];
++#ifdef OS_OPENBSD
++ off_t *basep_;
++#endif
++ size_t offset_, size_;
++
++ DISALLOW_COPY_AND_ASSIGN(DirReaderBSD);
++};
++
++} // namespace base
++
++#endif // BASE_DIR_READER_BSD_H_
+diff --git ipc/chromium/src/base/dir_reader_posix.h ipc/chromium/src/base/dir_reader_posix.h
+index 9a34492..62b280c 100644
+--- mozilla/ipc/chromium/src/base/dir_reader_posix.h
++++ mozilla/ipc/chromium/src/base/dir_reader_posix.h
+@@ -18,6 +18,8 @@
+
+ #if defined(OS_LINUX)
+ #include "base/dir_reader_linux.h"
++#elif defined(OS_BSD)
++#include "base/dir_reader_bsd.h"
+ #else
+ #include "base/dir_reader_fallback.h"
+ #endif
+@@ -26,6 +28,8 @@
+
+ #if defined(OS_LINUX)
+ typedef DirReaderLinux DirReaderPosix;
++#elif defined(OS_BSD)
++typedef DirReaderBSD DirReaderPosix;
+ #else
+ typedef DirReaderFallback DirReaderPosix;
+ #endif
+$NetBSD: patch-ipc_chromium_src_base_file__util.h,v 1.2 2012/03/06 12:34:09 ryoon Exp $
+
+--- mozilla/ipc/chromium/src/base/file_util.h.orig 2011-12-20 23:28:19.000000000 +0000
++++ mozilla/ipc/chromium/src/base/file_util.h
+@@ -16,8 +16,8 @@
+ #include <sys/stat.h>
+ #elif defined(OS_POSIX)
+ #include <sys/types.h>
+-#include <fts.h>
+ #include <sys/stat.h>
++#include <fts.h>
+ #endif
+
+ #include <stdio.h>
+$NetBSD: patch-ipc_chromium_src_base_file__util__bsd.cc,v 1.1 2012/03/06 12:34:09 ryoon Exp $
+
+--- mozilla/ipc/chromium/src/base/file_util_bsd.cc.orig 2012-01-07 18:21:18.000000000 +0000
++++ mozilla/ipc/chromium/src/base/file_util_bsd.cc
+@@ -0,0 +1,80 @@
++// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// this is a derivative of file_util_linux.cc
++
++#include "base/file_util.h"
++
++#include <fcntl.h>
++#include <unistd.h>
++
++#include <string>
++#include <vector>
++
++#include "base/eintr_wrapper.h"
++#include "base/file_path.h"
++#include "base/string_util.h"
++
++namespace file_util {
++
++bool GetTempDir(FilePath* path) {
++ const char* tmp = getenv("TMPDIR");
++ if (tmp)
++ *path = FilePath(tmp);
++ else
++ *path = FilePath("/tmp");
++ return true;
++}
++
++bool GetShmemTempDir(FilePath* path) {
++ return GetTempDir(path);
++}
++
++bool CopyFile(const FilePath& from_path, const FilePath& to_path) {
++ int infile = open(from_path.value().c_str(), O_RDONLY);
++ if (infile < 0)
++ return false;
++
++ int outfile = creat(to_path.value().c_str(), 0666);
++ if (outfile < 0) {
++ close(infile);
++ return false;
++ }
++
++ const size_t kBufferSize = 32768;
++ std::vector<char> buffer(kBufferSize);
++ bool result = true;
++
++ while (result) {
++ ssize_t bytes_read = HANDLE_EINTR(read(infile, &buffer[0], buffer.size()));
++ if (bytes_read < 0) {
++ result = false;
++ break;
++ }
++ if (bytes_read == 0)
++ break;
++ // Allow for partial writes
++ ssize_t bytes_written_per_read = 0;
++ do {
++ ssize_t bytes_written_partial = HANDLE_EINTR(write(
++ outfile,
++ &buffer[bytes_written_per_read],
++ bytes_read - bytes_written_per_read));
++ if (bytes_written_partial < 0) {
++ result = false;
++ break;
++ }
++ bytes_written_per_read += bytes_written_partial;
++ } while (bytes_written_per_read < bytes_read);
++ }
++
++ if (HANDLE_EINTR(close(infile)) < 0)
++ result = false;
++ if (HANDLE_EINTR(close(outfile)) < 0)
++ result = false;
++
++ return result;
++}
++
++} // namespace file_util
+$NetBSD: patch-ipc_chromium_src_base_file__util__posix.cc,v 1.2 2012/03/06 12:34:09 ryoon Exp $
+
+--- mozilla/ipc/chromium/src/base/file_util_posix.cc.orig 2011-12-20 23:28:19.000000000 +0000
++++ mozilla/ipc/chromium/src/base/file_util_posix.cc
+@@ -31,7 +31,7 @@
+ #include "base/time.h"
+
+ // FreeBSD/OpenBSD lacks stat64, but its stat handles files >2GB just fine
+-#if defined(OS_FREEBSD) || defined(OS_OPENBSD)
++#ifndef OS_LINUX
+ #define stat64 stat
+ #endif
+
+$NetBSD: patch-ipc_chromium_src_base_message__loop.cc,v 1.1 2012/03/06 12:34:09 ryoon Exp $
+
+--- mozilla/ipc/chromium/src/base/message_loop.cc.orig 2012-02-16 07:40:33.000000000 +0100
++++ mozilla/ipc/chromium/src/base/message_loop.cc 2012-02-21 21:24:41.000000000 +0100
+@@ -19,7 +19,7 @@
+ #if defined(OS_POSIX)
+ #include "base/message_pump_libevent.h"
+ #endif
+-#if defined(OS_LINUX)
++#if defined(OS_LINUX) || defined(OS_BSD)
+ #ifdef MOZ_WIDGET_GTK2
+ #include "base/message_pump_glib.h"
+ #endif
+@@ -119,7 +119,7 @@
+ if (type_ == TYPE_UI) {
+ #if defined(OS_MACOSX)
+ pump_ = base::MessagePumpMac::Create();
+-#elif defined(OS_LINUX)
++#elif defined(OS_LINUX) || defined(OS_BSD)
+ pump_ = new base::MessagePumpForUI();
+ #endif // OS_LINUX
+ } else if (type_ == TYPE_IO) {
+$NetBSD: patch-ipc_chromium_src_base_platform__file__posix.cc,v 1.1 2011/07/12 15:12:36 tnn Exp $
+
+--- mozilla/ipc/chromium/src/base/platform_file_posix.cc.orig 2011-06-15 21:57:27.000000000 +0000
++++ mozilla/ipc/chromium/src/base/platform_file_posix.cc
+@@ -9,6 +9,7 @@
+ #ifdef ANDROID
+ #include <linux/stat.h>
+ #endif
++#include <sys/stat.h> /* for S_IRUSR */
+
+ #include "base/logging.h"
+ #include "base/string_util.h"
+$NetBSD: patch-ipc_chromium_src_base_platform__thread.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $
+
+--- 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
+@@ -25,6 +25,8 @@ typedef pthread_t PlatformThreadHandle;
+ #if defined(OS_LINUX)
+ #include <unistd.h>
+ typedef pid_t PlatformThreadId;
++#elif defined(OS_FREEBSD) || defined(OS_DRAGONFLY) || defined (OS_NETBSD)
++typedef lwpid_t PlatformThreadId;
+ #elif defined(OS_MACOSX)
+ #include <mach/mach.h>
+ typedef mach_port_t PlatformThreadId;
+$NetBSD: patch-ipc_chromium_src_base_platform__thread__posix.cc,v 1.4 2012/04/01 15:18:45 ryoon Exp $
+
+--- mozilla/ipc/chromium/src/base/platform_thread_posix.cc.orig 2012-03-13 01:36:53.000000000 +0000
++++ mozilla/ipc/chromium/src/base/platform_thread_posix.cc
+@@ -9,9 +9,18 @@
+
+ #if defined(OS_MACOSX)
+ #include <mach/mach.h>
++#elif defined(OS_NETBSD)
++#include <lwp.h>
+ #elif defined(OS_LINUX)
+ #include <sys/syscall.h>
+ #include <unistd.h>
++#elif defined(OS_DRAGONFLY)
++#include <unistd.h>
++#elif defined(OS_FREEBSD)
++_Pragma("GCC visibility push(default)")
++extern "C" int thr_self(long *); // XXX #include <sys/thr.h>
++_Pragma("GCC visibility pop")
++#include <pthread_np.h>
+ #endif
+
+ #if defined(OS_MACOSX)
+@@ -38,7 +45,19 @@
+ // into the kernel.
+ #if defined(OS_MACOSX)
+ return mach_thread_self();
+-#elif defined (__OpenBSD__)
++#elif defined(OS_NETBSD)
++ return _lwp_self();
++#elif defined(OS_DRAGONFLY)
++ return lwp_gettid();
++#elif defined(OS_FREEBSD)
++# if __FreeBSD_version > 900030
++ return pthread_getthreadid_np();
++# else
++ long lwpid;
++ thr_self(&lwpid);
++ return lwpid;
++# endif
++#elif defined(OS_OPENBSD)
+ // TODO(BSD): find a better thread ID
+ return (intptr_t)(pthread_self());
+ #elif defined(OS_LINUX)
+$NetBSD: patch-ipc_chromium_src_base_process__util.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $
+
+--- mozilla/ipc/chromium/src/base/process_util.h.orig 2011-12-21 00:28:19.000000000 +0100
++++ mozilla/ipc/chromium/src/base/process_util.h 2012-01-31 13:14:54.000000000 +0100
+@@ -280,6 +280,7 @@ class NamedProcessIterator {
+ const ProcessEntry* NextProcessEntry();
+
+ private:
++#if !defined(OS_BSD)
+ // Determines whether there's another process (regardless of executable)
+ // left in the list of all processes. Returns true and sets entry_ to
+ // that process's info if there is one, false otherwise.
+@@ -292,18 +292,24 @@
+ void InitProcessEntry(ProcessEntry* entry);
+
+ std::wstring executable_name_;
++#endif
+
+ #if defined(OS_WIN)
+ HANDLE snapshot_;
+ bool started_iteration_;
+ #elif defined(OS_LINUX)
+ DIR *procfs_dir_;
++#elif defined(OS_BSD)
++ std::vector<ProcessEntry> content;
++ size_t nextEntry;
+ #elif defined(OS_MACOSX)
+ std::vector<kinfo_proc> kinfo_procs_;
+ size_t index_of_kinfo_proc_;
+ #endif
++#if !defined(OS_BSD)
+ ProcessEntry entry_;
+ const ProcessFilter* filter_;
++#endif
+
+ DISALLOW_EVIL_CONSTRUCTORS(NamedProcessIterator);
+ };
+$NetBSD: patch-ipc_chromium_src_base_process__util__bsd.cc,v 1.4 2012/04/01 15:18:45 ryoon Exp $
+
+--- mozilla/ipc/chromium/src/base/process_util_bsd.cc.orig 2012-04-01 00:04:28.000000000 +0000
++++ mozilla/ipc/chromium/src/base/process_util_bsd.cc
+@@ -0,0 +1,326 @@
++// Copyright (c) 2008 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// derived from process_util_linux.cc and process_util_mac.cc
++
++#include "base/process_util.h"
++
++#include <ctype.h>
++#include <fcntl.h>
++#include <unistd.h>
++#include <string>
++#if defined(OS_DRAGONFLY) || defined(OS_FREEBSD)
++/* DragonFly, as of v3.0.1, and FreeBSD 9.0-RELEASE do not explicitly mark symbols public */
++#define PRE_SYS_INCLUDE _Pragma("GCC visibility push(default)")
++#define POST_SYS_INCLUDE _Pragma("GCC visibility pop")
++#else
++#define PRE_SYS_INCLUDE
++#define POST_SYS_INCLUDE
++#endif
++PRE_SYS_INCLUDE
++#include <kvm.h>
++POST_SYS_INCLUDE
++#include <sys/sysctl.h>
++#include <sys/types.h>
++#include <sys/wait.h>
++#if defined(OS_DRAGONFLY)
++PRE_SYS_INCLUDE
++#include <sys/user.h>
++POST_SYS_INCLUDE
++#define HAVE_POSIX_SPAWN 1
++#endif
++#if defined(OS_FREEBSD)
++PRE_SYS_INCLUDE
++#include <sys/user.h>
++POST_SYS_INCLUDE
++#endif
++
++#include "base/debug_util.h"
++#include "base/eintr_wrapper.h"
++#include "base/file_util.h"
++#include "base/logging.h"
++#include "base/string_tokenizer.h"
++#include "base/string_util.h"
++
++#if defined(OS_NETBSD)
++#include <sys/param.h>
++#if __NetBSD_Version__ >= 600000000
++#define HAVE_POSIX_SPAWN 1
++#endif
++#endif
++
++#ifdef HAVE_POSIX_SPAWN
++PRE_SYS_INCLUDE
++#include <spawn.h>
++POST_SYS_INCLUDE
++extern "C" char **environ __dso_public;
++#endif
++
++namespace {
++
++enum ParsingState {
++ KEY_NAME,
++ KEY_VALUE
++};
++
++static mozilla::EnvironmentLog gProcessLog("MOZ_PROCESS_LOG");
++
++} // namespace
++
++namespace base {
++
++#ifdef HAVE_POSIX_SPAWN
++
++void FreeEnvVarsArray(char* array[], int length)
++{
++ for (int i = 0; i < length; i++) {
++ free(array[i]);
++ }
++ delete[] array;
++}
++
++bool LaunchApp(const std::vector<std::string>& argv,
++ const file_handle_mapping_vector& fds_to_remap,
++ bool wait, ProcessHandle* process_handle) {
++ return LaunchApp(argv, fds_to_remap, environment_map(),
++ wait, process_handle);
++}
++
++bool LaunchApp(const std::vector<std::string>& argv,
++ const file_handle_mapping_vector& fds_to_remap,
++ const environment_map& env_vars_to_set,
++ bool wait, ProcessHandle* process_handle,
++ ProcessArchitecture arch) {
++ bool retval = true;
++
++ char* argv_copy[argv.size() + 1];
++ for (size_t i = 0; i < argv.size(); i++) {
++ argv_copy[i] = const_cast<char*>(argv[i].c_str());
++ }
++ argv_copy[argv.size()] = NULL;
++
++ // Make sure we don't leak any FDs to the child process by marking all FDs
++ // as close-on-exec.
++ SetAllFDsToCloseOnExec();
++
++ // Copy environment to a new char array and add the variables
++ // in env_vars_to_set.
++ // Existing variables are overwritten by env_vars_to_set.
++ int pos = 0;
++ environment_map combined_env_vars = env_vars_to_set;
++ while(environ[pos] != NULL) {
++ std::string varString = environ[pos];
++ std::string varName = varString.substr(0, varString.find_first_of('='));
++ std::string varValue = varString.substr(varString.find_first_of('=') + 1);
++ if (combined_env_vars.find(varName) == combined_env_vars.end()) {
++ combined_env_vars[varName] = varValue;
++ }
++ pos++;
++ }
++ int varsLen = combined_env_vars.size() + 1;
++
++ char** vars = new char*[varsLen];
++ int i = 0;
++ for (environment_map::const_iterator it = combined_env_vars.begin();
++ it != combined_env_vars.end(); ++it) {
++ std::string entry(it->first);
++ entry += "=";
++ entry += it->second;
++ vars[i] = strdup(entry.c_str());
++ i++;
++ }
++ vars[i] = NULL;
++
++ posix_spawn_file_actions_t file_actions;
++ if (posix_spawn_file_actions_init(&file_actions) != 0) {
++ FreeEnvVarsArray(vars, varsLen);
++ return false;
++ }
++
++ // Turn fds_to_remap array into a set of dup2 calls.
++ for (file_handle_mapping_vector::const_iterator it = fds_to_remap.begin();
++ it != fds_to_remap.end();
++ ++it) {
++ int src_fd = it->first;
++ int dest_fd = it->second;
++
++ if (src_fd == dest_fd) {
++ int flags = fcntl(src_fd, F_GETFD);
++ if (flags != -1) {
++ fcntl(src_fd, F_SETFD, flags & ~FD_CLOEXEC);
++ }
++ } else {
++ if (posix_spawn_file_actions_adddup2(&file_actions, src_fd, dest_fd) != 0) {
++ posix_spawn_file_actions_destroy(&file_actions);
++ FreeEnvVarsArray(vars, varsLen);
++ return false;
++ }
++ }
++ }
++
++ pid_t pid = 0;
++ int spawn_succeeded = (posix_spawnp(&pid,
++ argv_copy[0],
++ &file_actions,
++ NULL,
++ argv_copy,
++ vars) == 0);
++
++ FreeEnvVarsArray(vars, varsLen);
++
++ posix_spawn_file_actions_destroy(&file_actions);
++
++ bool process_handle_valid = pid > 0;
++ if (!spawn_succeeded || !process_handle_valid) {
++ retval = false;
++ } else {
++ if (wait)
++ HANDLE_EINTR(waitpid(pid, 0, 0));
++
++ if (process_handle)
++ *process_handle = pid;
++ }
++
++ return retval;
++}
++
++bool LaunchApp(const CommandLine& cl,
++ bool wait, bool start_hidden, ProcessHandle* process_handle) {
++ // TODO(playmobil): Do we need to respect the start_hidden flag?
++ file_handle_mapping_vector no_files;
++ return LaunchApp(cl.argv(), no_files, wait, process_handle);
++}
++
++#else // no posix_spawn, use fork/exec
++
++bool LaunchApp(const std::vector<std::string>& argv,
++ const file_handle_mapping_vector& fds_to_remap,
++ bool wait, ProcessHandle* process_handle) {
++ return LaunchApp(argv, fds_to_remap, environment_map(),
++ wait, process_handle);
++}
++
++bool LaunchApp(const std::vector<std::string>& argv,
++ const file_handle_mapping_vector& fds_to_remap,
++ const environment_map& env_vars_to_set,
++ bool wait, ProcessHandle* process_handle,
++ ProcessArchitecture arch) {
++ scoped_array<char*> argv_cstr(new char*[argv.size() + 1]);
++ // Illegal to allocate memory after fork and before execvp
++ InjectiveMultimap fd_shuffle1, fd_shuffle2;
++ fd_shuffle1.reserve(fds_to_remap.size());
++ fd_shuffle2.reserve(fds_to_remap.size());
++
++ pid_t pid = fork();
++ if (pid < 0)
++ return false;
++
++ if (pid == 0) {
++ for (file_handle_mapping_vector::const_iterator
++ it = fds_to_remap.begin(); it != fds_to_remap.end(); ++it) {
++ fd_shuffle1.push_back(InjectionArc(it->first, it->second, false));
++ fd_shuffle2.push_back(InjectionArc(it->first, it->second, false));
++ }
++
++ if (!ShuffleFileDescriptors(&fd_shuffle1))
++ _exit(127);
++
++ CloseSuperfluousFds(fd_shuffle2);
++
++ for (environment_map::const_iterator it = env_vars_to_set.begin();
++ it != env_vars_to_set.end(); ++it) {
++ if (setenv(it->first.c_str(), it->second.c_str(), 1/*overwrite*/))
++ _exit(127);
++ }
++
++ for (size_t i = 0; i < argv.size(); i++)
++ argv_cstr[i] = const_cast<char*>(argv[i].c_str());
++ argv_cstr[argv.size()] = NULL;
++ execvp(argv_cstr[0], argv_cstr.get());
++ // if we get here, we're in serious trouble and should complain loudly
++ DLOG(ERROR) << "FAILED TO exec() CHILD PROCESS, path: " << argv_cstr[0];
++ exit(127);
++ } else {
++ gProcessLog.print("==> process %d launched child process %d\n",
++ GetCurrentProcId(), pid);
++ if (wait)
++ HANDLE_EINTR(waitpid(pid, 0, 0));
++
++ if (process_handle)
++ *process_handle = pid;
++ }
++
++ return true;
++}
++
++bool LaunchApp(const CommandLine& cl,
++ bool wait, bool start_hidden,
++ ProcessHandle* process_handle) {
++ file_handle_mapping_vector no_files;
++ return LaunchApp(cl.argv(), no_files, wait, process_handle);
++}
++
++#endif
++
++NamedProcessIterator::NamedProcessIterator(const std::wstring& executable_name,
++ const ProcessFilter* filter)
++{
++ int numEntries;
++ kvm_t *kvm;
++ std::string exe(WideToASCII(executable_name));
++
++#if defined(OS_DRAGONFLY) || defined(OS_FREEBSD)
++ kvm = kvm_open(NULL, NULL, NULL, O_RDONLY, NULL);
++ struct kinfo_proc* procs = kvm_getprocs(kvm, KERN_PROC_UID, getuid(), &numEntries);
++ if (procs != NULL && numEntries > 0) {
++ for (int i = 0; i < numEntries; i++) {
++# if defined(OS_DRAGONFLY)
++ if (exe != procs[i].kp_comm) continue;
++ if (filter && !filter->Includes(procs[i].kp_pid, procs[i].kp_ppid)) continue;
++ ProcessEntry e;
++ e.pid = procs[i].kp_pid;
++ e.ppid = procs[i].kp_ppid;
++ strlcpy(e.szExeFile, procs[i].kp_comm, sizeof e.szExeFile);
++ content.push_back(e);
++# elif defined(OS_FREEBSD)
++ if (exe != procs[i].ki_comm) continue;
++ if (filter && !filter->Includes(procs[i].ki_pid, procs[i].ki_ppid)) continue;
++ ProcessEntry e;
++ e.pid = procs[i].ki_pid;
++ e.ppid = procs[i].ki_ppid;
++ strlcpy(e.szExeFile, procs[i].ki_comm, sizeof e.szExeFile);
++ content.push_back(e);
++# endif
++#else
++ kvm = kvm_open(NULL, NULL, NULL, KVM_NO_FILES, NULL);
++ struct kinfo_proc2* procs = kvm_getproc2(kvm, KERN_PROC_UID, getuid(), sizeof(struct kinfo_proc2), &numEntries);
++ if (procs != NULL && numEntries > 0) {
++ for (int i = 0; i < numEntries; i++) {
++ if (exe != procs[i].p_comm) continue;
++ if (filter && !filter->Includes(procs[i].p_pid, procs[i].p_ppid)) continue;
++ ProcessEntry e;
++ e.pid = procs[i].p_pid;
++ e.ppid = procs[i].p_ppid;
++ strlcpy(e.szExeFile, procs[i].p_comm, sizeof e.szExeFile);
++ content.push_back(e);
++#endif
++ }
++ }
++ nextEntry = 0;
++ kvm_close(kvm);
++}
++
++NamedProcessIterator::~NamedProcessIterator() {
++}
++
++const ProcessEntry* NamedProcessIterator::NextProcessEntry() {
++ if (nextEntry >= content.size()) return NULL;
++ return &content[nextEntry++];
++}
++
++bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) const {
++ return false;
++}
++
++} // namespace base
+$NetBSD: patch-ipc_chromium_src_base_process__util__posix.cc,v 1.1 2012/03/06 12:34:09 ryoon Exp $
+
+--- mozilla/ipc/chromium/src/base/process_util_posix.cc.orig 2011-12-20 23:28:19.000000000 +0000
++++ mozilla/ipc/chromium/src/base/process_util_posix.cc
+@@ -116,6 +116,11 @@ void CloseSuperfluousFds(const base::Inj
+ #elif defined(OS_MACOSX)
+ static const rlim_t kSystemDefaultMaxFds = 256;
+ static const char kFDDir[] = "/dev/fd";
++#elif defined(OS_BSD)
++ // the getrlimit below should never fail, so whatever ..
++ static const rlim_t kSystemDefaultMaxFds = 1024;
++ // at least /dev/fd will exist
++ static const char kFDDir[] = "/dev/fd";
+ #endif
+
+ // Get the maximum number of FDs possible.
+@@ -199,7 +204,7 @@ void CloseSuperfluousFds(const base::Inj
+ void SetAllFDsToCloseOnExec() {
+ #if defined(OS_LINUX)
+ const char fd_dir[] = "/proc/self/fd";
+-#elif defined(OS_MACOSX)
++#elif defined(OS_MACOSX) || defined(OS_BSD)
+ const char fd_dir[] = "/dev/fd";
+ #endif
+ ScopedDIR dir_closer(opendir(fd_dir));
+$NetBSD: patch-ipc_chromium_src_base_sys__info__posix.cc,v 1.2 2011/11/27 13:09:00 tnn Exp $
+
+--- mozilla/ipc/chromium/src/base/sys_info_posix.cc.orig 2011-11-04 21:34:00.000000000 +0000
++++ mozilla/ipc/chromium/src/base/sys_info_posix.cc
+@@ -18,6 +18,11 @@
+ #include <mach/mach_init.h>
+ #endif
+
++#if defined(OS_NETBSD)
++#include <sys/param.h>
++#include <sys/sysctl.h>
++#endif
++
+ #include "base/logging.h"
+ #include "base/string_util.h"
+
+@@ -26,7 +31,11 @@ namespace base {
+ int SysInfo::NumberOfProcessors() {
+ // It seems that sysconf returns the number of "logical" processors on both
+ // mac and linux. So we get the number of "online logical" processors.
++#ifdef _SC_NPROCESSORS_ONLN
+ static long res = sysconf(_SC_NPROCESSORS_ONLN);
++#else
++ static long res = 1;
++#endif
+ if (res == -1) {
+ NOTREACHED();
+ return 1;
+@@ -52,6 +61,20 @@ int64 SysInfo::AmountOfPhysicalMemory()
+ }
+
+ return static_cast<int64>(hostinfo.max_mem);
++#elif defined(OS_NETBSD)
++ int mib[2];
++ int rc;
++ int64_t memSize;
++ size_t len = sizeof(memSize);
++
++ mib[0] = CTL_HW;
++ mib[1] = HW_PHYSMEM64;
++ rc = sysctl( mib, 2, &memSize, &len, NULL, 0 );
++ if (-1 != rc) {
++ return memSize;
++ }
++ return 0;
++
+ #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
++++ mozilla/ipc/chromium/src/base/time_posix.cc
+@@ -167,7 +167,7 @@ TimeTicks TimeTicks::Now() {
+ // With numer and denom = 1 (the expected case), the 64-bit absolute time
+ // reported in nanoseconds is enough to last nearly 585 years.
+
+-#elif defined(__OpenBSD__) || defined(OS_POSIX) && \
++#elif defined(OS_OPENBSD) || defined(OS_POSIX) && \
+ defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0
+
+ struct timespec ts;
+$NetBSD: patch-ipc_chromium_src_build_build__config.h,v 1.4 2012/04/01 15:18:45 ryoon Exp $
+
+--- mozilla/ipc/chromium/src/build/build_config.h.orig 2012-03-13 01:36:53.000000000 +0000
++++ mozilla/ipc/chromium/src/build/build_config.h
+@@ -19,17 +19,23 @@
+ #define OS_MACOSX 1
+ #elif defined(__linux__) || defined(ANDROID)
+ #define OS_LINUX 1
++#elif defined(__NetBSD__)
++#define OS_NETBSD 1
++#elif defined(__DragonFly__)
++#define OS_DRAGONFLY 1
+ #elif defined(__OpenBSD__)
+ #define OS_OPENBSD 1
+ #elif defined(_WIN32)
+ #define OS_WIN 1
++#elif defined(__FreeBSD__)
++#define OS_FREEBSD 1
+ #else
+ #error Please add support for your platform in build/build_config.h
+ #endif
+
+ // For access to standard POSIX features, use OS_POSIX instead of a more
+ // specific macro.
+-#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_OPENBSD)
++#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_BSD)
+ #define OS_POSIX 1
+ #endif
+
+diff --git ipc/chromium/src/chrome/common/ipc_channel_posix.cc ipc/chromium/src/chrome/common/ipc_channel_posix.cc
+index bd866ee..2ea5b19 100644
+--- mozilla/ipc/chromium/src/chrome/common/ipc_channel_posix.cc
++++ mozilla/ipc/chromium/src/chrome/common/ipc_channel_posix.cc
+@@ -7,6 +7,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <stddef.h>
++#include <unistd.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <sys/stat.h>
+$NetBSD: patch-ipc_chromium_src_chrome_common_ipc__channel__posix.h,v 1.1 2011/07/11 12:46:14 tnn Exp $
+
+--- mozilla/ipc/chromium/src/chrome/common/ipc_channel_posix.h.orig 2011-06-15 21:57:27.000000000 +0000
++++ mozilla/ipc/chromium/src/chrome/common/ipc_channel_posix.h
+@@ -92,7 +92,7 @@ class Channel::ChannelImpl : public Mess
+ };
+
+ // This is a control message buffer large enough to hold kMaxReadFDs
+-#if defined(OS_MACOSX)
++#if defined(OS_MACOSX) || defined(OS_NETBSD)
+ // TODO(agl): OSX appears to have non-constant CMSG macros!
+ char input_cmsg_buf_[1024];
+ #else
+$NetBSD: patch-ipc_chromium_src_chrome_common_ipc__message__utils.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $
+
+--- mozilla/ipc/chromium/src/chrome/common/ipc_message_utils.h.orig 2011-12-20 23:28:19.000000000 +0000
++++ mozilla/ipc/chromium/src/chrome/common/ipc_message_utils.h
+@@ -195,7 +195,7 @@
+ };
+ #endif
+
+-#if !(defined(OS_MACOSX) || defined(OS_OPENBSD) || defined(OS_WIN) || (defined(OS_LINUX) && defined(ARCH_CPU_64_BITS)) || defined(ARCH_CPU_S390))
++#if !(defined(OS_MACOSX) || defined(OS_OPENBSD) || defined(OS_WIN) || ((defined(OS_FREEBSD) || defined(OS_DRAGONFLY) || defined(OS_NETBSD) || defined(OS_LINUX)) && defined(ARCH_CPU_64_BITS)) || defined(ARCH_CPU_S390))
+ // There size_t is a synonym for |unsigned long| ...
+ template <>
+ struct ParamTraits<size_t> {
+@@ -248,7 +248,7 @@
+ };
+ #endif // defined(OS_MACOSX)
+
+-#if !(defined(OS_LINUX) && defined(ARCH_CPU_64_BITS))
++#if !((defined(OS_FREEBSD) || defined(OS_DRAGONFLY) || defined(OS_NETBSD) || defined(OS_LINUX)) && defined(ARCH_CPU_64_BITS))
+ // int64 is |long int| on 64-bit systems, uint64 is |unsigned long|
+ template <>
+ struct ParamTraits<int64> {
+$NetBSD: patch-ipc_chromium_src_chrome_common_transport__dib.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $
+
+--- mozilla/ipc/chromium/src/chrome/common/transport_dib.h.orig 2011-12-20 23:28:19.000000000 +0000
++++ mozilla/ipc/chromium/src/chrome/common/transport_dib.h
+@@ -7,7 +7,7 @@
+
+ #include "base/basictypes.h"
+
+-#if defined(OS_WIN) || defined(OS_MACOSX)
++#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_BSD)
+ #include "base/shared_memory.h"
+ #endif
+
+@@ -66,7 +66,7 @@ class TransportDIB {
+ uint32 sequence_num;
+ };
+ typedef HandleAndSequenceNum Id;
+-#elif defined(OS_MACOSX)
++#elif defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_BSD)
+ typedef base::SharedMemoryHandle Handle;
+ // On Mac, the inode number of the backing file is used as an id.
+ typedef base::SharedMemoryId Id;
+@@ -108,7 +108,7 @@ class TransportDIB {
+
+ private:
+ TransportDIB();
+-#if defined(OS_WIN) || defined(OS_MACOSX)
++#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_BSD)
+ explicit TransportDIB(base::SharedMemoryHandle dib);
+ base::SharedMemory shared_memory_;
+ uint32 sequence_num_;
+$NetBSD: patch-ipc_glue_GeckoChildProcessHost.cpp,v 1.2 2012/03/15 08:30:06 ryoon Exp $
+
+--- mozilla/ipc/glue/GeckoChildProcessHost.cpp.orig 2011-12-20 23:28:19.000000000 +0000
++++ mozilla/ipc/glue/GeckoChildProcessHost.cpp
+@@ -430,7 +430,7 @@
+ // and passing wstrings from one config to the other is unsafe. So
+ // we split the logic here.
+
+-#if defined(OS_LINUX) || defined(OS_MACOSX)
++#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_BSD)
+ base::environment_map newEnvVars;
+ // XPCOM may not be initialized in some subprocesses. We don't want
+ // to initialize XPCOM just for the directory service, especially
+@@ -445,8 +445,8 @@
+ if (NS_SUCCEEDED(rv)) {
+ nsCString path;
+ greDir->GetNativePath(path);
+-# ifdef OS_LINUX
+-# ifdef ANDROID
++# if defined(OS_LINUX) || defined(OS_BSD)
++# if defined(ANDROID) || defined(OS_BSD)
+ path += "/lib";
+ # endif // ANDROID
+ const char *ld_library_path = PR_GetEnv("LD_LIBRARY_PATH");
+@@ -557,7 +557,7 @@
+ childArgv.push_back(pidstring);
+
+ #if defined(MOZ_CRASHREPORTER)
+-# if defined(OS_LINUX)
++# if defined(OS_LINUX) || defined(OS_BSD)
+ int childCrashFd, childCrashRemapFd;
+ if (!CrashReporter::CreateNotificationPipeForChild(
+ &childCrashFd, &childCrashRemapFd))
+@@ -594,7 +594,7 @@
+ #endif
+
+ base::LaunchApp(childArgv, mFileMap,
+-#if defined(OS_LINUX) || defined(OS_MACOSX)
++#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_BSD)
+ newEnvVars,
+ #endif
+ false, &process, arch);
+$NetBSD: patch-mm,v 1.13 2012/06/05 18:09:21 ryoon Exp $
+
+--- mozilla/toolkit/library/Makefile.in.orig 2012-05-23 18:57:09.000000000 +0000
++++ mozilla/toolkit/library/Makefile.in
+@@ -534,6 +538,10 @@ EXTRA_DSO_LDOPTS += -lelf -ldemangle
+ endif
+ endif
+
++ifneq (,$(filter DragonFly FreeBSD NetBSD OpenBSD,$(OS_ARCH)))
++OS_LIBS += $(call EXPAND_LIBNAME,kvm)
++endif
++
+ ifeq ($(OS_ARCH),WINNT)
+ OS_LIBS += $(call EXPAND_LIBNAME,shell32 ole32 version winspool comdlg32 imm32 msimg32 shlwapi psapi ws2_32 dbghelp rasapi32 rasdlg iphlpapi uxtheme setupapi secur32 sensorsapi portabledeviceguids windowscodecs wininet)
+ ifdef ACCESSIBILITY
diff --git a/mail/thunderbird-esr/files/patch-configure.in b/mail/thunderbird-esr/files/patch-configure.in
deleted file mode 100644
index 4e91d33a273a..000000000000
--- a/mail/thunderbird-esr/files/patch-configure.in
+++ /dev/null
@@ -1,112 +0,0 @@
---- configure.in.orig 2011-12-19 14:48:06.000000000 +0100
-+++ configure.in 2011-12-19 15:51:19.000000000 +0100
-@@ -1410,7 +1410,7 @@
- CPU_ARCH=sparc
- ;;
-
--x86_64 | ia64)
-+amd64 | x86_64 | ia64)
- CPU_ARCH="$OS_TEST"
- ;;
-
-@@ -1430,7 +1430,7 @@
- dnl ===============================================================
- INTEL_ARCHITECTURE=
- case "$OS_TEST" in
-- x86_64|i?86)
-+ amd64|x86_64|i?86)
- INTEL_ARCHITECTURE=1
- esac
-
-@@ -1753,7 +1753,7 @@
- esac
-
- case "${host_cpu}" in
-- x86_64)
-+ amd64 | x86_64)
- HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
- ;;
- esac
-@@ -2415,6 +2415,9 @@
- x86_64-*)
- AC_DEFINE(_AMD64_)
- ;;
-+ amd64*)
-+ AC_DEFINE(_AMD64_)
-+ ;;
- *)
- AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
- ;;
-@@ -2486,7 +2489,7 @@
- else
- DLL_SUFFIX=".so.1.0"
- fi
-- MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
-+ MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/local)/lib'
- DSO_CFLAGS=''
- DSO_PIC_CFLAGS='-fPIC'
- DSO_LDOPTS='-shared -fPIC'
-@@ -3304,11 +3307,11 @@
- ;;
- *)
- MOZ_CHECK_PTHREADS(pthreads,
-- USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
-+ USE_PTHREADS=1 _PTHREAD_LDFLAGS="-pthreads",
- MOZ_CHECK_PTHREADS(pthread,
-- USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
-+ USE_PTHREADS=1 _PTHREAD_LDFLAGS="-pthread",
- MOZ_CHECK_PTHREADS(c_r,
-- USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
-+ USE_PTHREADS=1 _PTHREAD_LDFLAGS="-pthread",
- MOZ_CHECK_PTHREADS(c,
- USE_PTHREADS=1
- )
-@@ -3383,18 +3386,18 @@
- *-*-freebsd*)
- AC_DEFINE(_REENTRANT)
- AC_DEFINE(_THREAD_SAFE)
-- dnl -pthread links in -lc_r, so don't specify it explicitly.
-+ dnl -pthread links in -pthread, so don't specify it explicitly.
- if test "$ac_cv_have_dash_pthread" = "yes"; then
- _PTHREAD_LDFLAGS="-pthread"
- else
-- _PTHREAD_LDFLAGS="-lc_r"
-+ _PTHREAD_LDFLAGS="-pthread"
- fi
- ;;
-
- *-*-openbsd*|*-*-bsdi*)
- AC_DEFINE(_REENTRANT)
- AC_DEFINE(_THREAD_SAFE)
-- dnl -pthread links in -lc_r, so don't specify it explicitly.
-+ dnl -pthread links in -pthread, so don't specify it explicitly.
- if test "$ac_cv_have_dash_pthread" = "yes"; then
- _PTHREAD_LDFLAGS="-pthread"
- fi
-@@ -3569,7 +3572,7 @@
- ac_cv_func_iconv,
- [AC_TRY_LINK([
- #include <stdlib.h>
-- #include <iconv.h>
-+ #include "/usr/local/include/iconv.h"
- ],
- [
- iconv_t h = iconv_open("", "");
-@@ -3590,7 +3593,7 @@
- ac_cv_func_const_iconv,
- [AC_TRY_COMPILE([
- #include <stdlib.h>
-- #include <iconv.h>
-+ #include "/usr/local/include/iconv.h"
- ],
- [
- const char *input = "testing";
-@@ -4383,7 +4386,7 @@
- LDFLAGS=$_SAVE_LDFLAGS
- LIBS=$_SAVE_LIBS
-
--if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
-+if test "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "/usr" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
- ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
- ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
- fi
diff --git a/mail/thunderbird-esr/files/patch-ipc-chromium-src-base-atomicops_internals_mutex.cc b/mail/thunderbird-esr/files/patch-ipc-chromium-src-base-atomicops_internals_mutex.cc
deleted file mode 100644
index ffb56ac25100..000000000000
--- a/mail/thunderbird-esr/files/patch-ipc-chromium-src-base-atomicops_internals_mutex.cc
+++ /dev/null
@@ -1,10 +0,0 @@
---- mozilla/ipc/chromium/src/base/atomicops_internals_mutex.cc~
-+++ mozilla/ipc/chromium/src/base/atomicops_internals_mutex.cc
-@@ -39,6 +39,7 @@
- * ***** END LICENSE BLOCK ***** */
-
- #include "base/atomicops.h"
-+#include "base/lock.h"
-
- namespace base {
- namespace subtle {
diff --git a/mail/thunderbird-esr/files/patch-ipc-chromium-src-base-file_util_linux.cc b/mail/thunderbird-esr/files/patch-ipc-chromium-src-base-file_util_linux.cc
index d0cc3b14e68b..e146174b2e2e 100644
--- a/mail/thunderbird-esr/files/patch-ipc-chromium-src-base-file_util_linux.cc
+++ b/mail/thunderbird-esr/files/patch-ipc-chromium-src-base-file_util_linux.cc
@@ -1,11 +1,8 @@
--- mozilla/ipc/chromium/src/base/file_util_linux.cc~
+++ mozilla/ipc/chromium/src/base/file_util_linux.cc
-@@ -28,7 +28,7 @@ bool GetShmemTempDir(FilePath* path) {
- #ifdef ANDROID
- return GetTempDir(path);
- #else
-- *path = FilePath("/dev/shm");
-+ *path = FilePath("/tmp");
- return true;
- #endif
- }
+@@ -5,6 +5,7 @@
+ #include "base/file_util.h"
+
+ #include <fcntl.h>
++#include <unistd.h>
+
diff --git a/mail/thunderbird-esr/files/patch-ipc-chromium-src-base-file_util_posix.cc b/mail/thunderbird-esr/files/patch-ipc-chromium-src-base-file_util_posix.cc
deleted file mode 100644
index 3c722016e77b..000000000000
--- a/mail/thunderbird-esr/files/patch-ipc-chromium-src-base-file_util_posix.cc
+++ /dev/null
@@ -1,11 +0,0 @@
---- mozilla/ipc/chromium/src/base/file_util_posix.cc~
-+++ mozilla/ipc/chromium/src/base/file_util_posix.cc
-@@ -30,6 +30,8 @@
- #include "base/string_util.h"
- #include "base/time.h"
-
-+#define stat64 stat
-+
- namespace file_util {
-
- #if defined(GOOGLE_CHROME_BUILD)
diff --git a/mail/thunderbird-esr/files/patch-ipc-chromium-src-base-platform_file_posix.cc b/mail/thunderbird-esr/files/patch-ipc-chromium-src-base-platform_file_posix.cc
deleted file mode 100644
index 14e333ca339b..000000000000
--- a/mail/thunderbird-esr/files/patch-ipc-chromium-src-base-platform_file_posix.cc
+++ /dev/null
@@ -1,10 +0,0 @@
---- mozilla/ipc/chromium/src/base/platform_file_posix.cc~
-+++ mozilla/ipc/chromium/src/base/platform_file_posix.cc
-@@ -9,6 +9,7 @@
- #ifdef ANDROID
- #include <linux/stat.h>
- #endif
-+#include <sys/stat.h>
-
- #include "base/logging.h"
- #include "base/string_util.h"
diff --git a/mail/thunderbird-esr/files/patch-ipc-chromium-src-base-platform_thread_posix.cc b/mail/thunderbird-esr/files/patch-ipc-chromium-src-base-platform_thread_posix.cc
deleted file mode 100644
index 3445b281bc48..000000000000
--- a/mail/thunderbird-esr/files/patch-ipc-chromium-src-base-platform_thread_posix.cc
+++ /dev/null
@@ -1,12 +0,0 @@
---- mozilla/ipc/chromium/src/base/platform_thread_posix.cc.orig 2011-04-27 09:34:28.000000000 +0200
-+++ mozilla/ipc/chromium/src/base/platform_thread_posix.cc 2011-04-27 19:47:36.344446266 +0200
-@@ -34,7 +33,8 @@
- #if defined(OS_MACOSX)
- return mach_thread_self();
- #elif defined(OS_LINUX)
-- return syscall(__NR_gettid);
-+ // TODO(BSD): find a better thread ID
-+ return reinterpret_cast<int64>(pthread_self());
- #endif
- }
-
diff --git a/mail/thunderbird-esr/files/patch-ipc-chromium-src-base-third_party-nspr-prcpucfg.h b/mail/thunderbird-esr/files/patch-ipc-chromium-src-base-third_party-nspr-prcpucfg.h
deleted file mode 100644
index ca7b24fa4860..000000000000
--- a/mail/thunderbird-esr/files/patch-ipc-chromium-src-base-third_party-nspr-prcpucfg.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- mozilla/ipc/chromium/src/base/third_party/nspr/prcpucfg.h~
-+++ 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(__FreeBSD__) || defined(ANDROID)
- #include "base/third_party/nspr/prcpucfg_linux.h"
- #else
- #error Provide a prcpucfg.h appropriate for your platform
diff --git a/mail/thunderbird-esr/files/patch-ipc-chromium-src-base-time_posix.cc b/mail/thunderbird-esr/files/patch-ipc-chromium-src-base-time_posix.cc
new file mode 100644
index 000000000000..27461ccd3fb6
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-ipc-chromium-src-base-time_posix.cc
@@ -0,0 +1,10 @@
+--- mozilla/ipc/chromium/src/base/time_posix.cc~
++++ mozilla/ipc/chromium/src/base/time_posix.cc
+@@ -8,6 +9,7 @@
+ #include <mach/mach_time.h>
+ #endif
+ #include <sys/time.h>
++#include <unistd.h>
+ #ifdef ANDROID
+ #include <time64.h>
+ #else
diff --git a/mail/thunderbird-esr/files/patch-ipc-chromium-src-build-build_config.h b/mail/thunderbird-esr/files/patch-ipc-chromium-src-build-build_config.h
deleted file mode 100644
index e7540d38eceb..000000000000
--- a/mail/thunderbird-esr/files/patch-ipc-chromium-src-build-build_config.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- mozilla/ipc/chromium/src/build/build_config.h~
-+++ mozilla/ipc/chromium/src/build/build_config.h
-@@ -17,7 +17,7 @@
- // A set of macros to use for platform detection.
- #if defined(__APPLE__)
- #define OS_MACOSX 1
--#elif defined(__linux__) || defined(ANDROID)
-+#elif defined(__FreeBSD__) || defined(ANDROID)
- #define OS_LINUX 1
- #elif defined(_WIN32)
- #define OS_WIN 1
diff --git a/mail/thunderbird-esr/files/patch-ldap-sdks-c-sdk-ldap-libraries-libssldap-Makefile.in b/mail/thunderbird-esr/files/patch-ldap-sdks-c-sdk-ldap-libraries-libssldap-Makefile.in
new file mode 100644
index 000000000000..4ec8205074ee
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-ldap-sdks-c-sdk-ldap-libraries-libssldap-Makefile.in
@@ -0,0 +1,12 @@
+--- ldap/sdks/c-sdk/ldap/libraries/libssldap/Makefile.in~
++++ ldap/sdks/c-sdk/ldap/libraries/libssldap/Makefile.in
+@@ -188,6 +188,9 @@ endif
+
+ OBJDEST = $(OBJDIR_NAME)
+
++# accept -pthread with MOZ_NATIVE_NSS
++LINK_DLL = $(CC_FOR_LINK) -shared -o $@ $(OBJS) $(EXTRA_DLL_LIBS)
++
+ ###########################################################################
+
+ ifeq ($(USE_DLL_EXPORTS_FILE), 1)
diff --git a/mail/thunderbird-esr/files/patch-mail-app-nsMailApp.cpp b/mail/thunderbird-esr/files/patch-mail-app-nsMailApp.cpp
new file mode 100644
index 000000000000..0d17050c939c
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-mail-app-nsMailApp.cpp
@@ -0,0 +1,10 @@
+--- mail/app/nsMailApp.cpp~
++++ mail/app/nsMailApp.cpp
+@@ -154,6 +154,7 @@ int main(int argc, char* argv[])
+ TriggerQuirks();
+ #endif
+
++ setenv("MOZ_PLUGIN_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko19:%%LOCALBASE%%/lib/npapi/symlinks/thunderbird", 0);
+ nsresult rv = mozilla::BinaryPath::Get(argv[0], exePath);
+ if (NS_FAILED(rv)) {
+ Output("Couldn't calculate the application directory.\n");
diff --git a/mail/thunderbird-esr/files/patch-mailnews-addrbook-src-nsDirPrefs.cpp b/mail/thunderbird-esr/files/patch-mailnews-addrbook-src-nsDirPrefs.cpp
new file mode 100644
index 000000000000..9bae143f2e26
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-mailnews-addrbook-src-nsDirPrefs.cpp
@@ -0,0 +1,20 @@
+--- mailnews/addrbook/src/nsDirPrefs.cpp~
++++ mailnews/addrbook/src/nsDirPrefs.cpp
+@@ -375,7 +375,7 @@ static bool DIR_SetServerPosition(nsVoid
+ DIR_Server *s=nsnull;
+
+ switch (position) {
+- case DIR_POS_APPEND:
++ case (PRInt32)DIR_POS_APPEND:
+ /* Do nothing if the request is to append a server that is already
+ * in the list.
+ */
+@@ -401,7 +401,7 @@ static bool DIR_SetServerPosition(nsVoid
+ wholeList->AppendElement(server);
+ break;
+
+- case DIR_POS_DELETE:
++ case (PRInt32)DIR_POS_DELETE:
+ /* Remove the prefs corresponding to the given server. If the prefName
+ * value is nsnull, the server has never been saved and there are no
+ * prefs to remove.
diff --git a/mail/thunderbird-esr/files/patch-mailnews-compose-src-nsSmtpProtocol.cpp b/mail/thunderbird-esr/files/patch-mailnews-compose-src-nsSmtpProtocol.cpp
new file mode 100644
index 000000000000..b3a6df4d2c90
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-mailnews-compose-src-nsSmtpProtocol.cpp
@@ -0,0 +1,29 @@
+--- mailnews/compose/src/nsSmtpProtocol.cpp~
++++ mailnews/compose/src/nsSmtpProtocol.cpp
+@@ -127,16 +127,16 @@ nsresult nsExplainErrorDetails(nsISmtpUr
+
+ switch (code)
+ {
+- case NS_ERROR_SMTP_SERVER_ERROR:
+- case NS_ERROR_TCP_READ_ERROR:
+- case NS_ERROR_SMTP_TEMP_SIZE_EXCEEDED:
+- case NS_ERROR_SMTP_PERM_SIZE_EXCEEDED_1:
+- case NS_ERROR_SMTP_PERM_SIZE_EXCEEDED_2:
+- case NS_ERROR_SENDING_FROM_COMMAND:
+- case NS_ERROR_SENDING_RCPT_COMMAND:
+- case NS_ERROR_SENDING_DATA_COMMAND:
+- case NS_ERROR_SENDING_MESSAGE:
+- case NS_ERROR_SMTP_GREETING:
++ case (int)NS_ERROR_SMTP_SERVER_ERROR:
++ case (int)NS_ERROR_TCP_READ_ERROR:
++ case (int)NS_ERROR_SMTP_TEMP_SIZE_EXCEEDED:
++ case (int)NS_ERROR_SMTP_PERM_SIZE_EXCEEDED_1:
++ case (int)NS_ERROR_SMTP_PERM_SIZE_EXCEEDED_2:
++ case (int)NS_ERROR_SENDING_FROM_COMMAND:
++ case (int)NS_ERROR_SENDING_RCPT_COMMAND:
++ case (int)NS_ERROR_SENDING_DATA_COMMAND:
++ case (int)NS_ERROR_SENDING_MESSAGE:
++ case (int)NS_ERROR_SMTP_GREETING:
+ bundle->GetStringFromID(NS_ERROR_GET_CODE(code), getter_Copies(eMsg));
+ msg = nsTextFormatter::vsmprintf(eMsg.get(), args);
+ break;
diff --git a/mail/thunderbird-esr/files/patch-mozilla-build-autoconf-config.sub b/mail/thunderbird-esr/files/patch-mozilla-build-autoconf-config.sub
deleted file mode 100644
index 12a704ade44b..000000000000
--- a/mail/thunderbird-esr/files/patch-mozilla-build-autoconf-config.sub
+++ /dev/null
@@ -1,12 +0,0 @@
---- mozilla/build/autoconf/config.sub.orig 2010-01-05 12:26:13.000000000 +0100
-+++ mozilla/build/autoconf/config.sub 2010-01-05 12:26:46.000000000 +0100
-@@ -403,9 +403,6 @@
- amd64)
- basic_machine=x86_64-pc
- ;;
-- amd64-*)
-- basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
-- ;;
- amdahl)
- basic_machine=580-amdahl
- os=-sysv
diff --git a/mail/thunderbird-esr/files/patch-mozilla-configure.in b/mail/thunderbird-esr/files/patch-mozilla-configure.in
index 4ccc7bfe5017..832f967abc9a 100644
--- a/mail/thunderbird-esr/files/patch-mozilla-configure.in
+++ b/mail/thunderbird-esr/files/patch-mozilla-configure.in
@@ -1,23 +1,5 @@
--- mozilla/configure.in.orig 2010-11-04 21:05:18.000000000 +0100
+++ mozilla/configure.in 2010-11-09 12:59:28.000000000 +0100
-@@ -1549,7 +1549,7 @@
- CPU_ARCH=sparc
- ;;
-
--x86_64 | ia64)
-+amd64 | x86_64 | ia64)
- CPU_ARCH="$OS_TEST"
- ;;
-
-@@ -1567,7 +1567,7 @@ dnl Set INTEL_ARCHITECTURE if we're comp
- dnl ===============================================================
- INTEL_ARCHITECTURE=
- case "$OS_TEST" in
-- x86_64|i?86)
-+ amd64|x86_64|i?86)
- INTEL_ARCHITECTURE=1
- esac
-
@@ -3803,19 +3803,21 @@
AC_CHECK_FUNCS(localtime_r strtok_r)
@@ -45,15 +27,29 @@
AC_DEFINE(HAVE_CLOCK_MONOTONIC)
AC_SUBST(HAVE_CLOCK_MONOTONIC)
AC_SUBST(REALTIME_LIBS)
-@@ -4808,7 +4810,7 @@ CFLAGS=$_SAVE_CFLAGS
+@@ -4230,6 +4233,9 @@
+ if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
+ MOZ_NATIVE_LIBEVENT=
+ else
++PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
++ [MOZ_NATIVE_LIBEVENT=1
++ MOZ_LIBEVENT_INCLUDES="$MOZ_LIBEVENT_CFLAGS"], [
+ if test "${LIBEVENT_DIR}" = "yes"; then
+ LIBEVENT_DIR=/usr
+ fi
+@@ -4242,10 +4248,11 @@ else
+ AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
+ AC_CHECK_LIB(event, event_init,
+ [MOZ_NATIVE_LIBEVENT=1
+- MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
++ MOZ_LIBEVENT_INCLUDES="-I${LIBEVENT_DIR}/include"
+ MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
+ [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
+ fi
++])
+ CFLAGS=$_SAVE_CFLAGS
LDFLAGS=$_SAVE_LDFLAGS
LIBS=$_SAVE_LIBS
-
--if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
-+if test "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "/usr" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
- ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
- ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
- fi
@@ -6022,6 +6024,14 @@
VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
VPX_X86_ASM=1
@@ -62,7 +58,7 @@
+ VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
+ VPX_X86_ASM=1
+ ;;
-+ FreeBSD:amd64)
++ FreeBSD:x86_64)
+ VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
+ VPX_X86_ASM=1
+ ;;
@@ -77,7 +73,7 @@
+ LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
+ LIBJPEG_TURBO_X86_ASM=1
+ ;;
-+ FreeBSD:amd64)
++ FreeBSD:x86_64)
+ LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
+ LIBJPEG_TURBO_X64_ASM=1
+ ;;
diff --git a/mail/thunderbird-esr/files/patch-mozilla-db-sqlite3-src-Makefile.in b/mail/thunderbird-esr/files/patch-mozilla-db-sqlite3-src-Makefile.in
deleted file mode 100644
index 24a7d6206604..000000000000
--- a/mail/thunderbird-esr/files/patch-mozilla-db-sqlite3-src-Makefile.in
+++ /dev/null
@@ -1,11 +0,0 @@
---- mozilla/db/sqlite3/src/Makefile.in.orig 2008-06-19 11:03:17.000000000 -0500
-+++ mozilla/db/sqlite3/src/Makefile.in 2008-06-19 11:04:15.000000000 -0500
-@@ -45,6 +45,8 @@
-
- include $(DEPTH)/config/autoconf.mk
-
-+OS_CFLAGS = -I../../../dist/include/sqlite3
-+OS_LIBS = %%PTHREAD_LIBS%%
- MODULE = sqlite3
- LIBRARY_NAME = sqlite3
- FORCE_SHARED_LIB = 1
diff --git a/mail/thunderbird-esr/files/patch-mozilla-dom-plugins-ipc-PluginMessageUtils.cpp b/mail/thunderbird-esr/files/patch-mozilla-dom-plugins-ipc-PluginMessageUtils.cpp
new file mode 100644
index 000000000000..f088ed439b95
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-mozilla-dom-plugins-ipc-PluginMessageUtils.cpp
@@ -0,0 +1,11 @@
+--- mozilla/dom/plugins/ipc/PluginMessageUtils.cpp~
++++ mozilla/dom/plugins/ipc/PluginMessageUtils.cpp
+@@ -94,7 +94,7 @@ ReplaceAll(const string& haystack, const
+ i += with.length();
+ }
+
+- return munged;
++ return munged.c_str();
+ }
+ #endif
+
diff --git a/mail/thunderbird-esr/files/patch-mozilla-gfx-qcms-Makefile.in b/mail/thunderbird-esr/files/patch-mozilla-gfx-qcms-Makefile.in
deleted file mode 100644
index bad2cf563256..000000000000
--- a/mail/thunderbird-esr/files/patch-mozilla-gfx-qcms-Makefile.in
+++ /dev/null
@@ -1,14 +0,0 @@
---- mozilla/gfx/qcms/Makefile.in.orig 2010-11-25 20:10:32.000000000 +0100
-+++ mozilla/gfx/qcms/Makefile.in 2010-11-25 20:10:06.000000000 +0100
-@@ -44,6 +44,11 @@
- endif
- endif
- endif
-+ifeq ($(OS_TEST),amd64)
-+ CSRCS += transform-sse2.c transform-sse1.c
-+ SSE1_FLAGS=-msse
-+ SSE2_FLAGS=-msse2
-+endif
-
- FORCE_STATIC_LIB = 1
- # This library is used by other shared libs
diff --git a/mail/thunderbird-esr/files/patch-mozilla-gfx-ycbcr-Makefile.in b/mail/thunderbird-esr/files/patch-mozilla-gfx-ycbcr-Makefile.in
new file mode 100644
index 000000000000..041689a51995
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-mozilla-gfx-ycbcr-Makefile.in
@@ -0,0 +1,21 @@
+--- mozilla/gfx/ycbcr/Makefile.in~
++++ mozilla/gfx/ycbcr/Makefile.in
+@@ -58,6 +58,10 @@ ifeq ($(OS_ARCH),Linux)
+ CPPSRCS += yuv_row_posix.cpp \
+ $(NULL)
+ else
++ifeq ($(OS_ARCH),FreeBSD)
++CPPSRCS += yuv_row_posix.cpp \
++ $(NULL)
++else
+ ifeq ($(OS_ARCH),SunOS)
+ CPPSRCS += yuv_row_posix.cpp \
+ $(NULL)
+@@ -70,6 +74,7 @@ CPPSRCS += yuv_row_other.cpp \
+ $(NULL)
+ endif # Darwin
+ endif # SunOS
++endif # FreeBSD
+ endif # linux
+ endif # windows
+ \ No newline at end of file
diff --git a/mail/thunderbird-esr/files/patch-mozilla-ipc-chromium-Makefile.in b/mail/thunderbird-esr/files/patch-mozilla-ipc-chromium-Makefile.in
new file mode 100644
index 000000000000..5d2e72cd0a96
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-mozilla-ipc-chromium-Makefile.in
@@ -0,0 +1,28 @@
+--- mozilla/ipc/chromium/Makefile.in~
++++ mozilla/ipc/chromium/Makefile.in
+@@ -43,6 +43,14 @@ include $(DEPTH)/config/autoconf.mk
+
+ OS_CXXFLAGS := $(filter-out -fshort-wchar,$(OS_CXXFLAGS))
+
++# workaround IPC hang with libevent2
++ifndef MOZ_DEBUG
++ifneq (,$(filter 4.2.%, $(CXX_VERSION)))
++MOZ_OPTIMIZE_FLAGS = -O1
++OS_CXXFLAGS += $(MOZ_OPTIMIZE_FLAGS)
++endif
++endif
++
+ LIBRARY_NAME = chromium_s
+ FORCE_STATIC_LIB = 1
+ LIBXUL_LIBRARY = 1
+@@ -55,9 +60,7 @@ vpath %.c \
+ $(srcdir)/src/third_party/libevent \
+ $(NULL)
+ else # } else {
+-# message_pump_libevent.cc includes third_party/libevent/event.h,
+-# which we put in $(DIST), see export rule below
+-LOCAL_INCLUDES += -I$(DIST)
++LOCAL_INCLUDES += $(filter %/compat, $(MOZ_LIBEVENT_INCLUDES))
+ endif # }
+
+ vpath %.cc \
diff --git a/mail/thunderbird-esr/files/patch-mozilla-ipc-chromium-src-base-dir_reader_linux.h b/mail/thunderbird-esr/files/patch-mozilla-ipc-chromium-src-base-dir_reader_linux.h
deleted file mode 100644
index 5c4e5b79f3d1..000000000000
--- a/mail/thunderbird-esr/files/patch-mozilla-ipc-chromium-src-base-dir_reader_linux.h
+++ /dev/null
@@ -1,45 +0,0 @@
---- mozilla/ipc/chromium/src/base/dir_reader_linux.h.orig 2011-12-16 21:29:22.000000000 +0100
-+++ mozilla/ipc/chromium/src/base/dir_reader_linux.h 2011-12-19 21:00:27.000000000 +0100
-@@ -9,6 +9,7 @@
- #include <errno.h>
- #include <fcntl.h>
- #include <stdint.h>
-+#include <sys/dirent.h>
- #include <sys/syscall.h>
- #include <unistd.h>
-
-@@ -19,6 +20,8 @@
-
- namespace base {
-
-+#define linux_dirent struct dirent
-+#if 0
- struct linux_dirent {
- uint64_t d_ino;
- int64_t d_off;
-@@ -26,11 +29,16 @@
- unsigned char d_type;
- char d_name[0];
- };
-+#endif
-
- class DirReaderLinux {
- public:
- explicit DirReaderLinux(const char* directory_path)
-+#ifdef O_DIRECTORY
- : fd_(open(directory_path, O_RDONLY | O_DIRECTORY)),
-+#else
-+ : fd_(open(directory_path, O_RDONLY)),
-+#endif
- offset_(0),
- size_(0) {
- memset(buf_, 0, sizeof(buf_));
-@@ -57,7 +65,7 @@
- if (offset_ != size_)
- return true;
-
-- const int r = syscall(__NR_getdents64, fd_, buf_, sizeof(buf_));
-+ const int r = syscall(SYS_getdents, fd_, buf_, sizeof(buf_));
- if (r == 0)
- return false;
- if (r == -1) {
diff --git a/mail/thunderbird-esr/files/patch-mozilla-ipc-chromium-src-base-message_pump_libevent.cc b/mail/thunderbird-esr/files/patch-mozilla-ipc-chromium-src-base-message_pump_libevent.cc
new file mode 100644
index 000000000000..4532ca933738
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-mozilla-ipc-chromium-src-base-message_pump_libevent.cc
@@ -0,0 +1,19 @@
+--- mozilla/ipc/chromium/src/base/message_pump_libevent.cc~
++++ mozilla/ipc/chromium/src/base/message_pump_libevent.cc
+@@ -6,6 +6,7 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
++#include <unistd.h>
+
+ #include "eintr_wrapper.h"
+ #include "base/logging.h"
+@@ -15,7 +15,7 @@
+ #include "base/scoped_nsautorelease_pool.h"
+ #include "base/scoped_ptr.h"
+ #include "base/time.h"
+-#include "third_party/libevent/event.h"
++#include "event.h"
+
+ // Lifecycle of struct event
+ // Libevent uses two main data structures:
diff --git a/mail/thunderbird-esr/files/patch-mozilla-js-src-Makefile.in b/mail/thunderbird-esr/files/patch-mozilla-js-src-Makefile.in
index f203d1dce232..e4ffc32e619c 100644
--- a/mail/thunderbird-esr/files/patch-mozilla-js-src-Makefile.in
+++ b/mail/thunderbird-esr/files/patch-mozilla-js-src-Makefile.in
@@ -1,24 +1,5 @@
--- mozilla/js/src/Makefile.in.orig 2011-07-06 05:09:22.000000000 +0200
+++ mozilla/js/src/Makefile.in 2011-07-06 22:23:46.363233778 +0200
-@@ -416,7 +416,7 @@
- # END enclude sources for V8 dtoa
- #############################################
-
--ifeq (,$(filter arm% sparc %86 x86_64,$(TARGET_CPU)))
-+ifeq (,$(filter arm% sparc %86 amd64 x86_64,$(TARGET_CPU)))
-
- VPATH += $(srcdir)/assembler \
- $(srcdir)/assembler/wtf \
-@@ -469,6 +469,9 @@
- else
- #CPPSRCS += only_on_x86.cpp
- endif
-+ifeq (amd64, $(TARGET_CPU))
-+#CPPSRCS += only_on_x86_64.cpp
-+endif
- endif
- ifeq (arm, $(TARGET_CPU))
- #CPPSRCS += only_on_arm.cpp
@@ -793,7 +796,7 @@
endif # WINNT
diff --git a/mail/thunderbird-esr/files/patch-mozilla-js-src-config-mkdepend-Makefile.in b/mail/thunderbird-esr/files/patch-mozilla-js-src-config-mkdepend-Makefile.in
index 6129066e1afd..37f9d4c61f3e 100644
--- a/mail/thunderbird-esr/files/patch-mozilla-js-src-config-mkdepend-Makefile.in
+++ b/mail/thunderbird-esr/files/patch-mozilla-js-src-config-mkdepend-Makefile.in
@@ -5,7 +5,7 @@
include $(topsrcdir)/config/rules.mk
-HOST_CFLAGS += -DINCLUDEDIR=\"/usr/include\" -DOBJSUFFIX=\".$(OBJ_SUFFIX)\"
-+HOST_CFLAGS += -DINCLUDEDIR=\"%%LOCALBASE%%/include\" -DOBJSUFFIX=\".$(OBJ_SUFFIX)\" -I/usr/local/include
++HOST_CFLAGS += -DINCLUDEDIR=\"$(LOCALBASE)/include\" -DOBJSUFFIX=\".$(OBJ_SUFFIX)\" -I/usr/local/include
ifdef GNU_CC
_GCCDIR = $(shell $(CC) -print-file-name=include)
diff --git a/mail/thunderbird-esr/files/patch-mozilla-js-src-config_config.mk b/mail/thunderbird-esr/files/patch-mozilla-js-src-config_config.mk
index c5b42ad3457c..0bacb7ee6f1a 100644
--- a/mail/thunderbird-esr/files/patch-mozilla-js-src-config_config.mk
+++ b/mail/thunderbird-esr/files/patch-mozilla-js-src-config_config.mk
@@ -4,7 +4,7 @@
-I$(srcdir) \
-I. \
-I$(DIST)/include -I$(DIST)/include/nsprpub \
-+ -I%%LOCALBASE%%/include \
++ -I$(LOCALBASE)/include \
$(if $(LIBXUL_SDK),-I$(LIBXUL_SDK)/include -I$(LIBXUL_SDK)/include/nsprpub) \
$(OS_INCLUDES) \
$(NULL)
diff --git a/mail/thunderbird-esr/files/patch-mozilla-js-src-configure.in b/mail/thunderbird-esr/files/patch-mozilla-js-src-configure.in
index 32d7d18a0aa0..4cbf768d1180 100644
--- a/mail/thunderbird-esr/files/patch-mozilla-js-src-configure.in
+++ b/mail/thunderbird-esr/files/patch-mozilla-js-src-configure.in
@@ -1,40 +1,5 @@
--- mozilla/js/src/configure.in.orig 2012-01-29 15:44:24.000000000 +0100
+++ mozilla/js/src/configure.in 2012-01-30 23:37:46.541060008 +0100
-@@ -1410,7 +1410,7 @@
- CPU_ARCH=sparc
- ;;
-
--x86_64 | ia64)
-+amd64 | x86_64 | ia64)
- CPU_ARCH="$OS_TEST"
- ;;
-
-@@ -1432,7 +1432,7 @@
- dnl ===============================================================
- INTEL_ARCHITECTURE=
- case "$OS_TEST" in
-- x86_64|i?86)
-+ amd64|x86_64|i?86)
- INTEL_ARCHITECTURE=1
- esac
-
-@@ -2713,6 +2713,16 @@
- AC_DEFINE(JS_CPU_X86)
- AC_DEFINE(JS_NUNBOX32)
- ;;
-+amd64*-*)
-+ ENABLE_TRACEJIT=1
-+ NANOJIT_ARCH=X64
-+ ENABLE_METHODJIT=1
-+ ENABLE_MONOIC=1
-+ ENABLE_POLYIC=1
-+ ENABLE_POLYIC_TYPED_ARRAY=1
-+ AC_DEFINE(JS_CPU_X64)
-+ AC_DEFINE(JS_PUNBOX64)
-+ ;;
- x86_64*-*)
- NANOJIT_ARCH=X64
- ENABLE_METHODJIT=1
@@ -2732,6 +2742,7 @@
AC_DEFINE(JS_NUNBOX32)
;;
@@ -51,14 +16,11 @@
;;
esac
-@@ -2795,6 +2807,10 @@
- i?86-*)
- AC_DEFINE(AVMPLUS_IA32)
- ;;
-+amd64*-*)
-+ AC_DEFINE(AVMPLUS_AMD64)
-+ AC_DEFINE(AVMPLUS_64BIT)
-+ ;;
- x86_64*-*)
- AC_DEFINE(AVMPLUS_AMD64)
- AC_DEFINE(AVMPLUS_64BIT)
+@@ -5946,6 +5946,7 @@ _EGREP_PATTERN="${_EGREP_PATTERN}dummy_n
+ * C++ implementations should define these macros only when __STDC_LIMIT_MACROS
+ * is defined before <stdint.h> is included. */
+ #define __STDC_LIMIT_MACROS
++#define __STDC_CONSTANT_MACROS
+
+ #endif /* _JS_CONFDEFS_H_ */
+
diff --git a/mail/thunderbird-esr/files/patch-mozilla-js-src-methodjit-MethodJIT.cpp b/mail/thunderbird-esr/files/patch-mozilla-js-src-methodjit-MethodJIT.cpp
new file mode 100644
index 000000000000..009b469dcd7f
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-mozilla-js-src-methodjit-MethodJIT.cpp
@@ -0,0 +1,20 @@
+--- mozilla/js/src/methodjit/MethodJIT.cpp~
++++ mozilla/js/src/methodjit/MethodJIT.cpp
+@@ -171,7 +171,7 @@
+
+ JS_STATIC_ASSERT(offsetof(FrameRegs, sp) == 0);
+
+-#if defined(__linux__) && defined(JS_CPU_X64)
++#if defined(__ELF__) && defined(JS_CPU_X64)
+ # define SYMBOL_STRING_RELOC(name) #name "@plt"
+ #else
+ # define SYMBOL_STRING_RELOC(name) SYMBOL_STRING(name)
+@@ -149,7 +149,7 @@
+
+ #if defined(XP_MACOSX)
+ # define HIDE_SYMBOL(name) ".private_extern _" #name
+-#elif defined(__linux__)
++#elif defined(__ELF__)
+ # define HIDE_SYMBOL(name) ".hidden" #name
+ #else
+ # define HIDE_SYMBOL(name)
diff --git a/mail/thunderbird-esr/files/patch-mozilla-media-libsydneyaudio-include-sydney_audio.h b/mail/thunderbird-esr/files/patch-mozilla-media-libsydneyaudio-include-sydney_audio.h
deleted file mode 100644
index e2c52f080518..000000000000
--- a/mail/thunderbird-esr/files/patch-mozilla-media-libsydneyaudio-include-sydney_audio.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- mozilla/media/libsydneyaudio/include/sydney_audio.h.orgi 2009-04-10 12:24:01.000000000 +0200
-+++ mozilla/media/libsydneyaudio/include/sydney_audio.h 2009-04-10 12:24:30.000000000 +0200
-@@ -73,7 +73,7 @@
- # endif
- #elif defined(WIN32)
- # define SA_LITTLE_ENDIAN 1
--#elif defined(__APPLE__)
-+#elif defined(__APPLE__) || defined(__FreeBSD__)
- # if defined(__BIG_ENDIAN__)
- # define SA_BIG_ENDIAN 1
- # else
diff --git a/mail/thunderbird-esr/files/patch-mozilla-media-libsydneyaudio-src-sydney_audio_oss.c b/mail/thunderbird-esr/files/patch-mozilla-media-libsydneyaudio-src-sydney_audio_oss.c
new file mode 100644
index 000000000000..ddb42a92a1e3
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-mozilla-media-libsydneyaudio-src-sydney_audio_oss.c
@@ -0,0 +1,13 @@
+--- mozilla/media/libsydneyaudio/src/sydney_audio_oss.c~
++++ mozilla/media/libsydneyaudio/src/sydney_audio_oss.c
+@@ -446,6 +446,10 @@ static void audio_callback(void* data)
+ printf("!"); /* not enough audio data */
+ #endif
+ bytes = bytes-bytes_to_copy;
++ struct timespec ts = {0, 1000000};
++ pthread_mutex_unlock(&s->mutex);
++ nanosleep(&ts, NULL);
++ pthread_mutex_lock(&s->mutex);
+ break;
+ }
+ free(s->bl_head);
diff --git a/mail/thunderbird-esr/files/patch-mozilla-memory-mozalloc-mozalloc.cpp b/mail/thunderbird-esr/files/patch-mozilla-memory-mozalloc-mozalloc.cpp
new file mode 100644
index 000000000000..2a792aba9aa0
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-mozilla-memory-mozalloc-mozalloc.cpp
@@ -0,0 +1,21 @@
+--- mozilla/memory/mozalloc/mozalloc.cpp~
++++ mozilla/memory/mozalloc/mozalloc.cpp
+@@ -52,6 +52,9 @@
+ #if defined(XP_UNIX)
+ # include <unistd.h> // for valloc on *BSD
+ #endif //if defined(XP_UNIX)
++#ifdef __FreeBSD__
++# include <malloc_np.h> // for malloc_usable_size
++#endif
+
+ #if defined(MOZ_MEMORY)
+ // jemalloc.h doesn't redeclare symbols if they're provided by the OS
+@@ -259,7 +262,7 @@ moz_malloc_usable_size(void *ptr)
+
+ #if defined(XP_MACOSX)
+ return malloc_size(ptr);
+-#elif defined(MOZ_MEMORY)
++#elif defined(MOZ_MEMORY) || defined(__FreeBSD__)
+ return malloc_usable_size(ptr);
+ #elif defined(XP_WIN)
+ return _msize(ptr);
diff --git a/mail/thunderbird-esr/files/patch-mozilla-security-coreconf-FreeBSD.mk b/mail/thunderbird-esr/files/patch-mozilla-security-coreconf-FreeBSD.mk
index dc4e96c7c439..f5a47988bcc5 100644
--- a/mail/thunderbird-esr/files/patch-mozilla-security-coreconf-FreeBSD.mk
+++ b/mail/thunderbird-esr/files/patch-mozilla-security-coreconf-FreeBSD.mk
@@ -1,6 +1,6 @@
--- mozilla/security/coreconf/FreeBSD.mk.orig 2010-02-28 23:30:04.000000000 +0000
+++ mozilla/security/coreconf/FreeBSD.mk 2010-03-03 02:05:22.000000000 +0000
-@@ -49,8 +49,20 @@
+@@ -49,8 +49,24 @@
ifeq ($(CPU_ARCH),pc98)
CPU_ARCH = x86
endif
@@ -9,12 +9,16 @@
+ifeq ($(OS_TEST),alpha)
+CPU_ARCH = alpha
+endif
-+ifeq ($(OS_TEST),amd64)
-+CPU_ARCH = amd64
++ifeq ($(OS_TEST),x86_64)
++CPU_ARCH = x86_64
+endif
+ifeq ($(OS_TEST),ia64)
+CPU_ARCH = ia64
+endif
++ifeq ($(OS_TEST),powerpc64)
++CPU_ARCH = powerpc
++USE_64 = 1
++endif
+ifeq ($(OS_TEST),powerpc)
+CPU_ARCH = powerpc
+endif
@@ -32,9 +36,11 @@
ifdef MAPFILE
MKSHLIB += -Wl,--version-script,$(MAPFILE)
endif
-@@ -87,4 +99,4 @@
+@@ -87,4 +99,6 @@
G++INCLUDES = -I/usr/include/g++
-INCLUDES += -I/usr/X11R6/include
-+#INCLUDES += -I/usr/local/include
++USE_SYSTEM_ZLIB = 1
++ZLIB_LIBS = -lz
++INCLUDES += -I$(LOCALBASE)/include
diff --git a/mail/thunderbird-esr/files/patch-mozilla-security-nss-lib-Makefile b/mail/thunderbird-esr/files/patch-mozilla-security-nss-lib-Makefile
new file mode 100644
index 000000000000..195e44014456
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-mozilla-security-nss-lib-Makefile
@@ -0,0 +1,11 @@
+--- mozilla/security/nss/lib/Makefile~
++++ mozilla/security/nss/lib/Makefile
+@@ -63,7 +63,7 @@ ZLIB_SRCDIR = zlib # Add the zlib direc
+ endif
+
+ ifndef MOZILLA_CLIENT
+-ifndef NSS_USE_SYSTEM_SQLITE
++ifndef MOZ_NATIVE_SQLITE
+ SQLITE_SRCDIR = sqlite # Add the sqlite directory to DIRS.
+ endif
+ endif
diff --git a/mail/thunderbird-esr/files/patch-mozilla-toolkit-library-Makefile.in b/mail/thunderbird-esr/files/patch-mozilla-toolkit-library-Makefile.in
deleted file mode 100644
index f222b6dca9e9..000000000000
--- a/mail/thunderbird-esr/files/patch-mozilla-toolkit-library-Makefile.in
+++ /dev/null
@@ -1,12 +0,0 @@
---- mozilla/toolkit/library/Makefile.in.orig 2010-01-11 12:13:08.000000000 -0500
-+++ mozilla/toolkit/library/Makefile.in 2010-01-11 12:15:05.000000000 -0500
-@@ -181,7 +181,7 @@
- export:: $(RDF_UTIL_SRC_CPPSRCS) $(INTL_UNICHARUTIL_UTIL_CPPSRCS)
- $(INSTALL) $^ .
-
--EXTRA_DSO_LDOPTS += $(LIBS_DIR) $(EXTRA_DSO_LIBS)
-+EXTRA_DSO_LDOPTS += $(LIBS_DIR) $(EXTRA_DSO_LIBS) -lexecinfo %%PTHREAD_LIBS%%
-
- ifdef MOZ_ENABLE_LIBXUL
- include $(srcdir)/libxul-rules.mk
-
diff --git a/mail/thunderbird-esr/files/patch-mozilla-toolkit-xre-nsAppRunner.cpp b/mail/thunderbird-esr/files/patch-mozilla-toolkit-xre-nsAppRunner.cpp
new file mode 100644
index 000000000000..64e61b4ccfa7
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-mozilla-toolkit-xre-nsAppRunner.cpp
@@ -0,0 +1,11 @@
+--- mozilla/toolkit/xre/nsAppRunner.cpp~
++++ mozilla/toolkit/xre/nsAppRunner.cpp
+@@ -2998,7 +2998,7 @@ XRE_main(int argc, char* argv[], const n
+ gQtOnlyArgv[gQtOnlyArgc] = nsnull;
+ #endif
+ #if defined(MOZ_WIDGET_GTK2)
+-#ifdef MOZ_MEMORY
++#if defined(MOZ_MEMORY) || defined(__FreeBSD__)
+ // Disable the slice allocator, since jemalloc already uses similar layout
+ // algorithms, and using a sub-allocator tends to increase fragmentation.
+ // This must be done before g_thread_init() is called.
diff --git a/mail/thunderbird-esr/files/patch-mozilla-widget-src-qt-nsNativeThemeQt.cpp b/mail/thunderbird-esr/files/patch-mozilla-widget-src-qt-nsNativeThemeQt.cpp
new file mode 100644
index 000000000000..bbd5fb825595
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-mozilla-widget-src-qt-nsNativeThemeQt.cpp
@@ -0,0 +1,12 @@
+--- mozilla/widget/src/qt/nsNativeThemeQt.cpp~
++++ mozilla/widget/src/qt/nsNativeThemeQt.cpp
+@@ -25,7 +25,9 @@
+ #include "nsThemeConstants.h"
+ #include "nsIServiceManager.h"
+ #include "nsIDOMHTMLInputElement.h"
++#ifdef __GLIBC__
+ #include <malloc.h>
++#endif
+
+
+ #include "gfxASurface.h"
diff --git a/mail/thunderbird-esr/files/patch-mozilla-widget-src-qt-nsSound.cpp b/mail/thunderbird-esr/files/patch-mozilla-widget-src-qt-nsSound.cpp
new file mode 100644
index 000000000000..d8b82936a718
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-mozilla-widget-src-qt-nsSound.cpp
@@ -0,0 +1,10 @@
+--- mozilla/widget/src/qt/nsSound.cpp~
++++ mozilla/widget/src/qt/nsSound.cpp
+@@ -40,6 +40,7 @@
+ #include <QSound>
+
+ #include <string.h>
++#include <unistd.h>
+
+ #include "nscore.h"
+ #include "plstr.h"
diff --git a/mail/thunderbird-esr/files/patch-mozilla-widget-src-qt-nsWindow.cpp b/mail/thunderbird-esr/files/patch-mozilla-widget-src-qt-nsWindow.cpp
new file mode 100644
index 000000000000..aa6817839692
--- /dev/null
+++ b/mail/thunderbird-esr/files/patch-mozilla-widget-src-qt-nsWindow.cpp
@@ -0,0 +1,10 @@
+--- mozilla/widget/src/qt/nsWindow.cpp~
++++ mozilla/widget/src/qt/nsWindow.cpp
+@@ -43,6 +43,7 @@ using namespace QtMobility;
+
+ #ifdef MOZ_X11
+ #include <X11/Xlib.h>
++#include "mozilla/X11Util.h"
+ #endif //MOZ_X11
+
+ #include "nsXULAppAPI.h"
diff --git a/mail/thunderbird-esr/files/patch-mozilla-xpcom-base-nsStackWalk.cpp b/mail/thunderbird-esr/files/patch-mozilla-xpcom-base-nsStackWalk.cpp
index 4d2bca2ca692..817014333627 100644
--- a/mail/thunderbird-esr/files/patch-mozilla-xpcom-base-nsStackWalk.cpp
+++ b/mail/thunderbird-esr/files/patch-mozilla-xpcom-base-nsStackWalk.cpp
@@ -8,3 +8,11 @@
#if defined(_WIN32) && (defined(_M_IX86) || defined(_M_AMD64) || defined(_M_IA64)) && !defined(WINCE) // WIN32 x86 stack walking code
+@@ -1123,6 +1123,7 @@ NS_StackWalk(NS_WalkStackCallback aCallb
+
+ #elif defined(HAVE__UNWIND_BACKTRACE)
+
++#define _GNU_SOURCE
+ // libgcc_s.so symbols _Unwind_Backtrace@@GCC_3.3 and _Unwind_GetIP@@GCC_3.0
+ #include <unwind.h>
+
diff --git a/mail/thunderbird-esr/files/patch-mozilla-xpcom-reflect-xptcall-src-md-unix-Makefile.in b/mail/thunderbird-esr/files/patch-mozilla-xpcom-reflect-xptcall-src-md-unix-Makefile.in
index e896cec90613..252912459191 100644
--- a/mail/thunderbird-esr/files/patch-mozilla-xpcom-reflect-xptcall-src-md-unix-Makefile.in
+++ b/mail/thunderbird-esr/files/patch-mozilla-xpcom-reflect-xptcall-src-md-unix-Makefile.in
@@ -1,16 +1,6 @@
---- mozilla/xpcom/reflect/xptcall/src/md/unix/Makefile.in.orig 2011-05-28 15:26:21.000000000 +0200
-+++ mozilla/xpcom/reflect/xptcall/src/md/unix/Makefile.in 2011-06-03 18:39:42.769434047 +0200
-@@ -74,6 +74,9 @@
- # NOTE: MODULE_OPTIMIZE_FLAGS must be set before including config.mk
- MODULE_OPTIMIZE_FLAGS=-O3
- endif
-+ifeq (x86_64,$(OS_TEST))
-+CPPSRCS := xptcinvoke_x86_64_linux.cpp xptcstubs_x86_64_linux.cpp
-+endif
- endif
- endif
-
-@@ -117,7 +120,7 @@
+--- mozilla/xpcom/reflect/xptcall/src/md/unix/Makefile.in.orig 2011-04-26 23:22:05.000000000 +0200
++++ mozilla/xpcom/reflect/xptcall/src/md/unix/Makefile.in 2011-04-26 23:48:09.637442986 +0200
+@@ -70,7 +70,7 @@
endif
endif
# IA64 Linux
@@ -19,36 +9,6 @@
ifneq (,$(findstring ia64,$(OS_TEST)))
CPPSRCS := xptcinvoke_ipf64.cpp xptcstubs_ipf64.cpp
ASFILES := xptcstubs_asm_ipf64.s xptcinvoke_asm_ipf64.s
-@@ -129,6 +132,12 @@
- ifeq ($(OS_ARCH)$(OS_TEST),OpenBSDx86_64)
- CPPSRCS := xptcinvoke_amd64_openbsd.cpp xptcstubs_amd64_openbsd.cpp
- endif
-+# FreeBSD/amd64
-+#
-+ifeq ($(OS_ARCH)$(OS_TEST),FreeBSDamd64)
-+CPPSRCS := xptcinvoke_amd64_openbsd.cpp xptcstubs_amd64_openbsd.cpp
-+endif
-+#
- #
- # Neutrino/Intel (uses the same unixish_x86 code)
- #
-@@ -184,9 +193,15 @@
- ASFILES := xptcinvoke_asm_osf1_alpha.s xptcstubs_asm_osf1_alpha.s
- endif
- #
-+# FreeBSD/Alpha
-+#
-+ifeq ($(OS_ARCH)$(OS_TEST),FreeBSDalpha)
-+CPPSRCS := xptcinvoke_freebsd_alpha.cpp xptcstubs_freebsd_alpha.cpp
-+endif
-+#
- # Linux/Alpha
- #
--ifneq (,$(filter Linuxalpha FreeBSDalpha NetBSDalpha,$(OS_ARCH)$(OS_TEST)))
-+ifneq (,$(filter Linuxalpha NetBSDalpha,$(OS_ARCH)$(OS_TEST)))
- CPPSRCS := xptcinvoke_linux_alpha.cpp xptcstubs_linux_alpha.cpp
- endif
- #
@@ -341,7 +356,7 @@
#
# Linux/PPC
@@ -58,19 +18,21 @@
CPPSRCS := xptcinvoke_ppc_linux.cpp xptcstubs_ppc_linux.cpp
ASFILES := xptcinvoke_asm_ppc_linux.s xptcstubs_asm_ppc_linux.s
AS := $(CC) -c -x assembler-with-cpp
-@@ -419,6 +434,15 @@
- ASFILES := xptcinvoke_asm_sparc_netbsd.s xptcstubs_asm_sparc_netbsd.s
- endif
+@@ -350,7 +365,7 @@
#
-+# FreeBSD/SPARC64
-+#
-+ifeq ($(OS_ARCH),FreeBSD)
-+ifneq (,$(findstring sparc,$(OS_TEST)))
-+CPPSRCS := xptcinvoke_sparc64_openbsd.cpp xptcstubs_sparc64_openbsd.cpp
-+ASFILES := xptcinvoke_asm_sparc64_openbsd.s xptcstubs_asm_sparc64_openbsd.s
-+endif
-+endif
-+#
- # OpenBSD/SPARC
+ # Linux/PPC64
#
- ifeq ($(OS_ARCH)$(OS_TEST),OpenBSDsparc)
+-ifeq ($(OS_ARCH)$(OS_TEST),Linuxpowerpc64)
++ifneq (,$(filter Linuxpowerpc64 FreeBSDpowerpc64,$(OS_ARCH)$(OS_TEST)))
+ CPPSRCS := xptcinvoke_ppc64_linux.cpp xptcstubs_ppc64_linux.cpp
+ ASFILES := xptcinvoke_asm_ppc64_linux.s xptcstubs_asm_ppc64_linux.s
+ AS := $(CC) -c -x assembler-with-cpp
+@@ -350,7 +350,7 @@
+ #
+ # OpenBSD/SPARC64
+ #
+-ifeq ($(OS_ARCH)$(OS_TEST),OpenBSDsparc64)
++ifneq (,$(filter OpenBSDsparc64 FreeBSDsparc64,$(OS_ARCH)$(OS_TEST)))
+ CPPSRCS := xptcinvoke_sparc64_openbsd.cpp xptcstubs_sparc64_openbsd.cpp
+ ASFILES := xptcinvoke_asm_sparc64_openbsd.s xptcstubs_asm_sparc64_openbsd.s
+ endif