summaryrefslogtreecommitdiff
path: root/mail/thunderbird
diff options
context:
space:
mode:
authortnn <tnn@pkgsrc.org>2010-03-16 10:59:09 +0000
committertnn <tnn@pkgsrc.org>2010-03-16 10:59:09 +0000
commit17f177763039c0a8cca075920481b1fd6175c1bb (patch)
treed4494d4fe261b2bfd3909daf05ea86175c71c737 /mail/thunderbird
parent096d8b1dbcbe2d78f27656f465b349c547d9be0a (diff)
downloadpkgsrc-17f177763039c0a8cca075920481b1fd6175c1bb.tar.gz
clone comm-1.9.1 patch set from devel/xulrunner into mail/thunderbird and
www/seamonkey so devel/xulrunner can move forward to 1.9.2.
Diffstat (limited to 'mail/thunderbird')
-rw-r--r--mail/thunderbird/Makefile17
-rw-r--r--mail/thunderbird/distinfo67
-rw-r--r--mail/thunderbird/patches/patch-aa67
-rw-r--r--mail/thunderbird/patches/patch-ab26
-rw-r--r--mail/thunderbird/patches/patch-ac83
-rw-r--r--mail/thunderbird/patches/patch-ad13
-rw-r--r--mail/thunderbird/patches/patch-ae43
-rw-r--r--mail/thunderbird/patches/patch-af32
-rw-r--r--mail/thunderbird/patches/patch-ag31
-rw-r--r--mail/thunderbird/patches/patch-ah18
-rw-r--r--mail/thunderbird/patches/patch-ai13
-rw-r--r--mail/thunderbird/patches/patch-aj20
-rw-r--r--mail/thunderbird/patches/patch-ak19
-rw-r--r--mail/thunderbird/patches/patch-al27
-rw-r--r--mail/thunderbird/patches/patch-am17
-rw-r--r--mail/thunderbird/patches/patch-an48
-rw-r--r--mail/thunderbird/patches/patch-ao24
-rw-r--r--mail/thunderbird/patches/patch-ap13
-rw-r--r--mail/thunderbird/patches/patch-aq16
-rw-r--r--mail/thunderbird/patches/patch-ar39
-rw-r--r--mail/thunderbird/patches/patch-as33
-rw-r--r--mail/thunderbird/patches/patch-at25
-rw-r--r--mail/thunderbird/patches/patch-au26
-rw-r--r--mail/thunderbird/patches/patch-av40
-rw-r--r--mail/thunderbird/patches/patch-aw40
-rw-r--r--mail/thunderbird/patches/patch-ax13
-rw-r--r--mail/thunderbird/patches/patch-ay40
-rw-r--r--mail/thunderbird/patches/patch-az19
-rw-r--r--mail/thunderbird/patches/patch-ba24
-rw-r--r--mail/thunderbird/patches/patch-bb19
-rw-r--r--mail/thunderbird/patches/patch-ma23
-rw-r--r--mail/thunderbird/patches/patch-mb72
-rw-r--r--mail/thunderbird/patches/patch-md17
-rw-r--r--mail/thunderbird/patches/patch-me15
-rw-r--r--mail/thunderbird/patches/patch-mf21
-rw-r--r--mail/thunderbird/patches/patch-mg90
-rw-r--r--mail/thunderbird/patches/patch-mi15
-rw-r--r--mail/thunderbird/patches/patch-mj15
-rw-r--r--mail/thunderbird/patches/patch-mk19
-rw-r--r--mail/thunderbird/patches/patch-ml16
-rw-r--r--mail/thunderbird/patches/patch-mm23
-rw-r--r--mail/thunderbird/patches/patch-mn15
-rw-r--r--mail/thunderbird/patches/patch-mp29
-rw-r--r--mail/thunderbird/patches/patch-na122
-rw-r--r--mail/thunderbird/patches/patch-nd37
-rw-r--r--mail/thunderbird/patches/patch-pa12
-rw-r--r--mail/thunderbird/patches/patch-pb11
-rw-r--r--mail/thunderbird/patches/patch-pc11
-rw-r--r--mail/thunderbird/patches/patch-pd11
-rw-r--r--mail/thunderbird/patches/patch-pe11
-rw-r--r--mail/thunderbird/patches/patch-pf11
-rw-r--r--mail/thunderbird/patches/patch-pg14
-rw-r--r--mail/thunderbird/patches/patch-ra9
-rw-r--r--mail/thunderbird/patches/patch-rc12
-rw-r--r--mail/thunderbird/patches/patch-xa119
-rw-r--r--mail/thunderbird/patches/patch-xb91
-rw-r--r--mail/thunderbird/patches/patch-xc73
-rw-r--r--mail/thunderbird/patches/patch-xd126
-rw-r--r--mail/thunderbird/patches/patch-xe77
-rw-r--r--mail/thunderbird/patches/patch-xf43
-rw-r--r--mail/thunderbird/patches/patch-xg33
-rw-r--r--mail/thunderbird/patches/patch-xh181
-rw-r--r--mail/thunderbird/patches/patch-xi213
-rw-r--r--mail/thunderbird/patches/patch-xj129
-rw-r--r--mail/thunderbird/patches/patch-xk156
-rw-r--r--mail/thunderbird/patches/patch-xl200
-rw-r--r--mail/thunderbird/patches/patch-xm49
67 files changed, 3017 insertions, 16 deletions
diff --git a/mail/thunderbird/Makefile b/mail/thunderbird/Makefile
index 252d9193832..43f3bcb6e2b 100644
--- a/mail/thunderbird/Makefile
+++ b/mail/thunderbird/Makefile
@@ -1,9 +1,10 @@
-# $NetBSD: Makefile,v 1.49 2010/03/03 13:54:47 tnn Exp $
+# $NetBSD: Makefile,v 1.50 2010/03/16 10:59:09 tnn Exp $
#
DISTNAME= thunderbird-${TB_VER}.source
PKGNAME= thunderbird-${TB_VER}
TB_VER= 3.0.2
+PKGREVISION= 1
CATEGORIES= mail
MASTER_SITES= ${MASTER_SITE_MOZILLA:=thunderbird/releases/${TB_VER}/source/}
EXTRACT_SUFX= .tar.bz2
@@ -23,14 +24,6 @@ CONFIGURE_ARGS+= --enable-static
ALL_ENV+= MOZILLA_PKG_NAME=thunderbird
-MOZILLA_PATCHES= ${.CURDIR}/../../devel/xulrunner/patches/patch-*
-pre-patch:
- @${STEP_MSG} "Applying common mozilla patches from devel/xulrunner"
-.for i in ${MOZILLA_PATCHES}
- ${RUN} ${CAT} ${i} | ${PATCH} -s -p0 -d ${WRKSRC}/${MOZILLA_DIR} || \
- { ${ERROR_MSG} "Patch ${i} failed"; ${_PKGSRC_PATCH_FAIL}; }
-.endfor
-
pre-configure:
cd ${WRKSRC}/directory/c-sdk && ${SETENV} ${CONFIGURE_ENV} autoconf
cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} autoconf
@@ -59,12 +52,6 @@ post-install:
${INSTALL_DATA} ${WRKSRC}/mail/branding/nightly/mailicon48.png \
${DESTDIR}${PREFIX}/share/pixmaps/${MOZILLA}.png
-SUBST_CLASSES+= fix-sqlite-dep
-SUBST_STAGE.fix-sqlite-dep= pre-configure
-SUBST_MESSAGE.fix-sqlite-dep= Fixing sqlite dependency
-SUBST_FILES.fix-sqlite-dep= ${MOZILLA_DIR}/configure.in configure.in
-SUBST_SED.fix-sqlite-dep= -e 's,\(SQLITE_VERSION\)=[.0-9]*,\1=3.6.21,g'
-
.include "../../devel/xulrunner/mozilla-common.mk"
.include "options.mk"
.include "../../sysutils/desktop-file-utils/desktopdb.mk"
diff --git a/mail/thunderbird/distinfo b/mail/thunderbird/distinfo
index b4cd07e8784..3c4a040cd0c 100644
--- a/mail/thunderbird/distinfo
+++ b/mail/thunderbird/distinfo
@@ -1,9 +1,74 @@
-$NetBSD: distinfo,v 1.63 2010/02/26 18:38:39 tnn Exp $
+$NetBSD: distinfo,v 1.64 2010/03/16 10:59:09 tnn Exp $
SHA1 (thunderbird-3.0.2.source.tar.bz2) = a498193239ac6fe0986670128bda9770f83bbb29
RMD160 (thunderbird-3.0.2.source.tar.bz2) = 2c86849a7dfa0ad2c2fde02c21e2bb179dcb3b91
Size (thunderbird-3.0.2.source.tar.bz2) = 59947226 bytes
+SHA1 (patch-aa) = 0d46562e73fce3fc1bf590ac93a28b2202a8e214
SHA1 (patch-aa-toplevel) = 458051a1b3318b49124192c6e97cb9ed0d92dead
+SHA1 (patch-ab) = c7a6961362b131f0a39f65355562b115fae3be85
+SHA1 (patch-ac) = e181323e153ee061b7f3644b599294a4c4a3e3e8
+SHA1 (patch-ad) = f49147e2fa28400986b659ec50918e3835db0105
+SHA1 (patch-ae) = cf4cb737fc29ef7ac6ffe1b3bc504743441e4828
+SHA1 (patch-af) = 16cae98e043dedeb6331212fd15ce914196fe8c7
+SHA1 (patch-ag) = 7f8c3ac1bec475dd2b6fd6e10e5304ab9c112a67
+SHA1 (patch-ah) = 10c80ec60801295b037b4a45fbad8937922da235
+SHA1 (patch-ai) = 4d701ece9a2aaa0b640c189745fa7e731617fb7c
+SHA1 (patch-aj) = 89d390f7eeeb52256265955610b3cad4b62c5aa7
+SHA1 (patch-ak) = dca377e3cb733a48c3aa071a74bba8d2535ee161
+SHA1 (patch-al) = 893eb0c096f61b52a6299eff1e5ab520014fbda4
+SHA1 (patch-am) = 81bcda476a7b54050ed1ae87bd47cf9de8f19919
+SHA1 (patch-an) = e30362e1a07c6c8e96dc81d134517685c3f19ca9
+SHA1 (patch-ao) = 6307d82a2eb65131908b0d4d05da7433b6cf38d1
+SHA1 (patch-ap) = 78d9944ba37b3d90d0ab9e91fc831949e54ef2ad
+SHA1 (patch-aq) = ac5cd0e83f0c166fae6b033ad960d7820bb7add6
+SHA1 (patch-ar) = dab688f86340bccb80db5531f4e36cb8f50254e4
+SHA1 (patch-as) = 7e283a79231909ab5fb60740b5e36c8c0744e025
+SHA1 (patch-at) = 569a874251a1920fa916d448c108910348cd75dc
+SHA1 (patch-au) = d381e6c0d6a791c2d72754f847df0e2210265fd8
+SHA1 (patch-av) = 2cb2e3d5b94f7b83117eb752d4410638daa6ae73
+SHA1 (patch-aw) = 55d2769dfb6d0c65bd2072c1a7c82cfef0fd5404
+SHA1 (patch-ax) = 1dbdcd2e9a791a686fd42452ccf486d14cdf2a57
+SHA1 (patch-ay) = 5aaeb992cab024fb2b6035ddee239a8534b23aee
+SHA1 (patch-az) = 0e04c1c740ad3f1462a6cda4a3832378acefb600
+SHA1 (patch-ba) = fd28f3b24848e7221078ef692eef7ccae8625987
+SHA1 (patch-bb) = 70d1d1fed2f611fa0185ca5736dae26c8cbc2f12
+SHA1 (patch-ma) = 9b9bc5e5ced5831aa14e1549ed2ddf0b9c2ce986
SHA1 (patch-ma-toplevel) = 460326a0551fecd13ca188cff907c89cce359c31
+SHA1 (patch-mb) = 8bdd47c4e57ae63c971766286ce8626d3341c92e
+SHA1 (patch-md) = 932c2b0237c9690da06533f0abfeabddf32d8f3e
+SHA1 (patch-me) = 66c15af6d7b07a4fec7ecd06cb9c9278b35a123e
+SHA1 (patch-mf) = bc693a247f306f414f54bf515eeb8f36841a46b8
+SHA1 (patch-mg) = f33a92539ebe171b7bbbd83a54ad9ac2fdca249a
+SHA1 (patch-mi) = c49e917409c0542e69f57fe5571a16b6c2e4aa9a
+SHA1 (patch-mj) = 9b28802eb665a7a77e879ec44e9da52e2e79ec8b
+SHA1 (patch-mk) = 3c25934e0c7b9277d96a5635b961e1fb6682ab7b
+SHA1 (patch-ml) = ef7d87fff48f298f4c1ed037439eaf8c7c574f68
+SHA1 (patch-mm) = 04d9105ab0fb520690b58230e90bf6217b439df7
+SHA1 (patch-mn) = beb92ccc59f909f0d4f5f5bb62ad834b55fc94ce
+SHA1 (patch-mp) = 3da5e645d4e0c704ad8147c33f66bb13ec7c1bc6
+SHA1 (patch-na) = b7c0feed9546ca1168c696bf7ea6bbc8ea4564c4
+SHA1 (patch-nd) = 007b8d1310990253e86dab579397b02ced42cb71
+SHA1 (patch-pa) = ee713ec24b453aaf3f1964e8100b26ecae3bf6a4
+SHA1 (patch-pb) = fede79d8fec147b4f79edbdf571474365a6dba25
+SHA1 (patch-pc) = 5a74b0476c0be0bf4e0c22fbe78b6dbe63beae08
+SHA1 (patch-pd) = b2e18e7b09123576d07ae052b2f2599217d6f3ce
+SHA1 (patch-pe) = 218275a25df933ed548395f4338a5cb2f045d4a6
+SHA1 (patch-pf) = 88c39f735087fa285f3f75bfdaa6dc571da67eb9
+SHA1 (patch-pg) = 5268f7e7b22f89f55db44537c32bf5ac73630168
+SHA1 (patch-ra) = 70d5130250a4ac6825112e64006b233f4b802e9c
+SHA1 (patch-rc) = 7e6a38bd3eabe500bcf3c47be7f4bd5768f24c39
+SHA1 (patch-xa) = 0acaf27d8687c7cb5a46fc3773097a3dea4c75d9
+SHA1 (patch-xb) = 07a90e393dbb38a98e8d9954387757d21d3e65cf
+SHA1 (patch-xc) = 98c8b4193dde73f28747c8ac870071f1debbe9f0
+SHA1 (patch-xd) = 927a73f9ba1f516a10e83dbe5f00744acc6a88df
+SHA1 (patch-xe) = 945bce0dc7347392b992b9698597d8584557d51e
+SHA1 (patch-xf) = 34d671d4e615a694e3add3303eaae5e23c7df3ac
+SHA1 (patch-xg) = 4fdf27307cfb3bf3cb33440da75704b149fc2aaa
+SHA1 (patch-xh) = a5a2923069d5819e979a445d0ea35cde74699bd7
+SHA1 (patch-xi) = db8359452da08413ac6672010f2f05766571464c
+SHA1 (patch-xj) = 452d87313b29510fb02e804545c17193e2c822bf
+SHA1 (patch-xk) = b50b34041b75b1590f021592b1e26893ae458a01
+SHA1 (patch-xl) = 1425f9e5fd0dc49f3204730d1d88b9600d6475e4
+SHA1 (patch-xm) = 270e762936fe686cc55b820d52e15421b27c7c2c
SHA1 (patch-zb) = a8f2ad6cc50302537d8fc5fe7d543da2b808cd28
SHA1 (patch-zc) = 0b06b5c77ea4eb4a6b845eaeb4ec82a96d5cc4c3
diff --git a/mail/thunderbird/patches/patch-aa b/mail/thunderbird/patches/patch-aa
new file mode 100644
index 00000000000..e3504e04dc8
--- /dev/null
+++ b/mail/thunderbird/patches/patch-aa
@@ -0,0 +1,67 @@
+$NetBSD: patch-aa,v 1.6 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/configure.in.orig 2009-10-16 17:13:35.000000000 +0200
++++ mozilla/configure.in
+@@ -1799,7 +1799,7 @@ case "$target" in
+ fi
+ ;;
+
+-*-freebsd*)
++*-freebsd* | *-dragonfly*)
+ if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
+ DLL_SUFFIX=".so.1.0"
+ DSO_LDOPTS="-shared"
+@@ -1813,6 +1813,9 @@ case "$target" in
+ # MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
+ # MKSHLIB_UNFORCE_ALL=''
+ # fi
++ if test "$LIBRUNPATH"; then
++ DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
++ fi
+ ;;
+
+ *-hpux*)
+@@ -3043,6 +3046,9 @@ dnl ====================================
+ case $target in
+ *-hpux11.*)
+ ;;
++*-dragonfly*)
++ AC_CHECK_LIB(c, gethostbyname_r)
++ ;;
+ *)
+ AC_CHECK_LIB(c_r, gethostbyname_r)
+ ;;
+@@ -4158,6 +4164,14 @@ else
+ fi
+ fi
+
++if test -n "${LIBXUL_SDK_DIR}"; then
++ AC_MSG_WARN([pkgsrc: LIBXUL_SDK_DIR is set; assuming we want nss and nspr from xulrunner.])
++ NSPR_CFLAGS="-I${prefix}/include/xulrunner/unstable `pkg-config --cflags mozilla-nspr`"
++ NSPR_LIBS="`pkg-config --libs mozilla-nspr`"
++ NSS_CFLAGS="`pkg-config --cflags mozilla-nss`"
++ NSS_LIBS="`pkg-config --libs mozilla-nss`"
++fi
++
+ if test -z "$SKIP_LIBRARY_CHECKS"; then
+ dnl system JPEG support
+ dnl ========================================================
+@@ -8375,7 +8389,8 @@ rm -f confdefs.h.save
+ mv confdefs.h confdefs.h.save
+ egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
+ AC_OUTPUT_MAKE_DEFS()
+-MOZ_DEFINES=$DEFS
++# nbsed broken. PR bin/42261
++MOZ_DEFINES="$DEFS`awk 'BEGIN {while(x<1000){printf " ";x++}}'`"
+ AC_SUBST(MOZ_DEFINES)
+ rm -f confdefs.h
+ mv confdefs.h.save confdefs.h
+@@ -8466,6 +8481,8 @@ if test -z "$MOZ_NATIVE_NSPR"; then
+ AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
+ if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
+ NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
++ AC_MSG_WARN([pkgsrc: adding run path to NSPR_LIBS for bundled NSPR.])
++ NSPR_LIBS="-Wl,-R${prefix}/lib/\${MOZILLA_PKG_NAME} ${NSPR_LIBS}"
+ $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
+ NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
+ $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
diff --git a/mail/thunderbird/patches/patch-ab b/mail/thunderbird/patches/patch-ab
new file mode 100644
index 00000000000..bdacd7bc415
--- /dev/null
+++ b/mail/thunderbird/patches/patch-ab
@@ -0,0 +1,26 @@
+$NetBSD: patch-ab,v 1.13 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/nsprpub/pr/include/md/_netbsd.h.orig 2009-06-29 18:15:06.000000000 +0200
++++ mozilla/nsprpub/pr/include/md/_netbsd.h
+@@ -94,6 +94,12 @@
+ #define _PR_INET6_PROBE
+ #endif
+
++#if __NetBSD_Version__ >= 106370000
++/* NetBSD 1.6ZK */
++#define _PR_HAVE_GETPROTO_R
++#define _PR_HAVE_GETPROTO_R_INT
++#endif
++
+ #define USE_SETJMP
+
+ #ifndef _PR_PTHREADS
+@@ -107,6 +113,8 @@
+ #define JB_SP_INDEX 2
+ #elif defined(__mips__)
+ #define JB_SP_INDEX 4
++#elif defined(__amd64__)
++#define JB_SP_INDEX 6
+ #elif defined(__alpha__)
+ #define JB_SP_INDEX 34
+ #elif defined(__arm32__)
diff --git a/mail/thunderbird/patches/patch-ac b/mail/thunderbird/patches/patch-ac
new file mode 100644
index 00000000000..7ca6c21c6e1
--- /dev/null
+++ b/mail/thunderbird/patches/patch-ac
@@ -0,0 +1,83 @@
+$NetBSD: patch-ac,v 1.10 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/nsprpub/configure.in.orig 2009-06-29 18:15:05.000000000 +0200
++++ mozilla/nsprpub/configure.in
+@@ -71,7 +71,7 @@ OBJDIR_NAME=.
+ OBJDIR_SUFFIX=OBJ
+ NSINSTALL='$(MOD_DEPTH)/config/$(OBJDIR_NAME)/nsinstall'
+ NOSUCHFILE=/no-such-file
+-LIBNSPR='-L$(dist_libdir) -lnspr$(MOD_MAJOR_VERSION)'
++LIBNSPR='-Wl,-R${prefix}/lib/${MOZILLA_PKG_NAME} -L$(dist_libdir) -lnspr$(MOD_MAJOR_VERSION)'
+ LIBPLC='-L$(dist_libdir) -lplc$(MOD_MAJOR_VERSION)'
+ CYGWIN_WRAPPER=
+ MACOS_SDK_DIR=
+@@ -1160,6 +1160,34 @@ tools are selected during the Xcode/Deve
+ DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
+ MDCPUCFG_H=_freebsd.cfg
+ PR_MD_CSRCS=freebsd.c
++ if test "$LIBRUNPATH"; then
++ DSO_LDOPTS="$DSO_LDOPTS -Wl,-R$LIBRUNPATH"
++ fi
++ ;;
++
++*-dragonfly*)
++ if test -z "$USE_NSPR_THREADS"; then
++ USE_PTHREADS=1
++ fi
++ AC_DEFINE(XP_UNIX)
++ AC_DEFINE(FREEBSD)
++ AC_DEFINE(HAVE_BSD_FLOCK)
++ AC_DEFINE(HAVE_SOCKLEN_T)
++ CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
++ MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
++ if test "$MOZ_OBJFORMAT" = "elf"; then
++ DLL_SUFFIX=so
++ else
++ DLL_SUFFIX=so.1.0
++ fi
++ MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
++ DSO_CFLAGS=-fPIC
++ DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
++ MDCPUCFG_H=_freebsd.cfg
++ PR_MD_CSRCS=freebsd.c
++ if test "$LIBRUNPATH"; then
++ DSO_LDOPTS="$DSO_LDOPTS -Wl,-R$LIBRUNPATH"
++ fi
+ ;;
+
+ *-hpux*)
+@@ -1731,6 +1759,7 @@ mips-nec-sysv*)
+ AC_DEFINE(XP_UNIX)
+ AC_DEFINE(NETBSD)
+ AC_DEFINE(HAVE_BSD_FLOCK)
++ AC_DEFINE(HAVE_SOCKLEN_T)
+ if test -z "$USE_NSPR_THREADS"; then
+ USE_PTHREADS=1
+ fi
+@@ -2511,7 +2540,7 @@ if test -n "$USE_PTHREADS"; then
+ if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
+ ac_cv_have_dash_pthread=yes
+ case "$target_os" in
+- freebsd*)
++ freebsd* | dragonfly*)
+ # Freebsd doesn't use -pthread for compiles, it uses them for linking
+ ;;
+ *)
+@@ -2549,7 +2578,7 @@ if test -n "$USE_PTHREADS"; then
+ _PTHREAD_LDFLAGS=
+ fi
+ ;;
+- *-freebsd*)
++ *-freebsd* | *-dragonfly*)
+ AC_DEFINE(_REENTRANT)
+ AC_DEFINE(_THREAD_SAFE)
+ dnl -pthread links in -lc_r, so don't specify it explicitly.
+@@ -2630,7 +2659,7 @@ case "$target" in
+ AC_DEFINE(_PR_NEED_PTHREAD_INIT)
+ fi
+ ;;
+-*-freebsd*)
++*-freebsd* | *-dragonfly*)
+ if test -n "$USE_NSPR_THREADS"; then
+ AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
+ fi
diff --git a/mail/thunderbird/patches/patch-ad b/mail/thunderbird/patches/patch-ad
new file mode 100644
index 00000000000..d70dd958502
--- /dev/null
+++ b/mail/thunderbird/patches/patch-ad
@@ -0,0 +1,13 @@
+$NetBSD: patch-ad,v 1.5 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/xpcom/io/nsLocalFileUnix.h.orig 2009-06-29 18:15:32.000000000 +0200
++++ mozilla/xpcom/io/nsLocalFileUnix.h
+@@ -75,7 +75,7 @@
+ #endif
+
+ // so we can statfs on freebsd
+-#if defined(__FreeBSD__)
++#if defined(__FreeBSD__) || ((defined(__DragonFly__) || defined(__NetBSD__)) && !defined(HAVE_STATVFS))
+ #define HAVE_SYS_STATFS_H
+ #define STATFS statfs
+ #include <sys/param.h>
diff --git a/mail/thunderbird/patches/patch-ae b/mail/thunderbird/patches/patch-ae
new file mode 100644
index 00000000000..64f69b82d76
--- /dev/null
+++ b/mail/thunderbird/patches/patch-ae
@@ -0,0 +1,43 @@
+$NetBSD: patch-ae,v 1.5 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/nsprpub/pr/src/misc/prnetdb.c.orig 2009-06-29 18:15:07.000000000 +0200
++++ mozilla/nsprpub/pr/src/misc/prnetdb.c
+@@ -114,6 +114,11 @@ PRLock *_pr_dnsLock = NULL;
+ #define _PR_HAVE_5_ARG_GETPROTO_R
+ #endif
+
++#if __DragonFly_version >= 200202
++#define _PR_HAVE_GETPROTO_R
++#define _PR_HAVE_5_ARG_GETPROTO_R
++#endif
++
+ /* BeOS has glibc but not the glibc-style getprotobyxxx_r functions. */
+ #if (defined(__GLIBC__) && __GLIBC__ >= 2 && !defined(XP_BEOS))
+ #define _PR_HAVE_GETPROTO_R
+@@ -331,7 +336,7 @@ _pr_QueryNetIfs(void)
+ }
+
+ #elif (defined(DARWIN) && defined(HAVE_GETIFADDRS)) || defined(FREEBSD) \
+- || defined(NETBSD) || defined(OPENBSD)
++ || defined(NETBSD) || defined(OPENBSD) || defined(DRAGONFLY)
+
+ /*
+ * Use the BSD getifaddrs function.
+@@ -2039,7 +2044,17 @@ PR_IMPLEMENT(PRAddrInfo *) PR_GetAddrInf
+ */
+ hints.ai_socktype = SOCK_STREAM;
+
++/* NetBSD >= 2.99.9 has a thread-safe resolver */
++#if defined(__NetBSD_Version__) && __NetBSD_Version__ < 299000900
++ LOCK_DNS();
++#endif
++
+ rv = GETADDRINFO(hostname, NULL, &hints, &res);
++
++#if defined(__NetBSD_Version__) && __NetBSD_Version__ < 299000900
++ UNLOCK_DNS();
++#endif
++
+ if (rv == 0)
+ return (PRAddrInfo *) res;
+
diff --git a/mail/thunderbird/patches/patch-af b/mail/thunderbird/patches/patch-af
new file mode 100644
index 00000000000..498248b890a
--- /dev/null
+++ b/mail/thunderbird/patches/patch-af
@@ -0,0 +1,32 @@
+$NetBSD: patch-af,v 1.7 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/config/mkdepend/imakemdep.h.orig 2009-06-29 18:14:41.000000000 +0200
++++ mozilla/config/mkdepend/imakemdep.h
+@@ -235,7 +235,7 @@ in this Software without prior written a
+ #ifdef _CRAY
+ #define DEFAULT_CPP "/lib/pcpp"
+ #endif
+-#if defined(__386BSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
++#if defined(__386BSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+ #define DEFAULT_CPP "/usr/libexec/cpp"
+ #endif
+ #ifdef MACH
+@@ -273,7 +273,7 @@ char *cpp_argv[ARGUMENTS] = {
+ #ifdef unix
+ "-Uunix", /* remove unix symbol so that filename unix.c okay */
+ #endif
+-#if defined(__386BSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(MACH)
++#if defined(__386BSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(MACH) || defined(__DragonFly__)
+ # ifdef __i386__
+ "-D__i386__",
+ # endif
+@@ -713,6 +713,9 @@ struct symtab predefs[] = {
+ #ifdef __sgi
+ {"__sgi", "1"},
+ #endif
++#ifdef __DragonFly__
++ {"__DragonFly__", "1"},
++#endif
+ #ifdef __FreeBSD__
+ {"__FreeBSD__", "1"},
+ #endif
diff --git a/mail/thunderbird/patches/patch-ag b/mail/thunderbird/patches/patch-ag
new file mode 100644
index 00000000000..329b05efbb2
--- /dev/null
+++ b/mail/thunderbird/patches/patch-ag
@@ -0,0 +1,31 @@
+$NetBSD: patch-ag,v 1.6 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/nsprpub/pr/include/md/_freebsd.h.orig 2009-06-29 18:15:06.000000000 +0200
++++ mozilla/nsprpub/pr/include/md/_freebsd.h
+@@ -79,7 +79,7 @@
+ #define _PR_NO_LARGE_FILES
+
+ #if defined(_PR_PTHREADS)
+-#if __FreeBSD_version >= 400008
++#if defined(__DragonFly__) || __FreeBSD_version >= 400008
+ /*
+ * libc_r before this version of FreeBSD doesn't have poll().
+ * Although libc has poll(), it is not thread-safe so we can't
+@@ -88,7 +88,7 @@
+ #define _PR_POLL_AVAILABLE
+ #endif
+ #else
+-#if __FreeBSD_version >= 300000
++#if defined(__DragonFly__) || __FreeBSD_version >= 300000
+ #define _PR_POLL_AVAILABLE
+ #define _PR_USE_POLL
+ #endif
+@@ -97,7 +97,7 @@
+ #define _PR_HAVE_SYSV_SEMAPHORES
+ #define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
+
+-#if __FreeBSD_version >= 400014
++#if defined(__DragonFly__) || __FreeBSD_version >= 400014
+ #define _PR_INET6
+ #define _PR_HAVE_INET_NTOP
+ #define _PR_HAVE_GETHOSTBYNAME2
diff --git a/mail/thunderbird/patches/patch-ah b/mail/thunderbird/patches/patch-ah
new file mode 100644
index 00000000000..71acbfe611c
--- /dev/null
+++ b/mail/thunderbird/patches/patch-ah
@@ -0,0 +1,18 @@
+$NetBSD: patch-ah,v 1.4 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/xpcom/reflect/xptcall/src/md/unix/xptc_platforms_unixish_x86.h.orig 2009-06-29 18:15:33.000000000 +0200
++++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptc_platforms_unixish_x86.h
+@@ -77,6 +77,13 @@
+ #define THUNK_BASED_THIS_ADJUST
+ #endif
+
++#elif defined(__DragonFly__)
++# if defined(__FreeBSD_cc_version)
++# define CFRONT_STYLE_THIS_ADJUST
++# else
++# define THUNK_BASED_THIS_ADJUST
++# endif
++
+ #elif defined(__FreeBSD__)
+ /* System versions of gcc on FreeBSD don't use thunks. On 3.x, the system
+ * compiler is gcc 2.7.2.3, which doesn't use thunks by default. On 4.x and
diff --git a/mail/thunderbird/patches/patch-ai b/mail/thunderbird/patches/patch-ai
new file mode 100644
index 00000000000..927b2e2e1c5
--- /dev/null
+++ b/mail/thunderbird/patches/patch-ai
@@ -0,0 +1,13 @@
+$NetBSD: patch-ai,v 1.6 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/dbm/src/mktemp.c.orig 2009-06-29 18:14:43.000000000 +0200
++++ mozilla/dbm/src/mktemp.c
+@@ -90,7 +90,7 @@ mktemp(char *path)
+ static int
+ _gettemp(char *path, register int *doopen, int extraFlags)
+ {
+-#if !defined(_WINDOWS) || defined(_WIN32)
++#if (!defined(_WINDOWS) || defined(_WIN32)) && !defined(errno)
+ extern int errno;
+ #endif
+ register char *start, *trv;
diff --git a/mail/thunderbird/patches/patch-aj b/mail/thunderbird/patches/patch-aj
new file mode 100644
index 00000000000..54d39bf792c
--- /dev/null
+++ b/mail/thunderbird/patches/patch-aj
@@ -0,0 +1,20 @@
+$NetBSD: patch-aj,v 1.5 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/profile/dirserviceprovider/src/nsProfileLock.cpp.orig 2009-06-29 18:15:11.000000000 +0200
++++ mozilla/profile/dirserviceprovider/src/nsProfileLock.cpp
+@@ -391,6 +391,7 @@ nsresult nsProfileLock::LockWithSymlink(
+ act.sa_flags = 0;
+ sigfillset(&act.sa_mask);
+
++#ifndef DEBUG
+ #define CATCH_SIGNAL(signame) \
+ PR_BEGIN_MACRO \
+ if (sigaction(signame, NULL, &oldact) == 0 && \
+@@ -409,6 +410,7 @@ PR_BEGIN_MACRO
+ CATCH_SIGNAL(SIGTERM);
+
+ #undef CATCH_SIGNAL
++#endif
+ }
+ }
+ }
diff --git a/mail/thunderbird/patches/patch-ak b/mail/thunderbird/patches/patch-ak
new file mode 100644
index 00000000000..11657ca57a1
--- /dev/null
+++ b/mail/thunderbird/patches/patch-ak
@@ -0,0 +1,19 @@
+$NetBSD: patch-ak,v 1.4 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/toolkit/components/places/src/nsMorkHistoryImporter.cpp.orig 2009-06-29 18:15:22.000000000 +0200
++++ mozilla/toolkit/components/places/src/nsMorkHistoryImporter.cpp
+@@ -148,9 +148,12 @@ AddToHistoryCB(const nsCSubstring &aRowI
+ }
+
+ PRTime date;
+- if (PR_sscanf(values[kLastVisitColumn].get(), "%lld", &date) != 1) {
++ long long ld;
++ if (PR_sscanf(values[kLastVisitColumn].get(), "%lld", &ld) != 1) {
+ date = -1;
+- }
++ } else {
++ date = ld;
++ }
+
+ PRBool isTyped = values[kTypedColumn].EqualsLiteral("1");
+ PRInt32 transition = isTyped ?
diff --git a/mail/thunderbird/patches/patch-al b/mail/thunderbird/patches/patch-al
new file mode 100644
index 00000000000..789e386bcd6
--- /dev/null
+++ b/mail/thunderbird/patches/patch-al
@@ -0,0 +1,27 @@
+$NetBSD: patch-al,v 1.5 2010/03/16 10:59:09 tnn Exp $
+
+# Reported upstream as https://bugzilla.mozilla.org/show_bug.cgi?id=471179
+
+--- mozilla/nsprpub/pr/src/misc/prsystem.c.orig 2009-06-29 18:15:07.000000000 +0200
++++ mozilla/nsprpub/pr/src/misc/prsystem.c
+@@ -284,6 +284,20 @@ PR_IMPLEMENT(PRUint64) PR_GetPhysicalMem
+ long pageCount = sysconf(_SC_PHYS_PAGES);
+ bytes = (PRUint64) pageSize * pageCount;
+
++#elif defined(NETBSD)
++
++ int mib[2];
++ int rc;
++ uint64_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 ) {
++ bytes = memSize;
++ }
++
+ #elif defined(HPUX)
+
+ struct pst_static info;
diff --git a/mail/thunderbird/patches/patch-am b/mail/thunderbird/patches/patch-am
new file mode 100644
index 00000000000..217cda21905
--- /dev/null
+++ b/mail/thunderbird/patches/patch-am
@@ -0,0 +1,17 @@
+$NetBSD: patch-am,v 1.3 2010/03/16 10:59:09 tnn Exp $
+
+SHA1_Update conflicts with openssl which may be dynamically loaded
+at runtime via libcups or libgssapi so causing a crash due to using
+the wrong binding. So rename here to avoid conflict.
+
+--- mozilla/security/nss/lib/freebl/blapi.h.orig 2009-06-29 18:15:13.000000000 +0200
++++ mozilla/security/nss/lib/freebl/blapi.h
+@@ -925,6 +925,8 @@ extern void SHA1_DestroyContext(SHA1Cont
+ */
+ extern void SHA1_Begin(SHA1Context *cx);
+
++#define SHA1_Update NSS_SHA1_Update
++
+ /*
+ ** Update the SHA-1 hash function with more data.
+ ** "cx" the context
diff --git a/mail/thunderbird/patches/patch-an b/mail/thunderbird/patches/patch-an
new file mode 100644
index 00000000000..7489b4b6c98
--- /dev/null
+++ b/mail/thunderbird/patches/patch-an
@@ -0,0 +1,48 @@
+$NetBSD: patch-an,v 1.4 2010/03/16 10:59:09 tnn Exp $
+
+SHA1_Update conflicts with openssl which may be dynamically loaded
+at runtime via libcups or libgssapi so causing a crash due to using
+the wrong binding. So rename here to avoid conflict.
+
+--- mozilla/security/nss/lib/freebl/sha-fast-amd64-sun.s.orig 2009-06-29 18:15:14.000000000 +0200
++++ mozilla/security/nss/lib/freebl/sha-fast-amd64-sun.s
+@@ -1712,9 +1712,9 @@ shaCompress:
+ .LFE7:
+ .size shaCompress, .-shaCompress
+ .align 16
+-.globl SHA1_Update
+- .type SHA1_Update, @function
+-SHA1_Update:
++.globl NSS_SHA1_Update
++ .type NSS_SHA1_Update, @function
++NSS_SHA1_Update:
+ .LFB5:
+ pushq %rbp
+ .LCFI5:
+@@ -1800,7 +1800,7 @@ SHA1_Update:
+ call shaCompress
+ jmp .L245
+ .LFE5:
+- .size SHA1_Update, .-SHA1_Update
++ .size NSS_SHA1_Update, .-NSS_SHA1_Update
+ .section .rodata
+ .align 32
+ .type bulk_pad.0, @object
+@@ -1902,7 +1902,7 @@ SHA1_End:
+ subl %r8d, %edx
+ andl $63, %edx
+ incl %edx
+- call SHA1_Update@PLT
++ call NSS_SHA1_Update@PLT
+ movq %rbx, %rdi
+ movq %r12, %rsi
+ shrq $32, %rdi
+@@ -2018,7 +2018,7 @@ SHA1_HashBuf:
+ movl %r12d, %edx
+ movq %r13, %rsi
+ movq %rbx, %rdi
+- call SHA1_Update@PLT
++ call NSS_SHA1_Update@PLT
+ leaq -292(%rbp), %rdx
+ movq %r14, %rsi
+ movq %rbx, %rdi
diff --git a/mail/thunderbird/patches/patch-ao b/mail/thunderbird/patches/patch-ao
new file mode 100644
index 00000000000..d942824fa9d
--- /dev/null
+++ b/mail/thunderbird/patches/patch-ao
@@ -0,0 +1,24 @@
+$NetBSD: patch-ao,v 1.4 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/toolkit/mozapps/installer/packager.mk.orig 2009-06-29 18:15:27.000000000 +0200
++++ mozilla/toolkit/mozapps/installer/packager.mk
+@@ -449,8 +449,8 @@ endif
+ (cd $(DIST)/$(MOZ_PKG_DIR) && tar $(TAR_CREATE_FLAGS) - .) | \
+ (cd $(DESTDIR)$(installdir) && tar -xf -)
+ $(NSINSTALL) -D $(DESTDIR)$(bindir)
+- $(RM) -f $(DESTDIR)$(bindir)/$(MOZ_APP_NAME)
+- ln -s $(installdir)/$(MOZ_APP_NAME) $(DESTDIR)$(bindir)
++ $(RM) -f $(DESTDIR)$(bindir)/$(MOZILLA_PKG_NAME)
++ ln -s $(installdir)/$(MOZ_APP_NAME) $(DESTDIR)$(bindir)/$(MOZILLA_PKG_NAME)
+ ifdef INSTALL_SDK # Here comes the hard part
+ # include directory is stable (dist/sdk/include) and unstable (dist/include)
+ $(NSINSTALL) -D $(DESTDIR)$(includedir)/stable
+@@ -458,7 +458,7 @@ ifdef INSTALL_SDK # Here comes the hard
+ (cd $(DIST)/sdk/include && tar $(TAR_CREATE_FLAGS) - .) | \
+ (cd $(DESTDIR)$(includedir)/stable && tar -xf -)
+ # The dist/include has module subdirectories that we need to flatten
+- find $(DIST)/include -xtype f -exec $(SYSINSTALL) $(IFLAGS1) {} $(DESTDIR)$(includedir)/unstable \;
++ find $(DIST)/include -type f -exec $(SYSINSTALL) $(IFLAGS1) {} $(DESTDIR)$(includedir)/unstable \;
+ # IDL directory is stable (dist/sdk/idl) and unstable (dist/idl)
+ $(NSINSTALL) -D $(DESTDIR)$(idldir)/stable
+ $(NSINSTALL) -D $(DESTDIR)$(idldir)/unstable
diff --git a/mail/thunderbird/patches/patch-ap b/mail/thunderbird/patches/patch-ap
new file mode 100644
index 00000000000..cddeea77fa8
--- /dev/null
+++ b/mail/thunderbird/patches/patch-ap
@@ -0,0 +1,13 @@
+$NetBSD: patch-ap,v 1.7 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/media/liboggz/include/oggz/oggz_off_t_generated.h.orig 2009-08-24 17:52:50.000000000 +0200
++++ mozilla/media/liboggz/include/oggz/oggz_off_t_generated.h
+@@ -59,7 +59,7 @@
+
+ #include <sys/types.h>
+
+-#if defined(__APPLE__) || defined(SOLARIS) || defined(OS2)
++#if defined(__APPLE__) || defined(SOLARIS) || defined(OS2) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__FreeBSD__)
+ typedef off_t oggz_off_t;
+ #else
+ typedef loff_t oggz_off_t;
diff --git a/mail/thunderbird/patches/patch-aq b/mail/thunderbird/patches/patch-aq
new file mode 100644
index 00000000000..974310ae543
--- /dev/null
+++ b/mail/thunderbird/patches/patch-aq
@@ -0,0 +1,16 @@
+$NetBSD: patch-aq,v 1.5 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/media/liboggplay/src/liboggplay/std_semaphore.h.orig 2009-10-16 17:14:09.000000000 +0200
++++ mozilla/media/liboggplay/src/liboggplay/std_semaphore.h
+@@ -74,9 +74,9 @@
+ * @retval non-zero on error
+ */
+
+-#if defined(linux) || defined(SOLARIS) || defined(AIX) || defined(__FreeBSD__)
++#if defined(linux) || defined(SOLARIS) || defined(AIX) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
+ #include <semaphore.h>
+-#if defined(__FreeBSD__)
++#if defined(__FreeBSD__) || defined(__NetBSD__)
+ #define SEM_CREATE(p,s) sem_init(&(p), 0, s)
+ #else
+ #define SEM_CREATE(p,s) sem_init(&(p), 1, s)
diff --git a/mail/thunderbird/patches/patch-ar b/mail/thunderbird/patches/patch-ar
new file mode 100644
index 00000000000..2867b87e903
--- /dev/null
+++ b/mail/thunderbird/patches/patch-ar
@@ -0,0 +1,39 @@
+$NetBSD: patch-ar,v 1.3 2010/03/16 10:59:09 tnn Exp $
+
+Enable the sunaudio module to build on NetBSD.
+
+--- mozilla/media/libsydneyaudio/src/sydney_audio_sunaudio.c.orig 2009-06-29 18:15:03.000000000 +0200
++++ mozilla/media/libsydneyaudio/src/sydney_audio_sunaudio.c
+@@ -38,9 +38,14 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
++#if defined(__NetBSD__)
++#include <sys/ioctl.h>
++#include <sys/audioio.h>
++#else
+ #include <stropts.h>
+ #include <sys/audio.h>
+ #include <sys/mixer.h>
++#endif
+ #include <errno.h>
+ #include <stdio.h>
+ #include <pthread.h>
+@@ -197,7 +202,7 @@ sa_stream_open(sa_stream_t *s)
+ s->default_rate = audio_info.play.sample_rate;
+ s->default_precision = audio_info.play.precision;
+
+- AUDIO_INITINFO(&audio_info)
++ AUDIO_INITINFO(&audio_info);
+
+ audio_info.play.sample_rate = s->rate;
+ audio_info.play.channels = s->n_channels;
+@@ -210,7 +215,7 @@ sa_stream_open(sa_stream_t *s)
+ if (err== -1)
+ return SA_ERROR_NOT_SUPPORTED;
+
+- AUDIO_INITINFO(&audio_info)
++ AUDIO_INITINFO(&audio_info);
+ err=ioctl(fd,AUDIO_GETINFO,&audio_info);
+ if (err== -1)
+ {
diff --git a/mail/thunderbird/patches/patch-as b/mail/thunderbird/patches/patch-as
new file mode 100644
index 00000000000..ac3a6e8af8e
--- /dev/null
+++ b/mail/thunderbird/patches/patch-as
@@ -0,0 +1,33 @@
+$NetBSD: patch-as,v 1.5 2010/03/16 10:59:09 tnn Exp $
+
+Treat DragonFly like FreeBSD.
+
+--- mozilla/js/src/configure.in.orig 2009-06-29 18:14:51.000000000 +0200
++++ mozilla/js/src/configure.in
+@@ -1693,7 +1693,7 @@ case "$target" in
+ fi
+ ;;
+
+-*-freebsd*)
++*-freebsd*|*-dragonfly*)
+ if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
+ DLL_SUFFIX=".so.1.0"
+ DSO_LDOPTS="-shared"
+@@ -2504,7 +2504,7 @@ darwin*)
+ solaris*)
+ AC_DEFINE(AVMPLUS_UNIX)
+ ;;
+-freebsd*|kfreebsd*)
++freebsd*|kfreebsd*|netbsd*|dragonfly*)
+ AC_DEFINE(AVMPLUS_UNIX)
+ ;;
+ *cygwin*|*mingw*|*mks*|*msvc*|*wince)
+@@ -4185,7 +4185,7 @@ if test "$MOZ_MEMORY"; then
+ darwin*)
+ AC_DEFINE(MOZ_MEMORY_DARWIN)
+ ;;
+- *freebsd*)
++ *freebsd*|dragonfly*)
+ AC_DEFINE(MOZ_MEMORY_BSD)
+ ;;
+ *linux*)
diff --git a/mail/thunderbird/patches/patch-at b/mail/thunderbird/patches/patch-at
new file mode 100644
index 00000000000..e0b2738bd2d
--- /dev/null
+++ b/mail/thunderbird/patches/patch-at
@@ -0,0 +1,25 @@
+$NetBSD: patch-at,v 1.3 2010/03/16 10:59:09 tnn Exp $
+
+Treat DragonFly like FreeBSD.
+Avoid silly redefinitions of standard types on NetBSD.
+
+--- mozilla/gfx/qcms/qcmstypes.h.orig 2009-08-24 17:52:41.000000000 +0200
++++ mozilla/gfx/qcms/qcmstypes.h
+@@ -10,6 +10,8 @@
+ #if defined (__SVR4) && defined (__sun)
+ /* int_types.h gets included somehow, so avoid redefining the types differently */
+ #include <sys/int_types.h>
++#elif defined(__NetBSD__)
++#include <stdint.h>
+ #else
+ typedef PRInt8 int8_t;
+ typedef PRUint8 uint8_t;
+@@ -23,7 +25,7 @@ typedef PRUint64 uint64_t;
+ #ifdef __OS2__
+ /* OS/2's stdlib typdefs uintptr_t. So we'll just include that so we don't collide */
+ #include <stdlib.h>
+-#elif defined(__FreeBSD__)
++#elif defined(__FreeBSD__) || defined(__DragonFly__)
+ /* FreeBSD typedefs uintptr_t in /usr/include/sys/types.h */
+ #else
+ typedef PRUptrdiff uintptr_t;
diff --git a/mail/thunderbird/patches/patch-au b/mail/thunderbird/patches/patch-au
new file mode 100644
index 00000000000..27ccf5372fc
--- /dev/null
+++ b/mail/thunderbird/patches/patch-au
@@ -0,0 +1,26 @@
+$NetBSD: patch-au,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+SOUND_VERSION just isn't a reliable way to detect features supported by
+particular OSS implementation.
+
+--- mozilla/media/libsydneyaudio/src/sydney_audio_oss.c.orig 2009-06-29 18:15:03.000000000 +0200
++++ mozilla/media/libsydneyaudio/src/sydney_audio_oss.c
+@@ -51,9 +51,9 @@
+ // support only versions newer than 3.6.1
+ #define SUPP_OSS_VERSION OSS_VERSION(3,6,1)
+
+-#if (SOUND_VERSION < SUPP_OSS_VERSION)
+-#error Unsupported OSS Version
+-#else
++//#if (SOUND_VERSION < SUPP_OSS_VERSION)
++//#error Unsupported OSS Version
++//#else
+
+ typedef struct sa_buf sa_buf;
+ struct sa_buf {
+@@ -716,4 +716,4 @@ UNSUPPORTED(int sa_stream_drain(sa_strea
+
+ const char *sa_strerror(int code) { return NULL; }
+
+-#endif
++//#endif
diff --git a/mail/thunderbird/patches/patch-av b/mail/thunderbird/patches/patch-av
new file mode 100644
index 00000000000..4223a5f3ce3
--- /dev/null
+++ b/mail/thunderbird/patches/patch-av
@@ -0,0 +1,40 @@
+$NetBSD: patch-av,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/xulrunner/app/nsXULRunnerApp.cpp.orig 2008-03-22 05:25:35.000000000 +0100
++++ mozilla/xulrunner/app/nsXULRunnerApp.cpp
+@@ -37,6 +37,27 @@
+
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <sys/resource.h>
++/*
++ * On netbsd-4, ulimit -n is 64 by default; too few for us.
++ */
++static void netbsd_fixrlimit(void) {
++ struct rlimit rlp;
++ if (getrlimit(RLIMIT_NOFILE, &rlp) == -1) {
++ fprintf(stderr, "warning: getrlimit failed\n");
++ return;
++ }
++ if (rlp.rlim_cur >= 512)
++ return;
++ if (rlp.rlim_max < 512) {
++ fprintf(stderr, "warning: hard limit of 'ulimit -n' too low\n");
++ rlp.rlim_cur = rlp.rlim_max;
++ }
++ else
++ rlp.rlim_cur = 512;
++ if (setrlimit(RLIMIT_NOFILE, &rlp) == -1)
++ fprintf(stderr, "warning: setrlimit failed\n");
++}
+ #ifdef XP_WIN
+ #include <windows.h>
+ #endif
+@@ -283,6 +304,7 @@ private:
+
+ int main(int argc, char* argv[])
+ {
++ netbsd_fixrlimit();
+ if (argc > 1 && (IsArg(argv[1], "h") ||
+ IsArg(argv[1], "help") ||
+ IsArg(argv[1], "?")))
diff --git a/mail/thunderbird/patches/patch-aw b/mail/thunderbird/patches/patch-aw
new file mode 100644
index 00000000000..1303a783e02
--- /dev/null
+++ b/mail/thunderbird/patches/patch-aw
@@ -0,0 +1,40 @@
+$NetBSD: patch-aw,v 1.6 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/xulrunner/stub/nsXULStub.cpp.orig 2009-08-24 17:53:30.000000000 +0200
++++ mozilla/xulrunner/stub/nsXULStub.cpp
+@@ -44,6 +44,27 @@
+ #include "nsILocalFile.h"
+
+ #include <stdarg.h>
++#include <sys/resource.h>
++/*
++ * On netbsd-4, ulimit -n is 64 by default; too few for us.
++ */
++static void netbsd_fixrlimit(void) {
++ struct rlimit rlp;
++ if (getrlimit(RLIMIT_NOFILE, &rlp) == -1) {
++ fprintf(stderr, "warning: getrlimit failed\n");
++ return;
++ }
++ if (rlp.rlim_cur >= 512)
++ return;
++ if (rlp.rlim_max < 512) {
++ fprintf(stderr, "warning: hard limit of 'ulimit -n' too low\n");
++ rlp.rlim_cur = rlp.rlim_max;
++ }
++ else
++ rlp.rlim_cur = 512;
++ if (setrlimit(RLIMIT_NOFILE, &rlp) == -1)
++ fprintf(stderr, "warning: setrlimit failed\n");
++}
+
+ #ifdef XP_WIN
+ #include <windows.h>
+@@ -205,6 +226,7 @@ main(int argc, char **argv)
+ char tmpPath[MAXPATHLEN];
+ char greDir[MAXPATHLEN];
+ PRBool greFound = PR_FALSE;
++ netbsd_fixrlimit();
+
+ #if defined(XP_MACOSX)
+ CFBundleRef appBundle = CFBundleGetMainBundle();
diff --git a/mail/thunderbird/patches/patch-ax b/mail/thunderbird/patches/patch-ax
new file mode 100644
index 00000000000..4598eb8277e
--- /dev/null
+++ b/mail/thunderbird/patches/patch-ax
@@ -0,0 +1,13 @@
+$NetBSD: patch-ax,v 1.6 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/xpcom/base/nsStackWalk.cpp.orig 2009-08-24 17:53:27.000000000 +0200
++++ mozilla/xpcom/base/nsStackWalk.cpp
+@@ -1124,7 +1124,7 @@ NS_FormatCodeAddressDetails(void *aPC, c
+ #define __USE_GNU
+ #endif
+
+-#if defined(HAVE_LIBDL) || defined(XP_MACOSX)
++#if defined(HAVE_LIBDL) || defined(XP_MACOSX) || defined(__NetBSD__)
+ #include <dlfcn.h>
+ #endif
+
diff --git a/mail/thunderbird/patches/patch-ay b/mail/thunderbird/patches/patch-ay
new file mode 100644
index 00000000000..e2cd21d7763
--- /dev/null
+++ b/mail/thunderbird/patches/patch-ay
@@ -0,0 +1,40 @@
+$NetBSD: patch-ay,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/browser/app/nsBrowserApp.cpp.orig 2009-06-29 18:14:40.000000000 +0200
++++ mozilla/browser/app/nsBrowserApp.cpp
+@@ -44,6 +44,27 @@
+
+ #include <stdio.h>
+ #include <stdarg.h>
++#include <sys/resource.h>
++/*
++ * On netbsd-4, ulimit -n is 64 by default; too few for us.
++ */
++static void netbsd_fixrlimit(void) {
++ struct rlimit rlp;
++ if (getrlimit(RLIMIT_NOFILE, &rlp) == -1) {
++ fprintf(stderr, "warning: getrlimit failed\n");
++ return;
++ }
++ if (rlp.rlim_cur >= 512)
++ return;
++ if (rlp.rlim_max < 512) {
++ fprintf(stderr, "warning: hard limit of 'ulimit -n' too low\n");
++ rlp.rlim_cur = rlp.rlim_max;
++ }
++ else
++ rlp.rlim_cur = 512;
++ if (setrlimit(RLIMIT_NOFILE, &rlp) == -1)
++ fprintf(stderr, "warning: setrlimit failed\n");
++}
+
+ #include "plstr.h"
+ #include "prprf.h"
+@@ -106,6 +127,7 @@ public:
+
+ int main(int argc, char* argv[])
+ {
++ netbsd_fixrlimit();
+ ScopedLogging log;
+
+ nsCOMPtr<nsILocalFile> appini;
diff --git a/mail/thunderbird/patches/patch-az b/mail/thunderbird/patches/patch-az
new file mode 100644
index 00000000000..ab8d7eda2dc
--- /dev/null
+++ b/mail/thunderbird/patches/patch-az
@@ -0,0 +1,19 @@
+$NetBSD: patch-az,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/nsprpub/pr/src/pthreads/ptthread.c.orig 2009-11-02 22:43:08.000000000 +0100
++++ mozilla/nsprpub/pr/src/pthreads/ptthread.c
+@@ -1089,12 +1089,12 @@ PR_IMPLEMENT(void) PR_ProcessExit(PRIntn
+ _exit(status);
+ }
+
+-PR_IMPLEMENT(PRUint32) PR_GetThreadID(PRThread *thred)
++PR_IMPLEMENT(pthread_t) PR_GetThreadID(PRThread *thred)
+ {
+ #if defined(_PR_DCETHREADS)
+ return (PRUint32)&thred->id; /* this is really a sham! */
+ #else
+- return (PRUint32)thred->id; /* and I don't know what they will do with it */
++ return thred->id; /* and I don't know what they will do with it */
+ #endif
+ }
+
diff --git a/mail/thunderbird/patches/patch-ba b/mail/thunderbird/patches/patch-ba
new file mode 100644
index 00000000000..64d103f1401
--- /dev/null
+++ b/mail/thunderbird/patches/patch-ba
@@ -0,0 +1,24 @@
+$NetBSD: patch-ba,v 1.8 2010/03/16 10:59:09 tnn Exp $
+
+pthread_t may be 64-bit, avoid casting it.
+
+--- mozilla/nsprpub/pr/include/private/pprthred.h.orig 2009-11-02 22:43:08.000000000 +0100
++++ mozilla/nsprpub/pr/include/private/pprthred.h
+@@ -51,6 +51,8 @@
+ #include <os2.h>
+ #endif
+
++#include <pthread.h>
++
+ PR_BEGIN_EXTERN_C
+
+ /*---------------------------------------------------------------------------
+@@ -91,7 +93,7 @@ NSPR_API(void) PR_DetachThread(void);
+ ** Get the id of the named thread. Each thread is assigned a unique id
+ ** when it is created or attached.
+ */
+-NSPR_API(PRUint32) PR_GetThreadID(PRThread *thread);
++NSPR_API(pthread_t) PR_GetThreadID(PRThread *thread);
+
+ /*
+ ** Set the procedure that is called when a thread is dumped. The procedure
diff --git a/mail/thunderbird/patches/patch-bb b/mail/thunderbird/patches/patch-bb
new file mode 100644
index 00000000000..df6a24b5cc5
--- /dev/null
+++ b/mail/thunderbird/patches/patch-bb
@@ -0,0 +1,19 @@
+$NetBSD: patch-bb,v 1.6 2010/03/16 10:59:09 tnn Exp $
+
+Fix build using Sun Studio C++.
+
+--- mozilla/memory/jemalloc/jemalloc.h.orig 2009-12-02 04:29:06.000000000 +0000
++++ mozilla/memory/jemalloc/jemalloc.h 2010-01-09 23:24:34.000000000 +0000
+@@ -1,3 +1,4 @@
++#ifndef __cplusplus
+ #ifndef MOZ_MEMORY_WINDOWS
+ # include <stdbool.h>
+ #else
+@@ -6,6 +7,7 @@
+ # define bool BOOL
+ # endif
+ #endif
++#endif
+
+ extern const char *_malloc_options;
+
diff --git a/mail/thunderbird/patches/patch-ma b/mail/thunderbird/patches/patch-ma
new file mode 100644
index 00000000000..2cf19d24d49
--- /dev/null
+++ b/mail/thunderbird/patches/patch-ma
@@ -0,0 +1,23 @@
+$NetBSD: patch-ma,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/config/autoconf.mk.in.orig 2009-06-29 18:14:41.000000000 +0200
++++ mozilla/config/autoconf.mk.in
+@@ -57,14 +57,14 @@ MOZ_PKG_SPECIAL = @MOZ_PKG_SPECIAL@
+ prefix = @prefix@
+ exec_prefix = @exec_prefix@
+ bindir = @bindir@
+-includedir = @includedir@/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
++includedir = @includedir@/$(MOZILLA_PKG_NAME)
+ libdir = @libdir@
+ datadir = @datadir@
+ mandir = @mandir@
+-idldir = $(datadir)/idl/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
++idldir = @datadir@/idl/$(MOZILLA_PKG_NAME)
+
+-installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
+-sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION)
++installdir = $(libdir)/$(MOZILLA_PKG_NAME)
++sdkdir = $(libdir)/$(MOZILLA_PKG_NAME)-sdk
+
+ DIST = $(DEPTH)/dist
+ LIBXUL_SDK = @LIBXUL_SDK@
diff --git a/mail/thunderbird/patches/patch-mb b/mail/thunderbird/patches/patch-mb
new file mode 100644
index 00000000000..f10d2d5888f
--- /dev/null
+++ b/mail/thunderbird/patches/patch-mb
@@ -0,0 +1,72 @@
+$NetBSD: patch-mb,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/xpcom/reflect/xptcall/src/md/unix/Makefile.in.orig 2009-06-29 18:15:32.000000000 +0200
++++ mozilla/xpcom/reflect/xptcall/src/md/unix/Makefile.in
+@@ -64,14 +64,21 @@ include $(topsrcdir)/config/config.mk
+ #
+ # Lots of Unixish x86 flavors
+ #
+-ifneq (,$(filter FreeBSD NetBSD OpenBSD BSD_OS Darwin,$(OS_ARCH)))
++ifneq (,$(filter DragonFly FreeBSD NetBSD OpenBSD BSD_OS Darwin,$(OS_ARCH)))
++ifeq (x86_64,$(OS_TEST))
++CPPSRCS := xptcinvoke_x86_64_linux.cpp xptcstubs_x86_64_linux.cpp
++else
+ ifeq (86,$(findstring 86,$(OS_TEST)))
+ CPPSRCS := xptcinvoke_unixish_x86.cpp xptcstubs_unixish_x86.cpp
++endif
++ifeq (amd64,$(OS_TEST))
++CPPSRCS := xptcinvoke_x86_64_linux.cpp xptcstubs_x86_64_linux.cpp
++endif
++endif
+ ifeq (Darwin,$(OS_ARCH))
+ DEFINES += -DKEEP_STACK_16_BYTE_ALIGNED
+ endif
+ endif
+-endif
+ #
+ # New code for Linux, et. al., with gcc
+ # Migrate other platforms here after testing
+@@ -185,7 +192,7 @@ endif
+ # NetBSD/ARM
+ #
+ ifeq ($(OS_ARCH),NetBSD)
+-ifneq (,$(filter arm% sa110,$(OS_TEST)))
++ifneq (,$(filter arm%,$(TARGET_CPU)))
+ CPPSRCS := xptcinvoke_arm_netbsd.cpp xptcstubs_arm_netbsd.cpp
+ endif
+ endif
+@@ -240,7 +247,7 @@ endif
+ # NetBSD/m68k
+ #
+ ifeq ($(OS_ARCH),NetBSD)
+-ifneq (,$(filter amiga atari hp300 mac68k mvme68k next68k sun3 sun3x x68k,$(OS_TEST)))
++ifneq (,$(filter m68k,$(TARGET_CPU)))
+ CPPSRCS := xptcinvoke_netbsd_m68k.cpp xptcstubs_netbsd_m68k.cpp
+ endif
+ endif
+@@ -325,9 +332,10 @@ endif
+ #
+ # NetBSD/PPC
+ #
+-ifneq (,$(filter NetBSDmacppc NetBSDbebox NetBSDofppc NetBSDprep NetBSDamigappc,$(OS_ARCH)$(OS_TEST)))
++ifeq ($(OS_ARCH)$(OS_TEST),NetBSDpowerpc)
+ CPPSRCS := xptcinvoke_ppc_netbsd.cpp xptcstubs_ppc_netbsd.cpp
+ ASFILES := xptcinvoke_asm_ppc_netbsd.s xptcstubs_asm_ppc_netbsd.s
++AS := $(CC) -c -x assembler-with-cpp
+ endif
+
+ #
+@@ -399,6 +407,13 @@ CPPSRCS := xptcinvoke_sparc64_openbsd.c
+ ASFILES := xptcinvoke_asm_sparc64_openbsd.s xptcstubs_asm_sparc64_openbsd.s
+ endif
+ #
++# NetBSD/SPARC64
++#
++ifeq ($(OS_ARCH)$(OS_TEST),NetBSDsparc64)
++CPPSRCS := xptcinvoke_sparc64_netbsd.cpp xptcstubs_sparc64_netbsd.cpp
++ASFILES := xptcinvoke_asm_sparc64_netbsd.s xptcstubs_asm_sparc64_netbsd.s
++endif
++#
+ # Solaris/SPARC
+ #
+ ifeq ($(OS_ARCH),SunOS)
diff --git a/mail/thunderbird/patches/patch-md b/mail/thunderbird/patches/patch-md
new file mode 100644
index 00000000000..e1b38917294
--- /dev/null
+++ b/mail/thunderbird/patches/patch-md
@@ -0,0 +1,17 @@
+$NetBSD: patch-md,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+???. from www/firefox/patch-ax.
+
+--- mozilla/security/coreconf/SunOS5.mk.orig 2009-06-29 18:15:11.000000000 +0200
++++ mozilla/security/coreconf/SunOS5.mk
+@@ -156,6 +156,10 @@ endif
+ endif
+ DSO_LDOPTS += -z combreloc -z defs -z ignore
+
++ifdef LIBRUNPATH
++DSO_LDOPTS += -R$(LIBRUNPATH)
++endif
++
+ # -KPIC generates position independent code for use in shared libraries.
+ # (Similarly for -fPIC in case of gcc.)
+ ifdef NS_USE_GCC
diff --git a/mail/thunderbird/patches/patch-me b/mail/thunderbird/patches/patch-me
new file mode 100644
index 00000000000..ef995791c07
--- /dev/null
+++ b/mail/thunderbird/patches/patch-me
@@ -0,0 +1,15 @@
+$NetBSD: patch-me,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+Add DragonFly support.
+
+--- mozilla/security/nss/lib/freebl/Makefile.orig 2009-06-29 18:15:13.000000000 +0200
++++ mozilla/security/nss/lib/freebl/Makefile
+@@ -212,7 +212,7 @@ endif
+ # to bind the blapi function references in FREEBLVector vector
+ # (ldvector.c) to the blapi functions defined in the freebl
+ # shared libraries.
+-ifeq (,$(filter-out BSD_OS FreeBSD Linux NetBSD OpenBSD, $(OS_TARGET)))
++ifeq (,$(filter-out BSD_OS DragonFly FreeBSD Linux NetBSD OpenBSD, $(OS_TARGET)))
+ MKSHLIB += -Wl,-Bsymbolic
+ endif
+
diff --git a/mail/thunderbird/patches/patch-mf b/mail/thunderbird/patches/patch-mf
new file mode 100644
index 00000000000..bcd234439df
--- /dev/null
+++ b/mail/thunderbird/patches/patch-mf
@@ -0,0 +1,21 @@
+$NetBSD: patch-mf,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+Add DragonFly support.
+Make sure nss libraries have a run path defined.
+
+--- mozilla/security/coreconf/config.mk.orig 2009-10-16 17:14:17.000000000 +0200
++++ mozilla/security/coreconf/config.mk
+@@ -63,7 +63,7 @@ endif
+ #######################################################################
+
+ TARGET_OSES = FreeBSD BSD_OS NetBSD OpenUNIX OS2 QNX Darwin BeOS OpenBSD \
+- AIX RISCOS WINNT WIN95 WINCE
++ AIX RISCOS WINNT WIN95 WINCE DragonFly
+
+ ifeq (,$(filter-out $(TARGET_OSES),$(OS_TARGET)))
+ include $(CORE_DEPTH)/coreconf/$(OS_TARGET).mk
+@@ -212,3 +212,4 @@ endif
+ DEFINES += -DUSE_UTIL_DIRECTLY
+ USE_UTIL_DIRECTLY = 1
+
++EXTRA_SHARED_LIBS += -Wl,-R${PREFIX}/lib/${MOZILLA_PKG_NAME}
diff --git a/mail/thunderbird/patches/patch-mg b/mail/thunderbird/patches/patch-mg
new file mode 100644
index 00000000000..172ceb8cd73
--- /dev/null
+++ b/mail/thunderbird/patches/patch-mg
@@ -0,0 +1,90 @@
+$NetBSD: patch-mg,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+Add DragonFly support.
+
+--- mozilla/security/coreconf/DragonFly.mk.orig 2009-06-30 22:20:24.000000000 +0200
++++ mozilla/security/coreconf/DragonFly.mk
+@@ -0,0 +1,83 @@
++#
++# The contents of this file are subject to the Mozilla Public
++# License Version 1.1 (the "License"); you may not use this file
++# except in compliance with the License. You may obtain a copy of
++# the License at http://www.mozilla.org/MPL/
++#
++# Software distributed under the License is distributed on an "AS
++# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
++# implied. See the License for the specific language governing
++# rights and limitations under the License.
++#
++# The Original Code is the Netscape security libraries.
++#
++# The Initial Developer of the Original Code is Netscape
++# Communications Corporation. Portions created by Netscape are
++# Copyright (C) 1994-2000 Netscape Communications Corporation. All
++# Rights Reserved.
++#
++# Contributor(s):
++#
++# Alternatively, the contents of this file may be used under the
++# terms of the GNU General Public License Version 2 or later (the
++# "GPL"), in which case the provisions of the GPL are applicable
++# instead of those above. If you wish to allow use of your
++# version of this file only under the terms of the GPL and not to
++# allow others to use your version of this file under the MPL,
++# indicate your decision by deleting the provisions above and
++# replace them with the notice and other provisions required by
++# the GPL. If you do not delete the provisions above, a recipient
++# may use your version of this file under either the MPL or the
++# GPL.
++#
++# Config stuff for DragonFly
++#
++
++include $(CORE_DEPTH)/coreconf/UNIX.mk
++
++DEFAULT_COMPILER = gcc
++CC = gcc
++CCC = g++
++RANLIB = ranlib
++
++ifeq ($(OS_TEST),alpha)
++CPU_ARCH = alpha
++else
++CPU_ARCH = x86
++endif
++
++OS_CFLAGS = $(DSO_CFLAGS) -ansi -Wall -DFREEBSD -DHAVE_STRERROR -DHAVE_BSD_FLOCK
++
++DSO_CFLAGS = -fPIC
++DSO_LDOPTS = -shared -Wl,-soname -Wl,$(notdir $@)
++
++#
++# The default implementation strategy for FreeBSD is pthreads.
++#
++ifndef CLASSIC_NSPR
++USE_PTHREADS = 1
++DEFINES += -D_THREAD_SAFE -D_REENTRANT
++OS_LIBS += -pthread
++DSO_LDOPTS += -pthread
++endif
++
++ARCH = freebsd
++
++MOZ_OBJFORMAT := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo aout)
++
++DLL_SUFFIX = so
++
++ifdef LIBRUNPATH
++DSO_LDOPTS += -Wl,-R$(LIBRUNPATH)
++endif
++
++MKSHLIB = $(CC) $(DSO_LDOPTS)
++ifdef MAPFILE
++# Add LD options to restrict exported symbols to those in the map file
++endif
++# Change PROCESS to put the mapfile in the correct format for this platform
++PROCESS_MAP_FILE = cp $(LIBRARY_NAME).def $@
++
++G++INCLUDES = -I/usr/include/g++
++
++INCLUDES += -I/usr/X11R6/include
diff --git a/mail/thunderbird/patches/patch-mi b/mail/thunderbird/patches/patch-mi
new file mode 100644
index 00000000000..e556827414e
--- /dev/null
+++ b/mail/thunderbird/patches/patch-mi
@@ -0,0 +1,15 @@
+$NetBSD: patch-mi,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+Add DragonFly support.
+
+--- mozilla/config/config.mk.orig 2009-06-29 18:14:41.000000000 +0200
++++ mozilla/config/config.mk
+@@ -133,7 +133,7 @@ endif
+ # but save the version to allow multiple versions of the same base
+ # platform to be built in the same tree.
+ #
+-ifneq (,$(filter FreeBSD HP-UX IRIX Linux NetBSD OpenBSD OSF1 SunOS,$(OS_ARCH)))
++ifneq (,$(filter DragonFly FreeBSD HP-UX IRIX Linux NetBSD OpenBSD OSF1 SunOS,$(OS_ARCH)))
+ OS_RELEASE := $(basename $(OS_RELEASE))
+
+ # Allow the user to ignore the OS_VERSION, which is usually irrelevant.
diff --git a/mail/thunderbird/patches/patch-mj b/mail/thunderbird/patches/patch-mj
new file mode 100644
index 00000000000..ba574e4f000
--- /dev/null
+++ b/mail/thunderbird/patches/patch-mj
@@ -0,0 +1,15 @@
+$NetBSD: patch-mj,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+Add DragonFly support.
+
+--- mozilla/security/coreconf/arch.mk.orig 2009-06-29 18:15:11.000000000 +0200
++++ mozilla/security/coreconf/arch.mk
+@@ -146,7 +146,7 @@ endif
+ # IRIX 6.5-ALPHA-1289139620.
+ #
+
+-ifeq (,$(filter-out Linux FreeBSD IRIX,$(OS_ARCH)))
++ifeq (,$(filter-out Linux DragonFly FreeBSD IRIX,$(OS_ARCH)))
+ OS_RELEASE := $(shell echo $(OS_RELEASE) | sed 's/-.*//')
+ endif
+
diff --git a/mail/thunderbird/patches/patch-mk b/mail/thunderbird/patches/patch-mk
new file mode 100644
index 00000000000..fc098b68025
--- /dev/null
+++ b/mail/thunderbird/patches/patch-mk
@@ -0,0 +1,19 @@
+$NetBSD: patch-mk,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+Treat DragonFly like FreeBSD.
+
+--- mozilla/config/rules.mk.orig 2009-06-29 18:14:41.000000000 +0200
++++ mozilla/config/rules.mk
+@@ -592,6 +592,12 @@ EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
+ endif
+ endif
+
++ifeq ($(OS_ARCH),DragonFly)
++ifdef IS_COMPONENT
++EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
++endif
++endif
++
+ ifeq ($(OS_ARCH),NetBSD)
+ ifneq (,$(filter arc cobalt hpcmips mipsco newsmips pmax sgimips,$(OS_TEST)))
+ ifeq ($(MODULE),layout)
diff --git a/mail/thunderbird/patches/patch-ml b/mail/thunderbird/patches/patch-ml
new file mode 100644
index 00000000000..e5278830f35
--- /dev/null
+++ b/mail/thunderbird/patches/patch-ml
@@ -0,0 +1,16 @@
+$NetBSD: patch-ml,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+Treat DragonFly like FreeBSD.
+
+--- mozilla/js/src/Makefile.in.orig 2009-06-29 18:14:51.000000000 +0200
++++ mozilla/js/src/Makefile.in
+@@ -429,6 +429,9 @@ endif # WINNT
+ ifeq ($(OS_ARCH),FreeBSD)
+ EXTRA_LIBS += -pthread
+ endif
++ifeq ($(OS_ARCH),DragonFly)
++EXTRA_LIBS += -pthread
++endif
+ ifeq ($(OS_ARCH),IRIX)
+ ifdef USE_N32
+ DASH_R += -n32
diff --git a/mail/thunderbird/patches/patch-mm b/mail/thunderbird/patches/patch-mm
new file mode 100644
index 00000000000..fb9fa1becfe
--- /dev/null
+++ b/mail/thunderbird/patches/patch-mm
@@ -0,0 +1,23 @@
+$NetBSD: patch-mm,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+Don't link with -lCstd on Solaris when using GCC. From Tim Zingelman.
+part of PR pkg/39085
+
+--- mozilla/toolkit/library/Makefile.in.orig 2009-12-02 05:28:58.000000000 +0100
++++ mozilla/toolkit/library/Makefile.in
+@@ -252,7 +252,14 @@ EXTRA_DSO_LDOPTS += -lbe -ltracker
+ endif
+
+ ifeq ($(OS_ARCH),SunOS)
+-EXTRA_DSO_LDOPTS += -lelf -ldemangle -lCstd
++EXTRA_DSO_LDOPTS += -lelf -ldemangle
++ifndef GNU_CC
++EXTRA_DSO_LDOPTS += -lCstd
++endif
++endif
++
++ifeq ($(OS_ARCH),NetBSD)
++EXTRA_DSO_LDOPTS += -lossaudio
+ endif
+
+ ifeq ($(OS_ARCH),WINNT)
diff --git a/mail/thunderbird/patches/patch-mn b/mail/thunderbird/patches/patch-mn
new file mode 100644
index 00000000000..e5036c39ac9
--- /dev/null
+++ b/mail/thunderbird/patches/patch-mn
@@ -0,0 +1,15 @@
+$NetBSD: patch-mn,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+Make sure we link correctly with sqlite3 from pkgsrc.
+
+--- mozilla/security/nss/lib/softoken/config.mk.orig 2009-10-16 17:14:19.000000000 +0200
++++ mozilla/security/nss/lib/softoken/config.mk
+@@ -83,7 +83,7 @@ EXTRA_SHARED_LIBS += \
+ -L$(DIST)/lib \
+ -L$(NSSUTIL_LIB_DIR) \
+ -lnssutil3 \
+- -lsqlite3 \
++ `pkg-config --libs sqlite3` \
+ -L$(NSPR_LIB_DIR) \
+ -lplc4 \
+ -lplds4 \
diff --git a/mail/thunderbird/patches/patch-mp b/mail/thunderbird/patches/patch-mp
new file mode 100644
index 00000000000..0bc741babfc
--- /dev/null
+++ b/mail/thunderbird/patches/patch-mp
@@ -0,0 +1,29 @@
+$NetBSD: patch-mp,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/media/libsydneyaudio/src/Makefile.in.orig 2009-12-02 05:28:49.000000000 +0100
++++ mozilla/media/libsydneyaudio/src/Makefile.in
+@@ -77,6 +77,24 @@ CSRCS = \
+ $(NULL)
+ endif
+
++ifeq ($(OS_ARCH),DragonFly)
++CSRCS = \
++ sydney_audio_oss.c \
++ $(NULL)
++endif
++
++ifeq ($(OS_ARCH),FreeBSD)
++CSRCS = \
++ sydney_audio_oss.c \
++ $(NULL)
++endif
++
++ifeq ($(OS_ARCH),NetBSD)
++CSRCS = \
++ sydney_audio_oss.c \
++ $(NULL)
++endif
++
+ ifeq ($(OS_ARCH),WINNT)
+ OS_LIBS += winmm.lib
+ endif
diff --git a/mail/thunderbird/patches/patch-na b/mail/thunderbird/patches/patch-na
new file mode 100644
index 00000000000..4b24e5e851b
--- /dev/null
+++ b/mail/thunderbird/patches/patch-na
@@ -0,0 +1,122 @@
+$NetBSD: patch-na,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+# reported upstream as:
+# https://bugzilla.mozilla.org/show_bug.cgi?id=512802
+
+--- mozilla/js/src/jsscript.cpp.orig 2009-08-24 01:32:14.000000000 +0200
++++ mozilla/js/src/jsscript.cpp 2009-08-24 01:36:20.000000000 +0200
+@@ -1370,19 +1370,49 @@ js_NewScript(JSContext *cx, uint32 lengt
+ size_t size, vectorSize;
+ JSScript *script;
+ uint8 *cursor;
++#ifdef _LP64
++#define LP64_ALIGN(V) if ((V) & 7) (V) = (((V)|7) + 1)
++#define LP64_ALIGNP(P) if ((uintptr_t)(P) & 7) (P) = (uint8*)(((uintptr_t)(P)|7) + 1)
++#else
++#define LP64_ALIGN(V)
++#define LP64_ALIGNP(V)
++#endif
+
+- size = sizeof(JSScript) +
+- sizeof(JSAtom *) * natoms +
+- length * sizeof(jsbytecode) +
+- nsrcnotes * sizeof(jssrcnote);
+- if (nobjects != 0)
+- size += sizeof(JSObjectArray) + nobjects * sizeof(JSObject *);
+- if (nupvars != 0)
+- size += sizeof(JSUpvarArray) + nupvars * sizeof(uint32);
+- if (nregexps != 0)
+- size += sizeof(JSObjectArray) + nregexps * sizeof(JSObject *);
+- if (ntrynotes != 0)
+- size += sizeof(JSTryNoteArray) + ntrynotes * sizeof(JSTryNote);
++ size = sizeof(JSScript);
++ if (nobjects != 0) {
++ LP64_ALIGN(size);
++ size += sizeof(JSObjectArray);
++ }
++ if (nupvars != 0) {
++ LP64_ALIGN(size);
++ size += sizeof(JSUpvarArray);
++ }
++ if (nregexps != 0) {
++ LP64_ALIGN(size);
++ size += sizeof(JSObjectArray);
++ }
++ if (ntrynotes != 0) {
++ LP64_ALIGN(size);
++ size += sizeof(JSTryNoteArray);
++ }
++ if (natoms != 0) {
++ LP64_ALIGN(size);
++ size += sizeof(JSAtom *) * natoms;
++ }
++ if (nobjects != 0) {
++ LP64_ALIGN(size);
++ size += nobjects * sizeof(JSObject *);
++ }
++ if (nupvars != 0) {
++ size += nupvars * sizeof(uint32);
++ }
++ if (nregexps != 0) {
++ LP64_ALIGN(size);
++ size += nregexps * sizeof(JSObject *);
++ }
++ size += length * sizeof(jsbytecode) +
++ nsrcnotes * sizeof(jssrcnote) +
++ ntrynotes * sizeof(JSTryNote);
+
+ script = (JSScript *) JS_malloc(cx, size);
+ if (!script)
+@@ -1393,23 +1423,28 @@ js_NewScript(JSContext *cx, uint32 lengt
+
+ cursor = (uint8 *)script + sizeof(JSScript);
+ if (nobjects != 0) {
++ LP64_ALIGNP(cursor);
+ script->objectsOffset = (uint8)(cursor - (uint8 *)script);
+ cursor += sizeof(JSObjectArray);
+ }
+ if (nupvars != 0) {
++ LP64_ALIGNP(cursor);
+ script->upvarsOffset = (uint8)(cursor - (uint8 *)script);
+ cursor += sizeof(JSUpvarArray);
+ }
+ if (nregexps != 0) {
++ LP64_ALIGNP(cursor);
+ script->regexpsOffset = (uint8)(cursor - (uint8 *)script);
+ cursor += sizeof(JSObjectArray);
+ }
+ if (ntrynotes != 0) {
++ LP64_ALIGNP(cursor);
+ script->trynotesOffset = (uint8)(cursor - (uint8 *)script);
+ cursor += sizeof(JSTryNoteArray);
+ }
+
+ if (natoms != 0) {
++ LP64_ALIGNP(cursor);
+ script->atomMap.length = natoms;
+ script->atomMap.vector = (JSAtom **)cursor;
+ vectorSize = natoms * sizeof(script->atomMap.vector[0]);
+@@ -1423,6 +1458,7 @@ js_NewScript(JSContext *cx, uint32 lengt
+ }
+
+ if (nobjects != 0) {
++ LP64_ALIGNP(cursor);
+ JS_SCRIPT_OBJECTS(script)->length = nobjects;
+ JS_SCRIPT_OBJECTS(script)->vector = (JSObject **)cursor;
+ vectorSize = nobjects * sizeof(JS_SCRIPT_OBJECTS(script)->vector[0]);
+@@ -1431,6 +1467,7 @@ js_NewScript(JSContext *cx, uint32 lengt
+ }
+
+ if (nupvars != 0) {
++ LP64_ALIGNP(cursor);
+ JS_SCRIPT_UPVARS(script)->length = nupvars;
+ JS_SCRIPT_UPVARS(script)->vector = (uint32 *)cursor;
+ vectorSize = nupvars * sizeof(JS_SCRIPT_UPVARS(script)->vector[0]);
+@@ -1439,6 +1476,7 @@ js_NewScript(JSContext *cx, uint32 lengt
+ }
+
+ if (nregexps != 0) {
++ LP64_ALIGNP(cursor);
+ JS_SCRIPT_REGEXPS(script)->length = nregexps;
+ JS_SCRIPT_REGEXPS(script)->vector = (JSObject **)cursor;
+ vectorSize = nregexps * sizeof(JS_SCRIPT_REGEXPS(script)->vector[0]);
diff --git a/mail/thunderbird/patches/patch-nd b/mail/thunderbird/patches/patch-nd
new file mode 100644
index 00000000000..7ef6daffa02
--- /dev/null
+++ b/mail/thunderbird/patches/patch-nd
@@ -0,0 +1,37 @@
+$NetBSD: patch-nd,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+# reported upstream as
+# https://bugzilla.mozilla.org/show_bug.cgi?id=514002
+
+--- mozilla/gfx/qcms/iccread.c.orig 2009-07-30 17:30:16.000000000 +0200
++++ mozilla/gfx/qcms/iccread.c 2009-09-01 21:29:29.000000000 +0200
+@@ -23,6 +23,7 @@
+ #include <math.h>
+ #include <assert.h>
+ #include <stdlib.h>
++#include <string.h>
+ #include "qcmsint.h"
+
+ //XXX: use a better typename
+@@ -84,7 +85,9 @@ static uint32_t read_u32(struct mem_sour
+ invalid_source(mem, "Invalid offset");
+ return 0;
+ } else {
+- return be32_to_cpu(*(__be32*)(mem->buf + offset));
++ uint32_t v;
++ memcpy(&v, mem->buf + offset, 4);
++ return be32_to_cpu(v);
+ }
+ }
+
+@@ -94,7 +97,9 @@ static uint16_t read_u16(struct mem_sour
+ invalid_source(mem, "Invalid offset");
+ return 0;
+ } else {
+- return be16_to_cpu(*(__be16*)(mem->buf + offset));
++ uint16_t v;
++ memcpy(&v, mem->buf + offset, 2);
++ return be16_to_cpu(v);
+ }
+ }
+
diff --git a/mail/thunderbird/patches/patch-pa b/mail/thunderbird/patches/patch-pa
new file mode 100644
index 00000000000..0613354275e
--- /dev/null
+++ b/mail/thunderbird/patches/patch-pa
@@ -0,0 +1,12 @@
+$NetBSD: patch-pa,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/xulrunner/installer/mozilla-js.pc.in.orig 2009-06-29 18:15:36.000000000 +0200
++++ mozilla/xulrunner/installer/mozilla-js.pc.in
+@@ -6,5 +6,5 @@ Name: JavaScript
+ Description: The Mozilla JavaScript Library
+ Version: %MOZILLA_VERSION%
+ Requires: %NSPR_NAME% >= %NSPR_VERSION%
+-Libs: -L${sdkdir}/lib -lmozjs
+-Cflags: -I${includedir}/stable -DXP_UNIX -DJS_THREADSAFE
++Libs: -Wl,-R${prefix}/lib/xulrunner -L${prefix}/lib/xulrunner -lmozjs
++Cflags: -I${includedir}/stable -I${includedir}/unstable -DXP_UNIX -DJS_THREADSAFE
diff --git a/mail/thunderbird/patches/patch-pb b/mail/thunderbird/patches/patch-pb
new file mode 100644
index 00000000000..2b922902f96
--- /dev/null
+++ b/mail/thunderbird/patches/patch-pb
@@ -0,0 +1,11 @@
+$NetBSD: patch-pb,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/xulrunner/installer/libxul.pc.in.orig 2009-06-29 18:15:36.000000000 +0200
++++ mozilla/xulrunner/installer/libxul.pc.in
+@@ -12,5 +12,5 @@ Name: libxul
+ Description: The Mozilla Runtime and Embedding Engine
+ Version: %MOZILLA_VERSION%
+ Requires: %NSPR_NAME% >= %NSPR_VERSION%
+-Libs: -L${sdkdir}/lib -lxpcomglue_s -lxul -lxpcom
++Libs: -Wl,-R${prefix}/lib/xulrunner -L${prefix}/lib/xulrunner -lxpcomglue_s -lxul -lxpcom
+ Cflags: -I${includedir}/${includetype} %WCHAR_CFLAGS%
diff --git a/mail/thunderbird/patches/patch-pc b/mail/thunderbird/patches/patch-pc
new file mode 100644
index 00000000000..2f90a7418d3
--- /dev/null
+++ b/mail/thunderbird/patches/patch-pc
@@ -0,0 +1,11 @@
+$NetBSD: patch-pc,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/xulrunner/installer/libxul-embedding.pc.in.orig 2009-06-29 18:15:36.000000000 +0200
++++ mozilla/xulrunner/installer/libxul-embedding.pc.in
+@@ -11,5 +11,5 @@ includetype=stable
+ Name: libxul-embedding
+ Description: Static library for version-independent embedding of the Mozilla runtime
+ Version: %MOZILLA_VERSION%
+-Libs: -L${sdkdir}/lib -lxpcomglue
++Libs: -Wl,-R${prefix}/lib/xulrunner -L${prefix}/lib/xulrunner -lxpcomglue
+ Cflags: -DXPCOM_GLUE -I${includedir}/${includetype} %WCHAR_CFLAGS%
diff --git a/mail/thunderbird/patches/patch-pd b/mail/thunderbird/patches/patch-pd
new file mode 100644
index 00000000000..8bd0c522940
--- /dev/null
+++ b/mail/thunderbird/patches/patch-pd
@@ -0,0 +1,11 @@
+$NetBSD: patch-pd,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/xulrunner/installer/mozilla-nss.pc.in.orig 2009-10-16 17:14:30.000000000 +0200
++++ mozilla/xulrunner/installer/mozilla-nss.pc.in
+@@ -6,5 +6,5 @@ Name: NSS
+ Description: Mozilla Network Security Services
+ Version: %MOZILLA_VERSION%
+ Requires: %NSPR_NAME% >= %NSPR_VERSION%
+-Libs: -L${sdkdir}/lib -lsmime3 -lssl3 -lnss3 -lnssutil3
++Libs: -Wl,-R${prefix}/lib/xulrunner -L${prefix}/lib/xulrunner -lsmime3 -lssl3 -lnss3 -lnssutil3
+ Cflags: -I${includedir}/stable
diff --git a/mail/thunderbird/patches/patch-pe b/mail/thunderbird/patches/patch-pe
new file mode 100644
index 00000000000..714e5058b89
--- /dev/null
+++ b/mail/thunderbird/patches/patch-pe
@@ -0,0 +1,11 @@
+$NetBSD: patch-pe,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/xulrunner/installer/libxul-unstable.pc.in.orig 2009-06-29 18:15:36.000000000 +0200
++++ mozilla/xulrunner/installer/libxul-unstable.pc.in
+@@ -8,5 +8,5 @@ Name: libxul
+ Description: The Mozilla Runtime and Embedding Engine (unstable API)
+ Version: %MOZILLA_VERSION%
+ Requires: %NSPR_NAME% >= %NSPR_VERSION%
+-Libs: -L${sdkdir}/lib -lxpcomglue_s -lxul -lxpcom
++Libs: -Wl,-R${prefix}/lib/xulrunner -L${prefix}/lib/xulrunner -lxpcomglue_s -lxul -lxpcom
+ Cflags: -I${includedir}/${includetype} %WCHAR_CFLAGS%
diff --git a/mail/thunderbird/patches/patch-pf b/mail/thunderbird/patches/patch-pf
new file mode 100644
index 00000000000..4aea8a5ad3e
--- /dev/null
+++ b/mail/thunderbird/patches/patch-pf
@@ -0,0 +1,11 @@
+$NetBSD: patch-pf,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/xulrunner/installer/libxul-embedding-unstable.pc.in.orig 2009-06-29 18:15:36.000000000 +0200
++++ mozilla/xulrunner/installer/libxul-embedding-unstable.pc.in
+@@ -7,5 +7,5 @@ includetype=unstable
+ Name: libxul-embedding-unstable
+ Description: Static library for version-independent embedding of the Mozilla runtime (unstable API)
+ Version: %MOZILLA_VERSION%
+-Libs: -L${sdkdir}/lib -lxpcomglue
++Libs: -Wl,-R${prefix}/lib/xulrunner -L${prefix}/lib/xulrunner -lxpcomglue
+ Cflags: -DXPCOM_GLUE -I${includedir}/${includetype} %WCHAR_CFLAGS%
diff --git a/mail/thunderbird/patches/patch-pg b/mail/thunderbird/patches/patch-pg
new file mode 100644
index 00000000000..947556478a0
--- /dev/null
+++ b/mail/thunderbird/patches/patch-pg
@@ -0,0 +1,14 @@
+$NetBSD: patch-pg,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/xulrunner/installer/mozilla-nspr.pc.in.orig 2009-06-29 18:15:36.000000000 +0200
++++ mozilla/xulrunner/installer/mozilla-nspr.pc.in
+@@ -5,7 +5,5 @@ includedir=%includedir%
+ Name: NSPR
+ Description: The Netscape Portable Runtime
+ Version: %NSPR_VERSION%
+-Libs: %FULL_NSPR_LIBS%
+-Cflags: %FULL_NSPR_CFLAGS%
+-
+-
++Libs: -Wl,-R${prefix}/lib/xulrunner -L${prefix}/lib/xulrunner -lplds4 -lplc4 -lnspr4 -pthread
++Cflags: -I${includedir}/stable
diff --git a/mail/thunderbird/patches/patch-ra b/mail/thunderbird/patches/patch-ra
new file mode 100644
index 00000000000..a6778015819
--- /dev/null
+++ b/mail/thunderbird/patches/patch-ra
@@ -0,0 +1,9 @@
+$NetBSD: patch-ra,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/browser/branding/unofficial/locales/browserconfig.properties.orig 2009-08-24 17:52:36.000000000 +0200
++++ mozilla/browser/branding/unofficial/locales/browserconfig.properties
+@@ -1,3 +1,3 @@
+ # Do NOT localize or otherwise change these values
+-browser.startup.homepage=http://www.mozilla.org/projects/shiretoko/
++browser.startup.homepage=http://www.google.com/firefox
+
diff --git a/mail/thunderbird/patches/patch-rc b/mail/thunderbird/patches/patch-rc
new file mode 100644
index 00000000000..1b9db76ed92
--- /dev/null
+++ b/mail/thunderbird/patches/patch-rc
@@ -0,0 +1,12 @@
+$NetBSD: patch-rc,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+--- mozilla/browser/branding/unofficial/locales/en-US/brand.dtd.orig 2009-08-24 17:52:36.000000000 +0200
++++ mozilla/browser/branding/unofficial/locales/en-US/brand.dtd
+@@ -1,5 +1,5 @@
+-<!ENTITY brandShortName "Shiretoko">
+-<!ENTITY brandFullName "Shiretoko">
++<!ENTITY brandShortName "Browser">
++<!ENTITY brandFullName "Browser">
+ <!ENTITY vendorShortName "mozilla.org">
+ <!ENTITY logoCopyright " ">
+
diff --git a/mail/thunderbird/patches/patch-xa b/mail/thunderbird/patches/patch-xa
new file mode 100644
index 00000000000..32c502eea7e
--- /dev/null
+++ b/mail/thunderbird/patches/patch-xa
@@ -0,0 +1,119 @@
+$NetBSD: patch-xa,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+NetBSD/sparc64 xptcall support code. From pkgsrc/www/firefox3/files/
+
+--- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc64_netbsd.s.orig 2009-07-09 10:12:51.000000000 +0200
++++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc64_netbsd.s
+@@ -0,0 +1,112 @@
++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
++ *
++ * The contents of this file are subject to the Netscape Public
++ * License Version 1.1 (the "License"); you may not use this file
++ * except in compliance with the License. You may obtain a copy of
++ * the License at http://www.mozilla.org/NPL/
++ *
++ * Software distributed under the License is distributed on an "AS
++ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
++ * implied. See the License for the specific language governing
++ * rights and limitations under the License.
++ *
++ * The Original Code is mozilla.org code.
++ *
++ * The Initial Developer of the Original Code is Netscape
++ * Communications Corporation. Portions created by Netscape are
++ * Copyright (C) 1998 Netscape Communications Corporation. All
++ * Rights Reserved.
++ *
++ * Contributor(s):
++ */
++
++/* Platform specific code to invoke XPCOM methods on native objects */
++ .global NS_InvokeByIndex_P
++ .type NS_InvokeByIndex_P, #function
++/*
++ NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex,
++ PRUint32 paramCount, nsXPTCVariant* params);
++
++*/
++/*
++ * Note: To simplify stack handling we allocate an extra stack
++ * frame here. In principle invoke_copy_to_stack() could
++ * save the parameters our caller's frame and we could
++ * reclaim the stackframe and do a tail call to the
++ * function. However, this gets complicated....
++ *
++ * The vtable consist of be:
++ *
++ * struct {
++ * short __delta;
++ * short __index;
++ * union {
++ * P __pfn;
++ * short __delta2;
++ * } __pfn_or_delta2;
++ * };
++ *
++ * See gcc/cp/cp-tree.h
++ */
++
++NS_InvokeByIndex_P:
++ save %sp,-(128 + 64),%sp ! room for the register window and
++ ! struct pointer, rounded up to 0 % 64
++ sll %i2,4,%l0 ! assume the worst case
++ ! paramCount * 2 * 8 bytes
++ cmp %l0, 0 ! are there any args? If not,
++ be .invoke ! no need to copy args to stack
++ nop
++
++ sub %sp,%l0,%sp ! create the additional stack space
++ add %sp,0x7ff+136,%o0 ! step past the register window, the
++ ! struct result pointer and the 'this' slot
++ mov %i2,%o1 ! paramCount
++ call invoke_copy_to_stack
++ mov %i3,%o2 ! params
++
++!
++! load arguments from stack into the outgoing registers
++! BIAS is 0x7ff (2047)
++!
++
++! load the %o1..5 64bit (extended word) output registers registers
++ ldx [%sp + 0x7ff + 136],%o1 ! %i1
++ ldx [%sp + 0x7ff + 144],%o2 ! %i2
++ ldx [%sp + 0x7ff + 152],%o3 ! %i3
++ ldx [%sp + 0x7ff + 160],%o4 ! %i4
++ ldx [%sp + 0x7ff + 168],%o5 ! %i5
++
++! load the even number double registers starting with %f2
++ ldd [%sp + 0x7ff + 136],%f2
++ ldd [%sp + 0x7ff + 144],%f4
++ ldd [%sp + 0x7ff + 152],%f6
++ ldd [%sp + 0x7ff + 160],%f8
++ ldd [%sp + 0x7ff + 168],%f10
++ ldd [%sp + 0x7ff + 176],%f12
++ ldd [%sp + 0x7ff + 184],%f14
++ ldd [%sp + 0x7ff + 192],%f16
++ ldd [%sp + 0x7ff + 200],%f18
++ ldd [%sp + 0x7ff + 208],%f20
++ ldd [%sp + 0x7ff + 216],%f22
++ ldd [%sp + 0x7ff + 224],%f24
++ ldd [%sp + 0x7ff + 232],%f26
++ ldd [%sp + 0x7ff + 240],%f28
++ ldd [%sp + 0x7ff + 248],%f30
++
++!
++! calculate the target address from the vtable
++!
++.invoke:
++ sll %i1,3,%l0 ! index *= 8
++ ldx [%i0],%l1 ! *this --> address of vtable
++ ldx [%l0 + %l1],%l0 ! this->vtable[index] --> address
++
++ jmpl %l0,%o7 ! call the routine
++ mov %i0,%o0 ! move 'this' pointer to out register
++
++ mov %o0,%i0 ! propagate return value
++ ret
++ restore
++
++ .size NS_InvokeByIndex_P, .-NS_InvokeByIndex_P
diff --git a/mail/thunderbird/patches/patch-xb b/mail/thunderbird/patches/patch-xb
new file mode 100644
index 00000000000..0a626c154d7
--- /dev/null
+++ b/mail/thunderbird/patches/patch-xb
@@ -0,0 +1,91 @@
+$NetBSD: patch-xb,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+NetBSD/sparc64 xptcall support code. From pkgsrc/www/firefox3/files/
+
+--- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparc64_netbsd.cpp.orig 2009-07-09 10:12:51.000000000 +0200
++++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparc64_netbsd.cpp
+@@ -0,0 +1,84 @@
++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
++ *
++ * The contents of this file are subject to the Netscape Public
++ * License Version 1.1 (the "License"); you may not use this file
++ * except in compliance with the License. You may obtain a copy of
++ * the License at http://www.mozilla.org/NPL/
++ *
++ * Software distributed under the License is distributed on an "AS
++ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
++ * implied. See the License for the specific language governing
++ * rights and limitations under the License.
++ *
++ * The Original Code is mozilla.org code.
++ *
++ * The Initial Developer of the Original Code is Netscape
++ * Communications Corporation. Portions created by Netscape are
++ * Copyright (C) 1998 Netscape Communications Corporation. All
++ * Rights Reserved.
++ *
++ * Contributor(s):
++ */
++
++/* Platform specific code to invoke XPCOM methods on native objects */
++
++#include "xptcprivate.h"
++
++#if !defined(__sparc64__) && !defined(_LP64)
++#error "This code is for Sparc64 only"
++#endif
++
++extern "C" PRUint32
++invoke_copy_to_stack(PRUint64* d, PRUint32 paramCount, nsXPTCVariant* s)
++{
++ /*
++ We need to copy the parameters for this function to locals and use them
++ from there since the parameters occupy the same stack space as the stack
++ we're trying to populate.
++ */
++ PRUint64 *l_d = d;
++ nsXPTCVariant *l_s = s;
++ PRUint64 l_paramCount = paramCount;
++ PRUint64 regCount = 0; // return the number of registers to load from the stack
++
++ for(PRUint64 i = 0; i < l_paramCount; i++, l_d++, l_s++)
++ {
++ if (regCount < 5) regCount++;
++
++ if (l_s->IsPtrData())
++ {
++ *l_d = (PRUint64)l_s->ptr;
++ continue;
++ }
++ switch (l_s->type)
++ {
++ case nsXPTType::T_I8 : *((PRInt64*)l_d) = l_s->val.i8; break;
++ case nsXPTType::T_I16 : *((PRInt64*)l_d) = l_s->val.i16; break;
++ case nsXPTType::T_I32 : *((PRInt64*)l_d) = l_s->val.i32; break;
++ case nsXPTType::T_I64 : *((PRInt64*)l_d) = l_s->val.i64; break;
++
++ case nsXPTType::T_U8 : *((PRUint64*)l_d) = l_s->val.u8; break;
++ case nsXPTType::T_U16 : *((PRUint64*)l_d) = l_s->val.u16; break;
++ case nsXPTType::T_U32 : *((PRUint64*)l_d) = l_s->val.u32; break;
++ case nsXPTType::T_U64 : *((PRUint64*)l_d) = l_s->val.u64; break;
++
++ /* in the case of floats, we want to put the bits in to the
++ 64bit space right justified... floats in the paramter array on
++ sparcv9 use odd numbered registers.. %f1, %f3, so we have to skip
++ the space that would be occupied by %f0, %f2, etc.
++ */
++ case nsXPTType::T_FLOAT : *(((float*)l_d) + 1) = l_s->val.f; break;
++ case nsXPTType::T_DOUBLE: *((double*)l_d) = l_s->val.d; break;
++ case nsXPTType::T_BOOL : *((PRInt64*)l_d) = l_s->val.b; break;
++ case nsXPTType::T_CHAR : *((PRUint64*)l_d) = l_s->val.c; break;
++ case nsXPTType::T_WCHAR : *((PRInt64*)l_d) = l_s->val.wc; break;
++
++ default:
++ // all the others are plain pointer types
++ *((void**)l_d) = l_s->val.p;
++ break;
++ }
++ }
++
++ return regCount;
++}
diff --git a/mail/thunderbird/patches/patch-xc b/mail/thunderbird/patches/patch-xc
new file mode 100644
index 00000000000..7bccc2bcc56
--- /dev/null
+++ b/mail/thunderbird/patches/patch-xc
@@ -0,0 +1,73 @@
+$NetBSD: patch-xc,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+NetBSD/sparc64 xptcall support code. From pkgsrc/www/firefox3/files/
+
+--- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_sparc64_netbsd.s.orig 2009-07-09 10:12:51.000000000 +0200
++++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_sparc64_netbsd.s
+@@ -0,0 +1,66 @@
++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
++ *
++ * The contents of this file are subject to the Netscape Public
++ * License Version 1.1 (the "License"); you may not use this file
++ * except in compliance with the License. You may obtain a copy of
++ * the License at http://www.mozilla.org/NPL/
++ *
++ * Software distributed under the License is distributed on an "AS
++ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
++ * implied. See the License for the specific language governing
++ * rights and limitations under the License.
++ *
++ * The Original Code is mozilla.org code.
++ *
++ * The Initial Developer of the Original Code is Netscape
++ * Communications Corporation. Portions created by Netscape are
++ * Copyright (C) 1999 Netscape Communications Corporation. All
++ * Rights Reserved.
++ *
++ * Contributor(s):
++ */
++
++ .global SharedStub
++
++/*
++ in the frame for the function that called SharedStub are the
++ rest of the parameters we need
++
++*/
++
++SharedStub:
++! we don't create a new frame yet, but work within the frame of the calling
++! function to give ourselves the other parameters we want
++
++ mov %o0, %o1 ! shuffle the index up to 2nd place
++ mov %i0, %o0 ! the original 'this'
++ add %fp, 0x7ff + 136, %o2 ! previous stack top adjusted to the first argument slot (beyond 'this')
++
++! save off the original incoming parameters that arrived in
++! registers, the ABI guarantees the space for us to do this
++ stx %i1, [%fp + 0x7ff + 136]
++ stx %i2, [%fp + 0x7ff + 144]
++ stx %i3, [%fp + 0x7ff + 152]
++ stx %i4, [%fp + 0x7ff + 160]
++ stx %i5, [%fp + 0x7ff + 168]
++! now we can build our own stack frame
++ save %sp,-(128 + 64),%sp ! room for the register window and
++ ! struct pointer, rounded up to 0 % 64
++! our function now appears to have been called
++! as SharedStub(nsISupports* that, PRUint32 index, PRUint32* args)
++! so we can just copy these through
++
++ mov %i0, %o0
++ mov %i1, %o1
++ mov %i2, %o2
++ call PrepareAndDispatch
++ nop
++ mov %o0,%i0 ! propagate return value
++ b .LL1
++ nop
++.LL1:
++ ret
++ restore
++
++ .size SharedStub, .-SharedStub
++ .type SharedStub, #function
diff --git a/mail/thunderbird/patches/patch-xd b/mail/thunderbird/patches/patch-xd
new file mode 100644
index 00000000000..85e595d3966
--- /dev/null
+++ b/mail/thunderbird/patches/patch-xd
@@ -0,0 +1,126 @@
+$NetBSD: patch-xd,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+NetBSD/sparc64 xptcall support code. From pkgsrc/www/firefox3/files/
+
+--- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparc64_netbsd.cpp.orig 2009-07-09 10:12:51.000000000 +0200
++++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparc64_netbsd.cpp
+@@ -0,0 +1,119 @@
++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
++ *
++ * The contents of this file are subject to the Netscape Public
++ * License Version 1.1 (the "License"); you may not use this file
++ * except in compliance with the License. You may obtain a copy of
++ * the License at http://www.mozilla.org/NPL/
++ *
++ * Software distributed under the License is distributed on an "AS
++ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
++ * implied. See the License for the specific language governing
++ * rights and limitations under the License.
++ *
++ * The Original Code is mozilla.org code.
++ *
++ * The Initial Developer of the Original Code is Netscape
++ * Communications Corporation. Portions created by Netscape are
++ * Copyright (C) 1999 Netscape Communications Corporation. All
++ * Rights Reserved.
++ *
++ * Contributor(s):
++ */
++
++/* Implement shared vtbl methods. */
++
++#include "xptcprivate.h"
++#include "xptiprivate.h"
++
++#if defined(sparc) || defined(__sparc__)
++
++extern "C" nsresult
++PrepareAndDispatch(nsXPTCStubBase* self, PRUint64 methodIndex, PRUint64* args)
++{
++
++#define PARAM_BUFFER_COUNT 16
++
++ nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
++ nsXPTCMiniVariant* dispatchParams = NULL;
++ const nsXPTMethodInfo* info;
++ PRUint8 paramCount;
++ PRUint8 i;
++ nsresult result = NS_ERROR_FAILURE;
++
++ NS_ASSERTION(self,"no self");
++
++ self->mEntry->GetMethodInfo(PRUint16(methodIndex), &info);
++ NS_ASSERTION(info,"no interface info");
++
++ paramCount = info->GetParamCount();
++
++ // setup variant array pointer
++ if(paramCount > PARAM_BUFFER_COUNT)
++ dispatchParams = new nsXPTCMiniVariant[paramCount];
++ else
++ dispatchParams = paramBuffer;
++ NS_ASSERTION(dispatchParams,"no place for params");
++ if (!dispatchParams)
++ return NS_ERROR_OUT_OF_MEMORY;
++
++ PRUint64* ap = args;
++ for(i = 0; i < paramCount; i++, ap++)
++ {
++ const nsXPTParamInfo& param = info->GetParam(i);
++ const nsXPTType& type = param.GetType();
++ nsXPTCMiniVariant* dp = &dispatchParams[i];
++
++ if(param.IsOut() || !type.IsArithmetic())
++ {
++ dp->val.p = (void*) *ap;
++ continue;
++ }
++ // else
++ switch(type)
++ {
++ case nsXPTType::T_BOOL : dp->val.b = *((PRInt64*) ap); break;
++ case nsXPTType::T_CHAR : dp->val.c = *((PRUint64*) ap); break;
++ case nsXPTType::T_WCHAR : dp->val.wc = *((PRInt64*) ap); break;
++ case nsXPTType::T_I8 : dp->val.i8 = *((PRInt64*) ap); break;
++ case nsXPTType::T_I16 : dp->val.i16 = *((PRInt64*) ap); break;
++ case nsXPTType::T_I32 : dp->val.i32 = *((PRInt64*) ap); break;
++ case nsXPTType::T_I64 : dp->val.i64 = *((PRInt64*) ap); break;
++ case nsXPTType::T_U8 : dp->val.u8 = *((PRUint64*) ap); break;
++ case nsXPTType::T_U16 : dp->val.u16 = *((PRUint64*)ap); break;
++ case nsXPTType::T_U32 : dp->val.u32 = *((PRUint64*)ap); break;
++ case nsXPTType::T_U64 : dp->val.u64 = *((PRUint64*) ap); break;
++ case nsXPTType::T_FLOAT : dp->val.f = ((float*) ap)[1]; break;
++ case nsXPTType::T_DOUBLE : dp->val.d = *((double*) ap); break;
++ default:
++ NS_ASSERTION(0, "bad type");
++ break;
++ }
++ }
++
++ result = self->mOuter->CallMethod((PRUint16)methodIndex, info, dispatchParams);
++
++ if(dispatchParams != paramBuffer)
++ delete [] dispatchParams;
++
++ return result;
++}
++
++extern "C" int SharedStub(int, int*);
++
++#define STUB_ENTRY(n) \
++nsresult nsXPTCStubBase::Stub##n() \
++{ \
++ int dummy; /* defeat tail-call optimization */ \
++ return SharedStub(n, &dummy); \
++}
++
++#define SENTINEL_ENTRY(n) \
++nsresult nsXPTCStubBase::Sentinel##n() \
++{ \
++ NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \
++ return NS_ERROR_NOT_IMPLEMENTED; \
++}
++
++#include "xptcstubsdef.inc"
++
++#endif /* sparc || __sparc__ */
diff --git a/mail/thunderbird/patches/patch-xe b/mail/thunderbird/patches/patch-xe
new file mode 100644
index 00000000000..1a17f0f97b7
--- /dev/null
+++ b/mail/thunderbird/patches/patch-xe
@@ -0,0 +1,77 @@
+$NetBSD: patch-xe,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+NetBSD/m68k xptcall support code. From pkgsrc/www/firefox/patch-ad.
+
+--- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_netbsd_m68k.cpp.orig 2009-06-29 18:15:33.000000000 +0200
++++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_netbsd_m68k.cpp
+@@ -132,6 +132,15 @@ extern "C" {
+ }
+ }
+
++/*
++ * SYMBOL PREFIX must be "_" for aout symbols and "" for ELF
++ */
++#ifndef __ELF__
++#define SYMBOLPREFIX "_"
++#else
++#define SYMBOLPREFIX
++#endif
++
+ XPTC_PUBLIC_API(nsresult)
+ XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
+ PRUint32 paramCount, nsXPTCVariant* params)
+@@ -139,30 +148,30 @@ XPTC_InvokeByIndex(nsISupports* that, PR
+ PRUint32 result;
+
+ __asm__ __volatile__(
+- "movl %4, sp@-\n\t"
+- "movl %3, sp@-\n\t"
+- "jbsr _invoke_count_words\n\t" /* count words */
+- "addql #8, sp\n\t"
+- "lsll #2, d0\n\t" /* *= 4 */
+- "movl sp, a2\n\t" /* save original sp */
+- "subl d0, sp\n\t" /* make room for params */
+- "movl sp, a0\n\t"
+- "movl %4, sp@-\n\t"
+- "movl %3, sp@-\n\t"
+- "movl a0, sp@-\n\t"
+- "jbsr _invoke_copy_to_stack\n\t" /* copy params */
+- "addl #12, sp\n\t"
+- "movl %1, a0\n\t"
+- "movl a0@, a1\n\t"
+- "movl %2, d0\n\t" /* function index */
+- "movl a0, d1\n\t"
+- "movw a1@(8,d0:l:8), a0\n\t"
+- "addl a0, d1\n\t"
+- "movl a1@(12,d0:l:8), a1\n\t"
+- "movl d1, sp@-\n\t"
+- "jbsr a1@\n\t"
+- "movl a2, sp\n\t" /* restore original sp */
+- "movl d0, %0\n\t"
++ "movl %4, %%sp@-\n\t"
++ "movl %3, %%sp@-\n\t"
++ "jbsr "SYMBOLPREFIX"invoke_count_words\n\t" /* count words */
++ "addql #8, %%sp\n\t"
++ "lsll #2, %%d0\n\t" /* *= 4 */
++ "movl %%sp, %%a2\n\t" /* save original sp */
++ "subl %%d0, %%sp\n\t" /* make room for params */
++ "movl %%sp, %%a0\n\t"
++ "movl %4, %%sp@-\n\t"
++ "movl %3, %%sp@-\n\t"
++ "movl %%a0, %%sp@-\n\t"
++ "jbsr "SYMBOLPREFIX"invoke_copy_to_stack\n\t" /* copy params */
++ "addl #12, %%sp\n\t"
++ "movl %1, %%a0\n\t"
++ "movl %%a0@, %%a1\n\t"
++ "movl %2, %%d0\n\t" /* function index */
++ "movl %%a0, %%d1\n\t"
++ "movw %%a1@(8,%%d0:l:8), %%a0\n\t"
++ "addl %%a0, %%d1\n\t"
++ "movl %%a1@(12,%%d0:l:8), %%a1\n\t"
++ "movl %%d1, %%sp@-\n\t"
++ "jbsr %%a1@\n\t"
++ "movl %%a2, %%sp\n\t" /* restore original sp */
++ "movl %%d0, %0\n\t"
+ : "=g" (result) /* %0 */
+ : "g" (that), /* %1 */
+ "g" (methodIndex), /* %2 */
diff --git a/mail/thunderbird/patches/patch-xf b/mail/thunderbird/patches/patch-xf
new file mode 100644
index 00000000000..70e4af1853e
--- /dev/null
+++ b/mail/thunderbird/patches/patch-xf
@@ -0,0 +1,43 @@
+$NetBSD: patch-xf,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+NetBSD/m68k xptcall support code. From pkgsrc/www/firefox/patch-ae.
+
+--- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_netbsd_m68k.cpp.orig 2009-06-29 18:15:33.000000000 +0200
++++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_netbsd_m68k.cpp
+@@ -123,17 +123,27 @@ extern "C" {
+ }
+ }
+
++/*
++ * Beware: use % instead of %% for register identifiers in a preprocessor macro
++ * SYMBOL PREFIX must be "_" for aout and "" for ELF
++ */
++#ifndef __ELF__
++#define SYMBOLPREFIX "_"
++#else
++#define SYMBOLPREFIX
++#endif
++
+ #define STUB_ENTRY(n) \
+ __asm__( \
+- ".global _Stub"#n"__14nsXPTCStubBase\n\t" \
+-"_Stub"#n"__14nsXPTCStubBase:\n\t" \
+- "link a6,#0 \n\t" \
+- "lea a6@(12), a0 \n\t" /* pointer to args */ \
+- "movl a0, sp@- \n\t" \
+- "movl #"#n", sp@- \n\t" /* method index */ \
+- "movl a6@(8), sp@- \n\t" /* this */ \
+- "jbsr _PrepareAndDispatch \n\t" \
+- "unlk a6 \n\t" \
++ ".global "SYMBOLPREFIX"Stub"#n"__14nsXPTCStubBase\n\t" \
++SYMBOLPREFIX"Stub"#n"__14nsXPTCStubBase:\n\t" \
++ "link %a6,#0 \n\t" \
++ "lea %a6@(12), %a0 \n\t" /* pointer to args */ \
++ "movl %a0, %sp@- \n\t" \
++ "movl #"#n", %sp@- \n\t" /* method index */ \
++ "movl %a6@(8), %sp@- \n\t" /* this */ \
++ "jbsr "SYMBOLPREFIX"PrepareAndDispatch\n\t" \
++ "unlk %a6 \n\t" \
+ "rts \n\t" \
+ );
+
diff --git a/mail/thunderbird/patches/patch-xg b/mail/thunderbird/patches/patch-xg
new file mode 100644
index 00000000000..6caa98e2b19
--- /dev/null
+++ b/mail/thunderbird/patches/patch-xg
@@ -0,0 +1,33 @@
+$NetBSD: patch-xg,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+NetBSD/arm xptcall support code. From pkgsrc/www/firefox/patch-bm.
+
+--- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_arm_netbsd.cpp.orig 2009-06-29 18:15:33.000000000 +0200
++++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_arm_netbsd.cpp
+@@ -118,18 +118,23 @@ PrepareAndDispatch(nsXPTCStubBase* self,
+ * so they are contiguous with values passed on the stack, and then calls
+ * PrepareAndDispatch() to do the dirty work.
+ */
++#ifndef __ELF__
++#define SYMBOLPREFIX "_"
++#else
++#define SYMBOLPREFIX
++#endif
+
+ #define STUB_ENTRY(n) \
+ __asm__( \
+- ".global _Stub"#n"__14nsXPTCStubBase\n\t" \
+-"_Stub"#n"__14nsXPTCStubBase:\n\t" \
++ ".global "SYMBOLPREFIX"Stub"#n"__14nsXPTCStubBase\n\t" \
++SYMBOLPREFIX"Stub"#n"__14nsXPTCStubBase:\n\t" \
+ "stmfd sp!, {r1, r2, r3} \n\t" \
+ "mov ip, sp \n\t" \
+ "stmfd sp!, {fp, ip, lr, pc} \n\t" \
+ "sub fp, ip, #4 \n\t" \
+ "mov r1, #"#n" \n\t" /* = methodIndex */ \
+ "add r2, sp, #16 \n\t" \
+- "bl _PrepareAndDispatch__FP14nsXPTCStubBaseUiPUi \n\t" \
++ "bl "SYMBOLPREFIX"PrepareAndDispatch__FP14nsXPTCStubBaseUiPUi \n\t" \
+ "ldmea fp, {fp, sp, lr} \n\t" \
+ "add sp, sp, #12 \n\t" \
+ "mov pc, lr \n\t" \
diff --git a/mail/thunderbird/patches/patch-xh b/mail/thunderbird/patches/patch-xh
new file mode 100644
index 00000000000..e6a169cae28
--- /dev/null
+++ b/mail/thunderbird/patches/patch-xh
@@ -0,0 +1,181 @@
+$NetBSD: patch-xh,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+NetBSD/amd64 xptcall support code. Originally from pkgsrc/www/mozilla.
+
+--- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_amd64.cpp.orig 2009-06-30 22:20:24.000000000 +0200
++++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_amd64.cpp
+@@ -0,0 +1,174 @@
++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
++// Platform specific code to invoke XPCOM methods on native objects
++
++#include "xptcprivate.h"
++
++// 6 integral parameters are passed in registers
++const PRUint32 GPR_COUNT = 6;
++
++// 8 floating point parameters are passed in SSE registers
++const PRUint32 FPR_COUNT = 8;
++
++// Remember that these 'words' are 64-bit long
++static inline void
++invoke_count_words(PRUint32 paramCount, nsXPTCVariant * s,
++ PRUint32 & nr_gpr, PRUint32 & nr_fpr, PRUint32 & nr_stack)
++{
++ nr_gpr = 1; // skip one GP register for 'that'
++ nr_fpr = 0;
++ nr_stack = 0;
++
++ /* Compute number of eightbytes of class MEMORY. */
++ for (uint32 i = 0; i < paramCount; i++, s++) {
++ if (!s->IsPtrData()
++ && (s->type == nsXPTType::T_FLOAT || s->type == nsXPTType::T_DOUBLE)) {
++ if (nr_fpr < FPR_COUNT)
++ nr_fpr++;
++ else
++ nr_stack++;
++ }
++ else {
++ if (nr_gpr < GPR_COUNT)
++ nr_gpr++;
++ else
++ nr_stack++;
++ }
++ }
++}
++
++static void
++invoke_copy_to_stack(PRUint64 * d, PRUint32 paramCount, nsXPTCVariant * s,
++ PRUint64 * gpregs, double * fpregs)
++{
++ PRUint32 nr_gpr = 1; // skip one GP register for 'that'
++ PRUint32 nr_fpr = 0;
++ PRUint64 value;
++
++ for (uint32 i = 0; i < paramCount; i++, s++) {
++ if (s->IsPtrData())
++ value = (PRUint64) s->ptr;
++ else {
++ switch (s->type) {
++ case nsXPTType::T_FLOAT: break;
++ case nsXPTType::T_DOUBLE: break;
++ case nsXPTType::T_I8: value = s->val.i8; break;
++ case nsXPTType::T_I16: value = s->val.i16; break;
++ case nsXPTType::T_I32: value = s->val.i32; break;
++ case nsXPTType::T_I64: value = s->val.i64; break;
++ case nsXPTType::T_U8: value = s->val.u8; break;
++ case nsXPTType::T_U16: value = s->val.u16; break;
++ case nsXPTType::T_U32: value = s->val.u32; break;
++ case nsXPTType::T_U64: value = s->val.u64; break;
++ case nsXPTType::T_BOOL: value = s->val.b; break;
++ case nsXPTType::T_CHAR: value = s->val.c; break;
++ case nsXPTType::T_WCHAR: value = s->val.wc; break;
++ default: value = (PRUint64) s->val.p; break;
++ }
++ }
++
++ if (!s->IsPtrData() && s->type == nsXPTType::T_DOUBLE) {
++ if (nr_fpr < FPR_COUNT)
++ fpregs[nr_fpr++] = s->val.d;
++ else {
++ *((double *)d) = s->val.d;
++ d++;
++ }
++ }
++ else if (!s->IsPtrData() && s->type == nsXPTType::T_FLOAT) {
++ if (nr_fpr < FPR_COUNT)
++ // The value in %xmm register is already prepared to
++ // be retrieved as a float. Therefore, we pass the
++ // value verbatim, as a double without conversion.
++ fpregs[nr_fpr++] = s->val.d;
++ else {
++ *((float *)d) = s->val.f;
++ d++;
++ }
++ }
++ else {
++ if (nr_gpr < GPR_COUNT)
++ gpregs[nr_gpr++] = value;
++ else
++ *d++ = value;
++ }
++ }
++}
++
++extern "C"
++XPTC_PUBLIC_API(nsresult)
++XPTC_InvokeByIndex(nsISupports * that, PRUint32 methodIndex,
++ PRUint32 paramCount, nsXPTCVariant * params)
++{
++ PRUint32 nr_gpr, nr_fpr, nr_stack;
++ invoke_count_words(paramCount, params, nr_gpr, nr_fpr, nr_stack);
++
++ // Stack, if used, must be 16-bytes aligned
++ if (nr_stack)
++ nr_stack = (nr_stack + 1) & ~1;
++
++ // Load parameters to stack, if necessary
++ PRUint64 *stack = (PRUint64 *) __builtin_alloca(nr_stack * 8);
++ PRUint64 gpregs[GPR_COUNT];
++ double fpregs[FPR_COUNT];
++ invoke_copy_to_stack(stack, paramCount, params, gpregs, fpregs);
++
++ // Load FPR registers from fpregs[]
++ register double d0 asm("xmm0");
++ register double d1 asm("xmm1");
++ register double d2 asm("xmm2");
++ register double d3 asm("xmm3");
++ register double d4 asm("xmm4");
++ register double d5 asm("xmm5");
++ register double d6 asm("xmm6");
++ register double d7 asm("xmm7");
++
++ switch (nr_fpr) {
++#define ARG_FPR(N) \
++ case N+1: d##N = fpregs[N];
++ ARG_FPR(7);
++ ARG_FPR(6);
++ ARG_FPR(5);
++ ARG_FPR(4);
++ ARG_FPR(3);
++ ARG_FPR(2);
++ ARG_FPR(1);
++ ARG_FPR(0);
++ case 0:;
++#undef ARG_FPR
++ }
++
++ // Load GPR registers from gpregs[]
++ register PRUint64 a0 asm("rdi");
++ register PRUint64 a1 asm("rsi");
++ register PRUint64 a2 asm("rdx");
++ register PRUint64 a3 asm("rcx");
++ register PRUint64 a4 asm("r8");
++ register PRUint64 a5 asm("r9");
++
++ switch (nr_gpr) {
++#define ARG_GPR(N) \
++ case N+1: a##N = gpregs[N];
++ ARG_GPR(5);
++ ARG_GPR(4);
++ ARG_GPR(3);
++ ARG_GPR(2);
++ ARG_GPR(1);
++ case 1: a0 = (PRUint64) that;
++ case 0:;
++#undef ARG_GPR
++ }
++
++ // Ensure that assignments to SSE registers won't be optimized away
++ asm("" ::
++ "x" (d0), "x" (d1), "x" (d2), "x" (d3),
++ "x" (d4), "x" (d5), "x" (d6), "x" (d7));
++
++ // Get pointer to method
++ PRUint64 methodAddress = *((PRUint64 *)that);
++ methodAddress += 8 * methodIndex;
++ methodAddress = *((PRUint64 *)methodAddress);
++
++ typedef PRUint32 (*Method)(PRUint64, PRUint64, PRUint64, PRUint64, PRUint64, PRUint64);
++ PRUint32 result = ((Method)methodAddress)(a0, a1, a2, a3, a4, a5);
++ return result;
++}
diff --git a/mail/thunderbird/patches/patch-xi b/mail/thunderbird/patches/patch-xi
new file mode 100644
index 00000000000..0ddb323d72a
--- /dev/null
+++ b/mail/thunderbird/patches/patch-xi
@@ -0,0 +1,213 @@
+$NetBSD: patch-xi,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+NetBSD/amd64 xptcall support code. Originally from pkgsrc/www/mozilla.
+
+--- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_unixish_amd64.cpp.orig 2009-06-30 22:20:24.000000000 +0200
++++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_unixish_amd64.cpp
+@@ -0,0 +1,206 @@
++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
++
++// Implement shared vtbl methods.
++
++#include "xptcprivate.h"
++
++// The Linux/x86-64 ABI passes the first 6 integral parameters and the
++// first 8 floating point parameters in registers (rdi, rsi, rdx, rcx,
++// r8, r9 and xmm0-xmm7), no stack space is allocated for these by the
++// caller. The rest of the parameters are passed in the callers stack
++// area.
++
++const PRUint32 PARAM_BUFFER_COUNT = 16;
++const PRUint32 GPR_COUNT = 6;
++const PRUint32 FPR_COUNT = 8;
++
++// PrepareAndDispatch() is called by SharedStub() and calls the actual method.
++//
++// - 'args[]' contains the arguments passed on stack
++// - 'gpregs[]' contains the arguments passed in integer registers
++// - 'fpregs[]' contains the arguments passed in floating point registers
++//
++// The parameters are mapped into an array of type 'nsXPTCMiniVariant'
++// and then the method gets called.
++
++extern "C" nsresult
++PrepareAndDispatch(nsXPTCStubBase * self, PRUint32 methodIndex,
++ PRUint64 * args, PRUint64 * gpregs, double *fpregs)
++{
++ nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
++ nsXPTCMiniVariant* dispatchParams = NULL;
++ nsIInterfaceInfo* iface_info = NULL;
++ const nsXPTMethodInfo* info;
++ PRUint32 paramCount;
++ PRUint32 i;
++ nsresult result = NS_ERROR_FAILURE;
++
++ NS_ASSERTION(self,"no self");
++
++ self->GetInterfaceInfo(&iface_info);
++ NS_ASSERTION(iface_info,"no interface info");
++ if (! iface_info)
++ return NS_ERROR_UNEXPECTED;
++
++ iface_info->GetMethodInfo(PRUint16(methodIndex), &info);
++ NS_ASSERTION(info,"no method info");
++ if (! info)
++ return NS_ERROR_UNEXPECTED;
++
++ paramCount = info->GetParamCount();
++
++ // setup variant array pointer
++ if(paramCount > PARAM_BUFFER_COUNT)
++ dispatchParams = new nsXPTCMiniVariant[paramCount];
++ else
++ dispatchParams = paramBuffer;
++
++ NS_ASSERTION(dispatchParams,"no place for params");
++ if (! dispatchParams)
++ return NS_ERROR_OUT_OF_MEMORY;
++
++ PRUint64* ap = args;
++ PRUint32 nr_gpr = 1; // skip one GPR register for 'that'
++ PRUint32 nr_fpr = 0;
++ PRUint64 value;
++
++ for(i = 0; i < paramCount; i++) {
++ const nsXPTParamInfo& param = info->GetParam(i);
++ const nsXPTType& type = param.GetType();
++ nsXPTCMiniVariant* dp = &dispatchParams[i];
++
++ if (!param.IsOut() && type == nsXPTType::T_DOUBLE) {
++ if (nr_fpr < FPR_COUNT)
++ dp->val.d = fpregs[nr_fpr++];
++ else
++ dp->val.d = *(double*) ap++;
++ continue;
++ }
++ else if (!param.IsOut() && type == nsXPTType::T_FLOAT) {
++ if (nr_fpr < FPR_COUNT)
++ // The value in %xmm register is already prepared to
++ // be retrieved as a float. Therefore, we pass the
++ // value verbatim, as a double without conversion.
++ dp->val.d = *(double*) ap++;
++ else
++ dp->val.f = *(float*) ap++;
++ continue;
++ }
++ else {
++ if (nr_gpr < GPR_COUNT)
++ value = gpregs[nr_gpr++];
++ else
++ value = *ap++;
++ }
++
++ if (param.IsOut() || !type.IsArithmetic()) {
++ dp->val.p = (void*) value;
++ continue;
++ }
++
++ switch (type) {
++ case nsXPTType::T_I8: dp->val.i8 = (PRInt8) value; break;
++ case nsXPTType::T_I16: dp->val.i16 = (PRInt16) value; break;
++ case nsXPTType::T_I32: dp->val.i32 = (PRInt32) value; break;
++ case nsXPTType::T_I64: dp->val.i64 = (PRInt64) value; break;
++ case nsXPTType::T_U8: dp->val.u8 = (PRUint8) value; break;
++ case nsXPTType::T_U16: dp->val.u16 = (PRUint16) value; break;
++ case nsXPTType::T_U32: dp->val.u32 = (PRUint32) value; break;
++ case nsXPTType::T_U64: dp->val.u64 = (PRUint64) value; break;
++ case nsXPTType::T_BOOL: dp->val.b = (PRBool) value; break;
++ case nsXPTType::T_CHAR: dp->val.c = (char) value; break;
++ case nsXPTType::T_WCHAR: dp->val.wc = (wchar_t) value; break;
++
++ default:
++ NS_ASSERTION(0, "bad type");
++ break;
++ }
++ }
++
++ result = self->CallMethod((PRUint16) methodIndex, info, dispatchParams);
++
++ NS_RELEASE(iface_info);
++
++ if (dispatchParams != paramBuffer)
++ delete [] dispatchParams;
++
++ return result;
++}
++
++#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
++// Linux/x86-64 uses gcc >= 3.1
++#define STUB_ENTRY(n) \
++asm(".section \".text\"\n\t" \
++ ".align 2\n\t" \
++ ".if " #n " < 10\n\t" \
++ ".globl _ZN14nsXPTCStubBase5Stub" #n "Ev\n\t" \
++ ".type _ZN14nsXPTCStubBase5Stub" #n "Ev,@function\n" \
++ "_ZN14nsXPTCStubBase5Stub" #n "Ev:\n\t" \
++ ".elseif " #n " < 100\n\t" \
++ ".globl _ZN14nsXPTCStubBase6Stub" #n "Ev\n\t" \
++ ".type _ZN14nsXPTCStubBase6Stub" #n "Ev,@function\n" \
++ "_ZN14nsXPTCStubBase6Stub" #n "Ev:\n\t" \
++ ".elseif " #n " < 1000\n\t" \
++ ".globl _ZN14nsXPTCStubBase7Stub" #n "Ev\n\t" \
++ ".type _ZN14nsXPTCStubBase7Stub" #n "Ev,@function\n" \
++ "_ZN14nsXPTCStubBase7Stub" #n "Ev:\n\t" \
++ ".else\n\t" \
++ ".err \"stub number " #n " >= 1000 not yet supported\"\n\t" \
++ ".endif\n\t" \
++ "movl $" #n ", %eax\n\t" \
++ "jmp SharedStub\n\t" \
++ ".if " #n " < 10\n\t" \
++ ".size _ZN14nsXPTCStubBase5Stub" #n "Ev,.-_ZN14nsXPTCStubBase5Stub" #n "Ev\n\t" \
++ ".elseif " #n " < 100\n\t" \
++ ".size _ZN14nsXPTCStubBase6Stub" #n "Ev,.-_ZN14nsXPTCStubBase6Stub" #n "Ev\n\t" \
++ ".else\n\t" \
++ ".size _ZN14nsXPTCStubBase7Stub" #n "Ev,.-_ZN14nsXPTCStubBase7Stub" #n "Ev\n\t" \
++ ".endif");
++
++// static nsresult SharedStub(PRUint32 methodIndex)
++asm(".section \".text\"\n\t"
++ ".align 2\n\t"
++ ".type SharedStub,@function\n\t"
++ "SharedStub:\n\t"
++ // make room for gpregs (48), fpregs (64)
++ "pushq %rbp\n\t"
++ "movq %rsp,%rbp\n\t"
++ "subq $112,%rsp\n\t"
++ // save GP registers
++ "movq %rdi,-112(%rbp)\n\t"
++ "movq %rsi,-104(%rbp)\n\t"
++ "movq %rdx, -96(%rbp)\n\t"
++ "movq %rcx, -88(%rbp)\n\t"
++ "movq %r8 , -80(%rbp)\n\t"
++ "movq %r9 , -72(%rbp)\n\t"
++ "leaq -112(%rbp),%rcx\n\t"
++ // save FP registers
++ "movsd %xmm0,-64(%rbp)\n\t"
++ "movsd %xmm1,-56(%rbp)\n\t"
++ "movsd %xmm2,-48(%rbp)\n\t"
++ "movsd %xmm3,-40(%rbp)\n\t"
++ "movsd %xmm4,-32(%rbp)\n\t"
++ "movsd %xmm5,-24(%rbp)\n\t"
++ "movsd %xmm6,-16(%rbp)\n\t"
++ "movsd %xmm7, -8(%rbp)\n\t"
++ "leaq -64(%rbp),%r8\n\t"
++ // rdi has the 'self' pointer already
++ "movl %eax,%esi\n\t"
++ "leaq 16(%rbp),%rdx\n\t"
++ "call PrepareAndDispatch\n\t"
++ "leave\n\t"
++ "ret\n\t"
++ ".size SharedStub,.-SharedStub");
++
++#define SENTINEL_ENTRY(n) \
++nsresult nsXPTCStubBase::Sentinel##n() \
++{ \
++ NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \
++ return NS_ERROR_NOT_IMPLEMENTED; \
++}
++
++#include "xptcstubsdef.inc"
++
++#else
++#error "can't find a compiler to use"
++#endif /* __GNUC__ */
diff --git a/mail/thunderbird/patches/patch-xj b/mail/thunderbird/patches/patch-xj
new file mode 100644
index 00000000000..2fcfddfae95
--- /dev/null
+++ b/mail/thunderbird/patches/patch-xj
@@ -0,0 +1,129 @@
+$NetBSD: patch-xj,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+NetBSD ppc xptcall support code. Originally from pkgsrc/www/mozilla.
+
+--- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_netbsd.cpp.orig 2009-06-29 18:15:33.000000000 +0200
++++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_netbsd.cpp
+@@ -41,6 +41,7 @@
+ // Implement shared vtbl methods.
+
+ #include "xptcprivate.h"
++#include "xptiprivate.h"
+
+ // The Linux/PPC ABI (aka PPC/SYSV ABI) passes the first 8 integral
+ // parameters and the first 8 floating point parameters in registers
+@@ -71,7 +72,6 @@ PrepareAndDispatch(nsXPTCStubBase* self,
+ {
+ nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
+ nsXPTCMiniVariant* dispatchParams = NULL;
+- nsIInterfaceInfo* iface_info = NULL;
+ const nsXPTMethodInfo* info;
+ PRUint32 paramCount;
+ PRUint32 i;
+@@ -79,12 +79,7 @@ PrepareAndDispatch(nsXPTCStubBase* self,
+
+ NS_ASSERTION(self,"no self");
+
+- self->GetInterfaceInfo(&iface_info);
+- NS_ASSERTION(iface_info,"no interface info");
+- if (! iface_info)
+- return NS_ERROR_UNEXPECTED;
+-
+- iface_info->GetMethodInfo(PRUint16(methodIndex), &info);
++ self->mEntry->GetMethodInfo(PRUint16(methodIndex), &info);
+ NS_ASSERTION(info,"no method info");
+ if (! info)
+ return NS_ERROR_UNEXPECTED;
+@@ -119,8 +114,10 @@ PrepareAndDispatch(nsXPTCStubBase* self,
+ if ((PRUint32) ap & 4) ap++; // doubles are 8-byte aligned on stack
+ dp->val.d = *(double*) ap;
+ ap += 2;
++#if __GXX_ABI_VERSION < 100
+ if (gpr < GPR_COUNT)
+ gpr += 2;
++#endif
+ }
+ continue;
+ }
+@@ -130,8 +127,10 @@ PrepareAndDispatch(nsXPTCStubBase* self,
+ else {
+ dp->val.f = *(float*) ap;
+ ap += 1;
++#if __GXX_ABI_VERSION < 100
+ if (gpr < GPR_COUNT)
+ gpr += 1;
++#endif
+ }
+ continue;
+ }
+@@ -179,9 +178,9 @@ PrepareAndDispatch(nsXPTCStubBase* self,
+ }
+ }
+
+- result = self->CallMethod((PRUint16) methodIndex, info, dispatchParams);
+-
+- NS_RELEASE(iface_info);
++ result = self->mOuter->CallMethod((PRUint16) methodIndex,
++ info,
++ dispatchParams);
+
+ if (dispatchParams != paramBuffer)
+ delete [] dispatchParams;
+@@ -195,7 +194,9 @@ PrepareAndDispatch(nsXPTCStubBase* self,
+ // however, it's quick, dirty, and'll break when the ABI changes on
+ // us, which is what we want ;-).
+
+-#define STUB_ENTRY(n) \
++#if __GXX_ABI_VERSION < 100
++// gcc-2 version
++# define STUB_ENTRY(n) \
+ __asm__ ( \
+ ".section \".text\" \n\t" \
+ ".align 2 \n\t" \
+@@ -206,6 +207,46 @@ __asm__ (
+ "li 11,"#n" \n\t" \
+ "b SharedStub@local \n" \
+ );
++#else
++// gcc-3 version
++//
++// As G++3 ABI contains the length of the functionname in the mangled
++// name, it is difficult to get a generic assembler mechanism like
++// in the G++ 2.95 case.
++// Create names would be like:
++// _ZN14nsXPTCStubBase5Stub1Ev
++// _ZN14nsXPTCStubBase6Stub12Ev
++// _ZN14nsXPTCStubBase7Stub123Ev
++// _ZN14nsXPTCStubBase8Stub1234Ev
++// etc.
++// Use assembler directives to get the names right...
++
++# define STUB_ENTRY(n) \
++__asm__ ( \
++ ".align 2 \n\t" \
++ ".if "#n" < 10 \n\t" \
++ ".globl _ZN14nsXPTCStubBase5Stub"#n"Ev \n\t" \
++ ".type _ZN14nsXPTCStubBase5Stub"#n"Ev,@function \n\n" \
++"_ZN14nsXPTCStubBase5Stub"#n"Ev: \n\t" \
++ \
++ ".elseif "#n" < 100 \n\t" \
++ ".globl _ZN14nsXPTCStubBase6Stub"#n"Ev \n\t" \
++ ".type _ZN14nsXPTCStubBase6Stub"#n"Ev,@function \n\n" \
++"_ZN14nsXPTCStubBase6Stub"#n"Ev: \n\t" \
++ \
++ ".elseif "#n" < 1000 \n\t" \
++ ".globl _ZN14nsXPTCStubBase7Stub"#n"Ev \n\t" \
++ ".type _ZN14nsXPTCStubBase7Stub"#n"Ev,@function \n\n" \
++"_ZN14nsXPTCStubBase7Stub"#n"Ev: \n\t" \
++ \
++ ".else \n\t" \
++ ".err \"stub number "#n" >= 1000 not yet supported\"\n" \
++ ".endif \n\t" \
++ \
++ "li 11,"#n" \n\t" \
++ "b SharedStub@local \n" \
++);
++#endif
+
+ #define SENTINEL_ENTRY(n) \
+ nsresult nsXPTCStubBase::Sentinel##n() \
diff --git a/mail/thunderbird/patches/patch-xk b/mail/thunderbird/patches/patch-xk
new file mode 100644
index 00000000000..69cddfb0065
--- /dev/null
+++ b/mail/thunderbird/patches/patch-xk
@@ -0,0 +1,156 @@
+$NetBSD: patch-xk,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+NetBSD ppc xptcall support code. Originally from pkgsrc/www/mozilla.
+
+--- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_netbsd.s.orig 2009-06-29 18:15:33.000000000 +0200
++++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_netbsd.s
+@@ -1,43 +1,43 @@
+-# -*- Mode: Asm -*-
+-#
+-# ***** BEGIN LICENSE BLOCK *****
+-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+-#
+-# The contents of this file are subject to the Mozilla Public License Version
+-# 1.1 (the "License"); you may not use this file except in compliance with
+-# the License. You may obtain a copy of the License at
+-# http://www.mozilla.org/MPL/
+-#
+-# Software distributed under the License is distributed on an "AS IS" basis,
+-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+-# for the specific language governing rights and limitations under the
+-# License.
+-#
+-# The Original Code is mozilla.org code.
+-#
+-# The Initial Developer of the Original Code is
+-# Netscape Communications Corporation.
+-# Portions created by the Initial Developer are Copyright (C) 1999
+-# the Initial Developer. All Rights Reserved.
+-#
+-# Contributor(s):
+-# Franz.Sirl-kernel@lauterbach.com (Franz Sirl)
+-# beard@netscape.com (Patrick Beard)
+-# waterson@netscape.com (Chris Waterson)
+-#
+-# Alternatively, the contents of this file may be used under the terms of
+-# either the GNU General Public License Version 2 or later (the "GPL"), or
+-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+-# in which case the provisions of the GPL or the LGPL are applicable instead
+-# of those above. If you wish to allow use of your version of this file only
+-# under the terms of either the GPL or the LGPL, and not to allow others to
+-# use your version of this file under the terms of the MPL, indicate your
+-# decision by deleting the provisions above and replace them with the notice
+-# and other provisions required by the GPL or the LGPL. If you do not delete
+-# the provisions above, a recipient may use your version of this file under
+-# the terms of any one of the MPL, the GPL or the LGPL.
+-#
+-# ***** END LICENSE BLOCK *****
++// -*- Mode: Asm -*-
++//
++// ***** BEGIN LICENSE BLOCK *****
++// Version: MPL 1.1/GPL 2.0/LGPL 2.1
++//
++// The contents of this file are subject to the Mozilla Public License Version
++// 1.1 (the "License"); you may not use this file except in compliance with
++// the License. You may obtain a copy of the License at
++// http://www.mozilla.org/MPL/
++//
++// Software distributed under the License is distributed on an "AS IS" basis,
++// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
++// for the specific language governing rights and limitations under the
++// License.
++//
++// The Original Code is mozilla.org code.
++//
++// The Initial Developer of the Original Code is
++// Netscape Communications Corporation.
++// Portions created by the Initial Developer are Copyright (C) 1999
++// the Initial Developer. All Rights Reserved.
++//
++// Contributor(s):
++// Franz.Sirl-kernel@lauterbach.com (Franz Sirl)
++// beard@netscape.com (Patrick Beard)
++// waterson@netscape.com (Chris Waterson)
++//
++// Alternatively, the contents of this file may be used under the terms of
++// either the GNU General Public License Version 2 or later (the "GPL"), or
++// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
++// in which case the provisions of the GPL or the LGPL are applicable instead
++// of those above. If you wish to allow use of your version of this file only
++// under the terms of either the GPL or the LGPL, and not to allow others to
++// use your version of this file under the terms of the MPL, indicate your
++// decision by deleting the provisions above and replace them with the notice
++// and other provisions required by the GPL or the LGPL. If you do not delete
++// the provisions above, a recipient may use your version of this file under
++// the terms of any one of the MPL, the GPL or the LGPL.
++//
++// ***** END LICENSE BLOCK *****
+
+ .set r0,0; .set sp,1; .set RTOC,2; .set r3,3; .set r4,4
+ .set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9
+@@ -60,23 +60,23 @@
+ .type SharedStub,@function
+
+ SharedStub:
+- stwu sp,-112(sp) # room for
+- # linkage (8),
+- # gprData (32),
+- # fprData (64),
+- # stack alignment(8)
++ stwu sp,-112(sp) // room for
++ // linkage (8),
++ // gprData (32),
++ // fprData (64),
++ // stack alignment(8)
+ mflr r0
+- stw r0,116(sp) # save LR backchain
++ stw r0,116(sp) // save LR backchain
+
+- stw r4,12(sp) # save GP registers
+- stw r5,16(sp) # (n.b. that we don't save r3
+- stw r6,20(sp) # because PrepareAndDispatch() is savvy)
++ stw r4,12(sp) // save GP registers
++ stw r5,16(sp) // (n.b. that we don't save r3
++ stw r6,20(sp) // because PrepareAndDispatch() is savvy)
+ stw r7,24(sp)
+ stw r8,28(sp)
+ stw r9,32(sp)
+ stw r10,36(sp)
+
+- stfd f1,40(sp) # save FP registers
++ stfd f1,40(sp) // save FP registers
+ stfd f2,48(sp)
+ stfd f3,56(sp)
+ stfd f4,64(sp)
+@@ -85,21 +85,21 @@ SharedStub:
+ stfd f7,88(sp)
+ stfd f8,96(sp)
+
+- # r3 has the 'self' pointer already
++ // r3 has the 'self' pointer already
+
+- mr r4,r11 # r4 <= methodIndex selector, passed
+- # via r11 in the nsXPTCStubBase::StubXX() call
++ mr r4,r11 // r4 <= methodIndex selector, passed
++ // via r11 in the nsXPTCStubBase::StubXX() call
+
+- addi r5,sp,120 # r5 <= pointer to callers args area,
+- # beyond r3-r10/f1-f8 mapped range
++ addi r5,sp,120 // r5 <= pointer to callers args area,
++ // beyond r3-r10/f1-f8 mapped range
+
+- addi r6,sp,8 # r6 <= gprData
+- addi r7,sp,40 # r7 <= fprData
++ addi r6,sp,8 // r6 <= gprData
++ addi r7,sp,40 // r7 <= fprData
+
+- bl PrepareAndDispatch@local # Go!
++ bl PrepareAndDispatch@local // Go!
+
+- lwz r0,116(sp) # restore LR
++ lwz r0,116(sp) // restore LR
+ mtlr r0
+- la sp,112(sp) # clean up the stack
++ la sp,112(sp) // clean up the stack
+ blr
+
diff --git a/mail/thunderbird/patches/patch-xl b/mail/thunderbird/patches/patch-xl
new file mode 100644
index 00000000000..66488e81900
--- /dev/null
+++ b/mail/thunderbird/patches/patch-xl
@@ -0,0 +1,200 @@
+$NetBSD: patch-xl,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+NetBSD ppc xptcall support code. Originally from pkgsrc/www/mozilla.
+
+--- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_netbsd.s.orig 2009-06-29 18:15:33.000000000 +0200
++++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_netbsd.s
+@@ -1,43 +1,43 @@
+-# -*- Mode: Asm -*-
+-#
+-# ***** BEGIN LICENSE BLOCK *****
+-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+-#
+-# The contents of this file are subject to the Mozilla Public License Version
+-# 1.1 (the "License"); you may not use this file except in compliance with
+-# the License. You may obtain a copy of the License at
+-# http://www.mozilla.org/MPL/
+-#
+-# Software distributed under the License is distributed on an "AS IS" basis,
+-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+-# for the specific language governing rights and limitations under the
+-# License.
+-#
+-# The Original Code is mozilla.org code.
+-#
+-# The Initial Developer of the Original Code is
+-# Netscape Communications Corporation.
+-# Portions created by the Initial Developer are Copyright (C) 1999
+-# the Initial Developer. All Rights Reserved.
+-#
+-# Contributor(s):
+-# Franz.Sirl-kernel@lauterbach.com (Franz Sirl)
+-# beard@netscape.com (Patrick Beard)
+-# waterson@netscape.com (Chris Waterson)
+-#
+-# Alternatively, the contents of this file may be used under the terms of
+-# either the GNU General Public License Version 2 or later (the "GPL"), or
+-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+-# in which case the provisions of the GPL or the LGPL are applicable instead
+-# of those above. If you wish to allow use of your version of this file only
+-# under the terms of either the GPL or the LGPL, and not to allow others to
+-# use your version of this file under the terms of the MPL, indicate your
+-# decision by deleting the provisions above and replace them with the notice
+-# and other provisions required by the GPL or the LGPL. If you do not delete
+-# the provisions above, a recipient may use your version of this file under
+-# the terms of any one of the MPL, the GPL or the LGPL.
+-#
+-# ***** END LICENSE BLOCK *****
++// -*- Mode: Asm -*-
++//
++// ***** BEGIN LICENSE BLOCK *****
++// Version: MPL 1.1/GPL 2.0/LGPL 2.1
++//
++// The contents of this file are subject to the Mozilla Public License Version
++// 1.1 (the "License"); you may not use this file except in compliance with
++// the License. You may obtain a copy of the License at
++// http://www.mozilla.org/MPL/
++//
++// Software distributed under the License is distributed on an "AS IS" basis,
++// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
++// for the specific language governing rights and limitations under the
++// License.
++//
++// The Original Code is mozilla.org code.
++//
++// The Initial Developer of the Original Code is
++// Netscape Communications Corporation.
++// Portions created by the Initial Developer are Copyright (C) 1999
++// the Initial Developer. All Rights Reserved.
++//
++// Contributor(s):
++// Franz.Sirl-kernel@lauterbach.com (Franz Sirl)
++// beard@netscape.com (Patrick Beard)
++// waterson@netscape.com (Chris Waterson)
++//
++// Alternatively, the contents of this file may be used under the terms of
++// either the GNU General Public License Version 2 or later (the "GPL"), or
++// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
++// in which case the provisions of the GPL or the LGPL are applicable instead
++// of those above. If you wish to allow use of your version of this file only
++// under the terms of either the GPL or the LGPL, and not to allow others to
++// use your version of this file under the terms of the MPL, indicate your
++// decision by deleting the provisions above and replace them with the notice
++// and other provisions required by the GPL or the LGPL. If you do not delete
++// the provisions above, a recipient may use your version of this file under
++// the terms of any one of the MPL, the GPL or the LGPL.
++//
++// ***** END LICENSE BLOCK *****
+ .set r0,0; .set sp,1; .set RTOC,2; .set r3,3; .set r4,4
+ .set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9
+ .set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14
+@@ -55,41 +55,41 @@
+
+ .section ".text"
+ .align 2
+- .globl XPTC_InvokeByIndex
+- .type XPTC_InvokeByIndex,@function
++ .globl NS_InvokeByIndex_P
++ .type NS_InvokeByIndex_P,@function
+
+-#
+-# XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
+-# PRUint32 paramCount, nsXPTCVariant* params)
+-#
+-
+-XPTC_InvokeByIndex:
+- stwu sp,-32(sp) # setup standard stack frame
+- mflr r0 # save LR
+- stw r3,8(sp) # r3 <= that
+- stw r4,12(sp) # r4 <= methodIndex
++//
++// NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex,
++// PRUint32 paramCount, nsXPTCVariant* params)
++//
++
++NS_InvokeByIndex_P:
++ stwu sp,-32(sp) // setup standard stack frame
++ mflr r0 // save LR
++ stw r3,8(sp) // r3 <= that
++ stw r4,12(sp) // r4 <= methodIndex
+ stw r30,16(sp)
+ stw r31,20(sp)
+
+- stw r0,36(sp) # store LR backchain
++ stw r0,36(sp) // store LR backchain
+ mr r31,sp
+
+- rlwinm r10,r5,3,0,27 # r10 = (ParamCount * 2 * 4) & ~0x0f
+- addi r0,r10,96 # reserve stack for GPR and FPR register save area r0 = r10 + 96
+- lwz r9,0(sp) # r9 = backchain
++ rlwinm r10,r5,3,0,27 // r10 = (ParamCount * 2 * 4) & ~0x0f
++ addi r0,r10,96 // reserve stack for GPR and FPR register save area r0 = r10 + 96
++ lwz r9,0(sp) // r9 = backchain
+ neg r0,r0
+- stwux r9,sp,r0 # reserve stack sapce and save SP backchain
++ stwux r9,sp,r0 // reserve stack sapce and save SP backchain
+
+- addi r3,sp,8 # r3 <= args
+- mr r4,r5 # r4 <= paramCount
+- mr r5,r6 # r5 <= params
+- add r6,r3,r10 # r6 <= gpregs ( == args + r10 )
+- mr r30,r6 # store in r30 for use later...
+- addi r7,r6,32 # r7 <= fpregs ( == gpregs + 32 )
++ addi r3,sp,8 // r3 <= args
++ mr r4,r5 // r4 <= paramCount
++ mr r5,r6 // r5 <= params
++ add r6,r3,r10 // r6 <= gpregs ( == args + r10 )
++ mr r30,r6 // store in r30 for use later...
++ addi r7,r6,32 // r7 <= fpregs ( == gpregs + 32 )
+
+- bl invoke_copy_to_stack@local # (args, paramCount, params, gpregs, fpregs)
++ bl invoke_copy_to_stack@local // (args, paramCount, params, gpregs, fpregs)
+
+- lfd f1,32(r30) # load FP registers with method parameters
++ lfd f1,32(r30) // load FP registers with method parameters
+ lfd f2,40(r30)
+ lfd f3,48(r30)
+ lfd f4,56(r30)
+@@ -98,18 +98,13 @@ XPTC_InvokeByIndex:
+ lfd f7,80(r30)
+ lfd f8,88(r30)
+
+- lwz r3,8(r31) # r3 <= that
+- lwz r4,12(r31) # r4 <= methodIndex
+- lwz r5,0(r3) # r5 <= vtable ( == *that )
+- slwi r4,r4,3 # convert to offset ( *= 8 )
+- addi r4,r4,8 # skip first two vtable entries
+- add r4,r4,r5
+- lhz r0,0(r4) # virtual base offset
+- extsh r0,r0
+- add r3,r3,r0
+- lwz r0,4(r4) # r0 <= methodpointer ( == vtable + offset )
++ lwz r3,8(r31) // r3 <= that
++ lwz r4,12(r31) // r4 <= methodIndex
++ lwz r5,0(r3) // r5 <= vtable ( == *that )
++ slwi r4,r4,2 // convert to offset ( *= 4 )
++ lwzx r0,r4,r5 // r0 <= methodpointer ( == vtable + offset )
+
+- lwz r4,4(r30) # load GP regs with method parameters
++ lwz r4,4(r30) // load GP regs with method parameters
+ lwz r5,8(r30)
+ lwz r6,12(r30)
+ lwz r7,16(r30)
+@@ -117,13 +112,13 @@ XPTC_InvokeByIndex:
+ lwz r9,24(r30)
+ lwz r10,28(r30)
+
+- mtlr r0 # copy methodpointer to LR
+- blrl # call method
++ mtlr r0 // copy methodpointer to LR
++ blrl // call method
+
+- lwz r30,16(r31) # restore r30 & r31
++ lwz r30,16(r31) // restore r30 & r31
+ lwz r31,20(r31)
+
+- lwz r11,0(sp) # clean up the stack
++ lwz r11,0(sp) // clean up the stack
+ lwz r0,4(r11)
+ mtlr r0
+ mr sp,r11
diff --git a/mail/thunderbird/patches/patch-xm b/mail/thunderbird/patches/patch-xm
new file mode 100644
index 00000000000..1b08dbcbbb6
--- /dev/null
+++ b/mail/thunderbird/patches/patch-xm
@@ -0,0 +1,49 @@
+$NetBSD: patch-xm,v 1.1 2010/03/16 10:59:09 tnn Exp $
+
+NetBSD/ppc xptcall support code. Originally from pkgsrc/www/mozilla.
+
+--- mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_netbsd.cpp.orig 2009-06-29 18:15:33.000000000 +0200
++++ mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_netbsd.cpp
+@@ -40,9 +40,9 @@
+
+ // Platform specific code to invoke XPCOM methods on native objects
+
+-// The purpose of XPTC_InvokeByIndex() is to map a platform
++// The purpose of NS_InvokeByIndex_P() is to map a platform
+ // indepenpent call to the platform ABI. To do that,
+-// XPTC_InvokeByIndex() has to determine the method to call via vtable
++// NS_InvokeByIndex_P() has to determine the method to call via vtable
+ // access. The parameters for the method are read from the
+ // nsXPTCVariant* and prepared for the native ABI. For the Linux/PPC
+ // ABI this means that the first 8 integral and floating point
+@@ -104,8 +104,10 @@ invoke_copy_to_stack(PRUint32* d,
+ if ((PRUint32) d & 4) d++; // doubles are 8-byte aligned on stack
+ *((double*) d) = s->val.d;
+ d += 2;
++#if __GXX_ABI_VERSION < 100
+ if (gpr < GPR_COUNT)
+ gpr += 2;
++#endif
+ }
+ }
+ else if (!s->IsPtrData() && s->type == nsXPTType::T_FLOAT) {
+@@ -114,8 +116,10 @@ invoke_copy_to_stack(PRUint32* d,
+ else {
+ *((float*) d) = s->val.f;
+ d += 1;
++#if __GXX_ABI_VERSION < 100
+ if (gpr < GPR_COUNT)
+ gpr += 1;
++#endif
+ }
+ }
+ else if (!s->IsPtrData() && (s->type == nsXPTType::T_I64
+@@ -142,6 +146,6 @@ invoke_copy_to_stack(PRUint32* d,
+ }
+
+ extern "C"
+-XPTC_PUBLIC_API(nsresult)
+-XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
++EXPORT_XPCOM_API(nsresult)
++NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex,
+ PRUint32 paramCount, nsXPTCVariant* params);