Bug 394502/Bug 585947 Switch Thunderbird to a default configuration of libxul with all comm-central libs being linked into libxul. r=KaiRo,feedback=Callek. bustage fix for CLOSED TREE
authorMark Banner <bugzilla@standard8.plus.com>
Wed, 22 Sep 2010 09:05:34 +0100
changeset 6391 47de99b5e40a28bff2aaca2be06b4ef09d897413
parent 6390 ffb9bb96ed39808d688ef8e0a886f7b3b5a454b9
child 6392 3c34cdb6938b9c0f334d4ead075cf7f3198afaa2
push idunknown
push userunknown
push dateunknown
reviewersKaiRo
bugs394502, 585947
Bug 394502/Bug 585947 Switch Thunderbird to a default configuration of libxul with all comm-central libs being linked into libxul. r=KaiRo,feedback=Callek. bustage fix for CLOSED TREE
bridge/bridge.mk
configure.in
directory/xpcom/base/src/Makefile.in
mail/Makefile.in
mail/build.mk
mail/components/build/Makefile.in
mail/components/build/nsMailComponents.h
mail/components/migration/src/Makefile.in
mail/components/shell/Makefile.in
mail/confvars.sh
mail/installer/Makefile.in
mail/installer/package-manifest.in
mail/installer/removed-files.in
mailnews/Makefile.in
mailnews/base/Makefile.in
mailnews/base/public/msgCore.h
mailnews/base/test/Makefile.in
mailnews/build/Makefile.in
mailnews/extensions/smime/build/Makefile.in
mailnews/imap/Makefile.in
mailnews/imap/test/Makefile.in
mailnews/import/Makefile.in
mailnews/import/build/Makefile.in
mailnews/mapi/mapihook/src/Makefile.in
new file mode 100644
--- /dev/null
+++ b/bridge/bridge.mk
@@ -0,0 +1,50 @@
+# ***** 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 the Mozilla build system.
+#
+# The Initial Developer of the Original Code is
+#   Kyle Huey <me@kylehuey.com>
+# Portions created by the Initial Developer are Copyright (C) 2010
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# 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 *****
+
+APP_LIBXUL_DIRS += $(DEPTH)$(SUBDIR)/mozilla/xpfe/components/autocomplete
+
+#ifdef MOZ_LDAP_XPCOM
+APP_LIBXUL_STATICDIRS += $(DEPTH)$(SUBDIR)/directory/c-sdk
+APP_LIBXUL_DIRS += $(DEPTH)$(SUBDIR)/directory/xpcom
+#endif
+
+ifdef MOZ_MAIL_NEWS
+APP_LIBXUL_DIRS += \
+  $(DEPTH)$(SUBDIR)/mailnews/base \
+  $(DEPTH)$(SUBDIR)/mailnews/mime/public \
+  $(DEPTH)$(SUBDIR)/mailnews \
+  $(NULL)
+endif
--- a/configure.in
+++ b/configure.in
@@ -6523,18 +6523,18 @@ if test -n "$MOZ_ENABLE_LIBXUL"; then
     AC_DEFINE(MOZ_ENABLE_LIBXUL)
 else
     if test -n "$BUILD_STATIC_LIBS"; then
         AC_DEFINE(MOZ_STATIC_BUILD)
     fi
     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
 fi
 
-dnl Disable static mail in debug builds, but not with libxul sdk.
-if test -n "$MOZ_DEBUG" -a -z "$LIBXUL_SDK"; then
+dnl Disable static mail in debug builds, but not with libxul.
+if test -n "$MOZ_DEBUG" -a -z "$MOZ_ENABLE_LIBXUL"; then
    MOZ_STATIC_MAIL_BUILD=
 fi
 
 MOZ_ARG_ENABLE_BOOL(static-mail,
 [  --enable-static-mail Enable static mail build support],
     MOZ_STATIC_MAIL_BUILD=1,
     MOZ_STATIC_MAIL_BUILD= )
 
@@ -6720,17 +6720,24 @@ if test "$MOZ_LDAP_XPCOM"; then
         else
             LDAP_LIBS='$(DIST)/lib/$(LIB_PREFIX)nsldap32v60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)nsldappr32v60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)nsldif32v60.${IMPORT_LIB_SUFFIX}'
         fi
     elif test "$OS_ARCH" = "OS2"; then
             LDAP_LIBS='$(DIST)/lib/$(LIB_PREFIX)ldap60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)prldap60.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)ldif60.${IMPORT_LIB_SUFFIX}'
     else
         LDAP_LIBS='-L${DIST}/bin -L${DIST}/lib -lldap60 -lprldap60 -lldif60'
     fi
-fi
+
+    dnl export LDAP_LIBS so that confvars.sh can pick it up, so when we get to
+    dnl linking libxul in the mozilla-central build system, we'll have the LDAP
+    dnl LIBS
+    export LDAP_LIBS
+    export LDAP_COMPONENT=mozldap
+fi
+
 
 dnl ========================================================
 dnl =
 dnl = Maintainer debug option (no --enable equivalent)
 dnl =
 dnl ========================================================
 
 AC_SUBST(AR)
--- a/directory/xpcom/base/src/Makefile.in
+++ b/directory/xpcom/base/src/Makefile.in
@@ -44,16 +44,17 @@ VPATH		= @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= mozldap
 LIBRARY_NAME	= mozldap
 EXPORT_LIBRARY	= 1
 IS_COMPONENT	= 1
 MODULE_NAME	= nsLDAPProtocolModule
 MOZILLA_INTERNAL_API = 1
+LIBXUL_LIBRARY	= 1
 
 EXTRA_COMPONENTS = \
 		nsLDAPProtocolHandler.js \
 		ldapComponents.manifest \
 		$(NULL)
 
 CPPSRCS		= \
 		nsLDAPProtocolModule.cpp \
--- a/mail/Makefile.in
+++ b/mail/Makefile.in
@@ -37,18 +37,24 @@
 
 DEPTH		= ..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(topsrcdir)/config/config.mk
 
+# For non-libxul builds this gets linked into its own library. For libxul
+# builds, the build of components is controlled in mail/build.mk
+ifndef MOZ_ENABLE_LIBXUL
+DIRS += components
+endif
+
 # app is always last as it packages up the built files on mac
-DIRS		= base locales components extensions steel themes jquery app
+DIRS += base locales extensions steel themes jquery app
 
 ifeq ($(OS_ARCH),WINNT)
 ifdef MOZ_INSTALLER
 # though some lasts are more last than others
 DIRS += installer/windows
 endif
 endif
 
--- a/mail/build.mk
+++ b/mail/build.mk
@@ -32,49 +32,51 @@
 # 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 *****
 
 ifndef COMM_BUILD # Mozilla Makefile
 
+ifdef MOZ_ENABLE_LIBXUL
+SUBDIR=/..
+include $(topsrcdir)/../bridge/bridge.mk
+# For libxul builds this gets linked into libxul. For non-libxul
+# builds, the build of components is controlled in mail/Makefile.in
+APP_LIBXUL_DIRS += $(DEPTH)/../mail/components
+endif
+
 ifndef LIBXUL_SDK
 include $(topsrcdir)/toolkit/toolkit-tiers.mk
 endif
 
 TIERS += app
 
-tier_app_dirs += xpfe/components/autocomplete
-
 ifdef MOZ_EXTENSIONS
 tier_app_dirs += extensions
 endif
 
 else # toplevel Makefile
 
-TIERS += app
+ifndef MOZ_ENABLE_LIBXUL
+SUBDIR =
+include $(topsrcdir)/bridge/bridge.mk
+tier_app_staticdirs += $(APP_LIBXUL_STATICDIRS)
+tier_app_dirs += $(APP_LIBXUL_DIRS)
+endif
 
-ifdef MOZ_LDAP_XPCOM
-tier_app_staticdirs += directory/c-sdk
-tier_app_dirs += directory/xpcom
-endif
+TIERS += app
 
 ifdef MOZ_COMPOSER
 tier_app_dirs += editor/ui
 endif
 
 tier_app_dirs += $(MOZ_BRANDING_DIRECTORY)
 
-tier_app_dirs += \
-	mailnews/base \
-	mailnews/mime/public \
-	mailnews \
-	$(NULL)
-
 ifdef MOZ_CALENDAR
 tier_app_dirs += calendar/lightning
 endif
 
 tier_app_dirs += \
 	mail \
 	$(NULL)
 
--- a/mail/components/build/Makefile.in
+++ b/mail/components/build/Makefile.in
@@ -43,23 +43,33 @@ VPATH		= @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= mailcomps
 LIBRARY_NAME	= mailcomps
 SHORT_LIBNAME	= mailcmp
 EXPORT_LIBRARY	= 1
 IS_COMPONENT	= 1
 MODULE_NAME	= nsMailCompsModule
+ifdef MOZ_ENABLE_LIBXUL
+LIBXUL_LIBRARY = 1
+MOZILLA_INTERNAL_API = 1
+FORCE_USE_PIC = 1
+else
 ifdef BUILD_STATIC_LIBS
 MOZILLA_INTERNAL_API = 1
 else
 ifneq ($(MOZ_WIDGET_TOOLKIT), gtk2)
 MOZILLA_INTERNAL_API = 1
 endif
 endif
+endif
+
+ifdef MOZ_ENABLE_LIBXUL
+EXPORTS = nsMailComponents.h
+endif
 
 CPPSRCS = nsMailComps.cpp \
           $(NULL)
 
 ifeq ($(OS_ARCH),WINNT)
 OS_LIBS += $(call EXPAND_LIBNAME,ole32 shell32)
 endif
 
new file mode 100644
--- /dev/null
+++ b/mail/components/build/nsMailComponents.h
@@ -0,0 +1,43 @@
+/* ***** 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 Mail Components.
+ *
+ * The Initial Developer of the Original Code is
+ * the Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Mark Banner <bugzilla@standard8.plus.com>
+ *
+ * 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 ***** */
+
+// When updating this file, please consider if
+// suite/components/nsSuiteComponents.h
+// needs updating to.
+
+#define APP_COMPONENT_MODULES MODULE(xpAutoComplete) MODULE(nsMailModule) MODULE(nsMsgSMIMEModule) MODULE(nsImportServiceModule) MODULE(nsMailCompsModule) MODULE(nsLDAPProtocolModule)
+
--- a/mail/components/migration/src/Makefile.in
+++ b/mail/components/migration/src/Makefile.in
@@ -3,25 +3,24 @@ topsrcdir=@top_srcdir@
 srcdir=@srcdir@
 VPATH=@srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE=mailprofilemigration
 LIBRARY_NAME = profilemigration_s
 MODULE_NAME = nsMailProfileMigratorModule
-ifdef BUILD_STATIC_LIBS
-MOZILLA_INTERNAL_API = 1
-else
+# Linux builds should use external API except when we are building libxul.
 ifneq ($(MOZ_WIDGET_TOOLKIT), gtk2)
 MOZILLA_INTERNAL_API = 1
 endif
+ifdef MOZ_ENABLE_LIBXUL
+MOZILLA_INTERNAL_API = 1
 endif
 
-
 CPPSRCS = \
 	nsProfileMigrator.cpp \
 	nsMailProfileMigratorUtils.cpp \
 	nsNetscapeProfileMigratorBase.cpp \
 	nsSeamonkeyProfileMigrator.cpp \
 	$(NULL)
 
 ifneq ($(OS_ARCH),BeOS)
--- a/mail/components/shell/Makefile.in
+++ b/mail/components/shell/Makefile.in
@@ -44,22 +44,22 @@ include $(DEPTH)/config/autoconf.mk
 
 DIRS = public
 
 DEFINES += -DMOZ_APP_NAME=\"$(MOZ_APP_NAME)\"
 
 MODULE = shellservice
 LIBRARY_NAME = shellservice_s
 MODULE_NAME = nsMailShellModule
-ifdef BUILD_STATIC_LIBS
-MOZILLA_INTERNAL_API = 1
-else
+# Linux builds should use external API except when we are building libxul.
 ifneq ($(MOZ_WIDGET_TOOLKIT), gtk2)
 MOZILLA_INTERNAL_API = 1
 endif
+ifdef MOZ_ENABLE_LIBXUL
+MOZILLA_INTERNAL_API = 1
 endif
 
 EXTRA_COMPONENTS = \
   nsSetDefaultMail.js \
   shell.manifest \
   $(NULL)
 
 ifeq ($(OS_ARCH),WINNT)
--- a/mail/confvars.sh
+++ b/mail/confvars.sh
@@ -48,20 +48,21 @@ if [ "$COMM_BUILD" ]; then
 fi
 MOZ_STATIC_MAIL_BUILD=1
 MOZ_COMPOSER=1
 MOZ_SAFE_BROWSING=1
 MOZ_TOOLKIT_SEARCH=
 MOZ_PLACES=
 MOZ_MORKREADER=
 MOZ_MORK=1
+MOZ_IPC=
+MOZ_STATIC_BUILD_UNSUPPORTED=1
 
 MOZ_APP_VERSION_TXT=${_topsrcdir}/$MOZ_BUILD_APP/config/version.txt
 MOZ_BRANDING_DIRECTORY=mail/branding/nightly
 
 MOZ_APP_VERSION=`cat $MOZ_APP_VERSION_TXT`
 
 THUNDERBIRD_VERSION=$MOZ_APP_VERSION
 MOZ_OFFICIAL_BRANDING_DIRECTORY=other-licenses/branding/thunderbird
-
-# Until we can build with libxul, we can't have ipc either
-MOZ_ENABLE_LIBXUL=
-MOZ_IPC=
+MOZ_APP_COMPONENT_LIBS="mail msgsmime import xpautocomplete mailcomps $LDAP_COMPONENT"
+MOZ_APP_EXTRA_LIBS="$LDAP_LIBS"
+MOZ_APP_COMPONENT_INCLUDE=nsMailComponents.h
--- a/mail/installer/Makefile.in
+++ b/mail/installer/Makefile.in
@@ -80,25 +80,18 @@ endif
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 MOZ_PKG_MAC_DSSTORE=branding/dsstore
 MOZ_PKG_MAC_BACKGROUND=branding/background.png
 MOZ_PKG_MAC_ICON=branding/disk.icns
 MOZ_PKG_MAC_EXTRA=--symlink "/Applications:/ "
 endif
 
-# You do *NOT* want to set MAIL_PKG_SHARED: shared builds are slower at
-# everything except being rebuilt. It only exists so we can package builds
-# where xpcshell will work, to run tests on packaged builds. If you want to
-# package, install, or build an installer, build with --enable-static in your
-# mozconfig instead.
-ifndef MAIL_PKG_SHARED
-ifndef BUILD_STATIC_LIBS
-$(error you need an "--enable-static" build to package a build)
-endif
+ifndef MOZ_ENABLE_LIBXUL
+$(error you need an "--enable-libxul" build to package a build)
 endif
 
 include $(MOZILLA_SRCDIR)/toolkit/mozapps/installer/packager.mk
 
 ifdef MOZ_PKG_PRETTYNAMES
 libs::
 	$(MAKE) -C $(DEPTH)/mail/locales langpack-$(AB_CD)
 
--- a/mail/installer/package-manifest.in
+++ b/mail/installer/package-manifest.in
@@ -31,45 +31,40 @@
 #ifdef XP_WIN32
 @BINPATH@/uninstall/helper.exe
 #endif
 @BINPATH@/update.locale
 @BINPATH@/updater.ini
 
 [xpcom]
 @BINPATH@/@DLL_PREFIX@xpcom@DLL_SUFFIX@
-#ifdef XP_OS2
-@BINPATH@/@DLL_PREFIX@xpcomcor@DLL_SUFFIX@
-#else
-@BINPATH@/@DLL_PREFIX@xpcom_core@DLL_SUFFIX@
-#endif
 @BINPATH@/@DLL_PREFIX@nspr4@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@plc4@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@plds4@DLL_SUFFIX@
 #ifdef MOZ_IPC
 @BINPATH@/mozilla-runtime@BIN_SUFFIX@
 #endif
 @BINPATH@/@DLL_PREFIX@mozjs@DLL_SUFFIX@
-#ifndef XP_WIN32
-@BINPATH@/components/@DLL_PREFIX@jsd@DLL_SUFFIX@
-#else
-@BINPATH@/components/@DLL_PREFIX@jsd3250@DLL_SUFFIX@
-#endif
 #ifdef XP_WIN32
 #ifndef MOZ_MEMORY
 @BINPATH@/Microsoft.VC80.CRT.manifest
 @BINPATH@/msvcm80.dll
 @BINPATH@/msvcp80.dll
 @BINPATH@/msvcr80.dll
 #else
 @BINPATH@/mozcrt19.dll
 @BINPATH@/mozcpp19.dll
 #endif
 #endif
 @BINPATH@/@DLL_PREFIX@mozalloc@DLL_SUFFIX@
+#ifdef XP_MACOSX
+@BINPATH@/XUL
+#else
+@BINPATH@/@DLL_PREFIX@xul@DLL_SUFFIX@
+#endif
 
 ; Modules
 @BINPATH@/modules/*
 
 ; Optional RSS extension
 [newsblog]
 @BINPATH@/chrome/newsblog.jar
 @BINPATH@/chrome/newsblog.manifest
@@ -630,178 +625,8 @@
 #endif
 #endif
 #endif
 
 ; GNOME hooks
 #ifdef MOZ_ENABLE_GNOME_COMPONENT
 @BINPATH@/components/@DLL_PREFIX@mozgnome@DLL_SUFFIX@
 #endif
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-; For packaging shared test builds
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-#ifndef MOZ_STATIC_BUILD
-#ifdef ACCESSIBILITY
-#ifdef XP_OS2
-@BINPATH@/components/@DLL_PREFIX@access@DLL_SUFFIX@
-#else
-@BINPATH@/components/@DLL_PREFIX@accessibility@DLL_SUFFIX@
-#endif
-#endif
-@BINPATH@/components/@DLL_PREFIX@appcomps@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@auth@DLL_SUFFIX@
-#ifdef XP_OS2
-@BINPATH@/components/@DLL_PREFIX@autocfg@DLL_SUFFIX@
-#else
-@BINPATH@/components/@DLL_PREFIX@autoconfig@DLL_SUFFIX@
-#endif
-@BINPATH@/components/@DLL_PREFIX@caps@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@chardet@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@chrome@DLL_SUFFIX@
-#ifdef XP_OS2
-@BINPATH@/components/@DLL_PREFIX@cmdlines@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@gkparser@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@appshell@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@perms@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@spellchk@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@strgcmps@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@tkautoc@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@tkitcmps@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@xpautoc@DLL_SUFFIX@
-#else
-@BINPATH@/components/@DLL_PREFIX@commandlines@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@htmlpars@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@nsappshell@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@permissions@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@spellchecker@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@storagecomps@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@tkautocomplete@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@toolkitcomps@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@xpautocomplete@DLL_SUFFIX@
-#endif
-@BINPATH@/components/@DLL_PREFIX@composer@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@cookie@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@docshell@DLL_SUFFIX@
-#ifdef XP_OS2
-@BINPATH@/components/@DLL_PREFIX@embedcmp@DLL_SUFFIX@
-#else
-@BINPATH@/components/@DLL_PREFIX@embedcomponents@DLL_SUFFIX@
-#endif
-#ifdef XP_OS2
-@BINPATH@/components/@DLL_PREFIX@extnsion@DLL_SUFFIX@
-#else
-@BINPATH@/components/@DLL_PREFIX@extensions@DLL_SUFFIX@
-#endif
-#ifdef UNIX_BUT_NOT_MAC
-@BINPATH@/components/@DLL_PREFIX@fileview@DLL_SUFFIX@
-#endif
-#ifdef XP_OS2
-@BINPATH@/components/@DLL_PREFIX@gkgfxthb@DLL_SUFFIX@
-#else
-@BINPATH@/components/@DLL_PREFIX@gkgfxthebes@DLL_SUFFIX@
-#endif
-@BINPATH@/components/@DLL_PREFIX@gklayout@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@gkplugin@DLL_SUFFIX@
-#ifdef XP_UNIX
-#ifdef XP_MACOSX
-@BINPATH@/components/@DLL_PREFIX@widget_mac@DLL_SUFFIX@
-#else
-@BINPATH@/components/@DLL_PREFIX@widget_gtk2@DLL_SUFFIX@
-#endif
-#else
-#ifdef XP_OS2
-@BINPATH@/components/@DLL_PREFIX@wdgtos2@DLL_SUFFIX@
-#else
-@BINPATH@/components/@DLL_PREFIX@gkwidget@DLL_SUFFIX@
-#endif
-#endif
-@BINPATH@/components/@DLL_PREFIX@i18n@DLL_SUFFIX@
-#ifndef UNIX_BUT_NOT_MAC
-@BINPATH@/components/@DLL_PREFIX@imgicon@DLL_SUFFIX@
-#endif
-@BINPATH@/components/@DLL_PREFIX@imglib2@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@import@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@intlapp@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@jar50@DLL_SUFFIX@
-#ifdef BUILD_CTYPES
-@BINPATH@/components/@DLL_PREFIX@jsctypes@DLL_SUFFIX@
-#endif
-@BINPATH@/components/@DLL_PREFIX@mail@DLL_SUFFIX@
-#ifdef XP_OS2
-@BINPATH@/components/@DLL_PREFIX@mailcmp@DLL_SUFFIX@
-#else
-@BINPATH@/components/@DLL_PREFIX@mailcomps@DLL_SUFFIX@
-#endif
-@BINPATH@/components/@DLL_PREFIX@mork@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@mozfind@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@mozldap@DLL_SUFFIX@
-#ifdef XP_WIN32
-@BINPATH@/components/@DLL_PREFIX@msgMapi@DLL_SUFFIX@
-#endif
-@BINPATH@/components/@DLL_PREFIX@msgsmime@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@necko@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@pipboot@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@pipnss@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@pippki@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@rdf@DLL_SUFFIX@
-#ifdef UNIX_BUT_NOT_MAC
-@BINPATH@/components/@DLL_PREFIX@remoteservice@DLL_SUFFIX@
-#endif
-@BINPATH@/components/@DLL_PREFIX@satchel@DLL_SUFFIX@
-#ifdef UNIX_BUT_NOT_MAC
-@BINPATH@/components/@DLL_PREFIX@system-pref@DLL_SUFFIX@
-#endif
-@BINPATH@/components/@DLL_PREFIX@txmgr@DLL_SUFFIX@
-#ifdef XP_OS2
-@BINPATH@/components/@DLL_PREFIX@mozuconv@DLL_SUFFIX@
-#else
-@BINPATH@/components/@DLL_PREFIX@uconv@DLL_SUFFIX@
-#endif
-@BINPATH@/components/@DLL_PREFIX@ucvmath@DLL_SUFFIX@
-#ifdef XP_OS2
-@BINPATH@/components/@DLL_PREFIX@ucdet@DLL_SUFFIX@
-#else
-@BINPATH@/components/@DLL_PREFIX@universalchardet@DLL_SUFFIX@
-#endif
-#ifndef XP_OS2
-#ifdef XP_UNIX
-#ifndef XP_MACOSX
-@BINPATH@/components/@DLL_PREFIX@unixproxy@DLL_SUFFIX@
-#else
-@BINPATH@/components/@DLL_PREFIX@osxproxy@DLL_SUFFIX@
-#endif
-#else
-@BINPATH@/components/@DLL_PREFIX@windowsproxy@DLL_SUFFIX@
-#endif
-#endif
-@BINPATH@/components/@DLL_PREFIX@webbrwsr@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@windowds@DLL_SUFFIX@
-#ifdef XP_WIN32
-@BINPATH@/components/@DLL_PREFIX@xpc3250@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@xppref32@DLL_SUFFIX@
-#elifdef XP_OS2
-@BINPATH@/components/@DLL_PREFIX@xpconect@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@pref@DLL_SUFFIX@
-#else
-@BINPATH@/components/@DLL_PREFIX@xpconnect@DLL_SUFFIX@
-@BINPATH@/components/@DLL_PREFIX@pref@DLL_SUFFIX@
-#endif
-#ifdef XP_OS2
-@BINPATH@/components/@DLL_PREFIX@zipwrite@DLL_SUFFIX@
-#else
-@BINPATH@/components/@DLL_PREFIX@zipwriter@DLL_SUFFIX@
-#endif
-@BINPATH@/@DLL_PREFIX@angle@DLL_SUFFIX@
-@BINPATH@/@DLL_PREFIX@gkgfx@DLL_SUFFIX@
-#ifdef UNIX_BUT_NOT_MAC
-@BINPATH@/@DLL_PREFIX@gfxpsshar@DLL_SUFFIX@
-@BINPATH@/@DLL_PREFIX@gtkxtbin@DLL_SUFFIX@
-#endif
-@BINPATH@/@DLL_PREFIX@mozz@DLL_SUFFIX@
-@BINPATH@/@DLL_PREFIX@thebes@DLL_SUFFIX@
-#ifdef XP_MACOSX
-@BINPATH@/XUL
-#else
-@BINPATH@/@DLL_PREFIX@xul@DLL_SUFFIX@
-#endif
-#endif
--- a/mail/installer/removed-files.in
+++ b/mail/installer/removed-files.in
@@ -90,16 +90,21 @@ components/walletpreview.xpt
 components/@DLL_PREFIX@walletviewers@DLL_SUFFIX@
 #ifndef MOZ_WEBSERVICES
   components/websrvcs.xpt
 #endif
 #ifdef XP_MACOSX
   components/widget_mac.xpt
 #endif
 components/@DLL_PREFIX@xpcom_compat_c@DLL_SUFFIX@
+#ifdef XP_OS2
+  components/@DLL_PREFIX@xpcomcor@DLL_SUFFIX@
+#else
+  components/@DLL_PREFIX@xpcom_core@DLL_SUFFIX@
+#endif
 components/xpcom_obsolete.xpt
 components/xpinstall.xpt
 components/@DLL_PREFIX@xpinstal@DLL_SUFFIX@
 components/@DLL_PREFIX@xpinstall@DLL_SUFFIX@
 components/xpti.dat
 components/xptitemp.dat
 components/myspell/en-US.dic
 components/myspell/en-US.aff
@@ -403,135 +408,135 @@ mozABConduit.dll
 components/palmsync.dll
 components/palmSync.xpt
 # ****************************************************************************
 # * End pre-extensions PalmSync files.                                       *
 # ****************************************************************************
 
 # ****************************************************************************
 # * The first of two chunks of removing shared libraries: this removes the   *
-# * current shared libraries if we are going from a current shared build to  *
-# * a static build; the next removes the Windows dlls that were present when *
-* * we switched to static builds by default, in 2004-05. If a new library is *
+# * shared libraries if we are going from a current shared build to a static *
+# * build, although unlikely, we'll keep them in here anyway.                *
+# * The next removes the Windows dlls that were present when                 *
+# * we switched to static builds by default, in 2004-05. If a new library is *
 # * added, it should be added here, if a library is removed, the dll should  *
 # * be added below if it was present in 2004.                                *
 # ****************************************************************************
-#ifdef MOZ_STATIC_BUILD
-  components/@DLL_PREFIX@accessibility@DLL_SUFFIX@
-  components/@DLL_PREFIX@appshell@DLL_SUFFIX@
-  components/@DLL_PREFIX@auth@DLL_SUFFIX@
-  components/@DLL_PREFIX@autoconfig@DLL_SUFFIX@
-  components/@DLL_PREFIX@caps@DLL_SUFFIX@
-  components/@DLL_PREFIX@chardet@DLL_SUFFIX@
-  components/@DLL_PREFIX@chrome@DLL_SUFFIX@
-  #ifdef XP_WIN
-    components/@DLL_PREFIX@cmdlines@DLL_SUFFIX@
-  #else
-    components/@DLL_PREFIX@commandlines@DLL_SUFFIX@
-  #endif
-  components/@DLL_PREFIX@composer@DLL_SUFFIX@
-  components/@DLL_PREFIX@cookie@DLL_SUFFIX@
-  components/@DLL_PREFIX@docshell@DLL_SUFFIX@
-  components/@DLL_PREFIX@embedcomponents@DLL_SUFFIX@
-  components/@DLL_PREFIX@fileview@DLL_SUFFIX@
-  components/@DLL_PREFIX@gkgfxthebes@DLL_SUFFIX@
-  components/@DLL_PREFIX@gklayout@DLL_SUFFIX@
-  components/@DLL_PREFIX@gkplugin@DLL_SUFFIX@
-  components/@DLL_PREFIX@gkwidget@DLL_SUFFIX@
+components/@DLL_PREFIX@accessibility@DLL_SUFFIX@
+components/@DLL_PREFIX@appshell@DLL_SUFFIX@
+components/@DLL_PREFIX@auth@DLL_SUFFIX@
+components/@DLL_PREFIX@autoconfig@DLL_SUFFIX@
+components/@DLL_PREFIX@caps@DLL_SUFFIX@
+components/@DLL_PREFIX@chardet@DLL_SUFFIX@
+components/@DLL_PREFIX@chrome@DLL_SUFFIX@
+#ifdef XP_WIN
+  components/@DLL_PREFIX@cmdlines@DLL_SUFFIX@
+#else
+  components/@DLL_PREFIX@commandlines@DLL_SUFFIX@
+#endif
+components/@DLL_PREFIX@composer@DLL_SUFFIX@
+components/@DLL_PREFIX@cookie@DLL_SUFFIX@
+components/@DLL_PREFIX@docshell@DLL_SUFFIX@
+components/@DLL_PREFIX@embedcomponents@DLL_SUFFIX@
+components/@DLL_PREFIX@fileview@DLL_SUFFIX@
+components/@DLL_PREFIX@gkgfxthebes@DLL_SUFFIX@
+components/@DLL_PREFIX@gklayout@DLL_SUFFIX@
+components/@DLL_PREFIX@gkplugin@DLL_SUFFIX@
+components/@DLL_PREFIX@gkwidget@DLL_SUFFIX@
+#ifdef XP_WIN
+  components/@DLL_PREFIX@gkparser@DLL_SUFFIX@
+#else
+  components/@DLL_PREFIX@htmlpars@DLL_SUFFIX@
+#endif
+components/@DLL_PREFIX@i18n@DLL_SUFFIX@
+components/@DLL_PREFIX@imgicon@DLL_SUFFIX@
+components/@DLL_PREFIX@imglib2@DLL_SUFFIX@
+components/@DLL_PREFIX@import@DLL_SUFFIX@
+components/@DLL_PREFIX@intlapp@DLL_SUFFIX@
+components/@DLL_PREFIX@jar50@DLL_SUFFIX@
+#ifndef XP_WIN
+  components/@DLL_PREFIX@jsd@DLL_SUFFIX@
+#else
+  components/@DLL_PREFIX@jsd3250@DLL_SUFFIX@
+#endif
+components/@DLL_PREFIX@mail@DLL_SUFFIX@
+#ifdef XP_OS2
+  components/@DLL_PREFIX@mailcmp@DLL_SUFFIX@
+#else
   #ifdef XP_WIN
-    components/@DLL_PREFIX@gkparser@DLL_SUFFIX@
-  #else
-    components/@DLL_PREFIX@htmlpars@DLL_SUFFIX@
-  #endif
-  components/@DLL_PREFIX@i18n@DLL_SUFFIX@
-  components/@DLL_PREFIX@imgicon@DLL_SUFFIX@
-  components/@DLL_PREFIX@imglib2@DLL_SUFFIX@
-  components/@DLL_PREFIX@import@DLL_SUFFIX@
-  components/@DLL_PREFIX@intlapp@DLL_SUFFIX@
-  components/@DLL_PREFIX@jar50@DLL_SUFFIX@
-  components/@DLL_PREFIX@mail@DLL_SUFFIX@
-  #ifdef XP_OS2
     components/@DLL_PREFIX@mailcmp@DLL_SUFFIX@
-  #else
-    #ifdef XP_WIN
-      components/@DLL_PREFIX@mailcmp@DLL_SUFFIX@
-    #endif
-    components/@DLL_PREFIX@mailcomps@DLL_SUFFIX@
-  #endif
-  components/@DLL_PREFIX@mork@DLL_SUFFIX@
-  components/@DLL_PREFIX@mozfind@DLL_SUFFIX@
-  components/@DLL_PREFIX@mozldap@DLL_SUFFIX@
-  components/@DLL_PREFIX@msgMapi@DLL_SUFFIX@
-  components/@DLL_PREFIX@msgsmime@DLL_SUFFIX@
-  components/@DLL_PREFIX@necko@DLL_SUFFIX@
-  #ifdef XP_WIN
-    components/@DLL_PREFIX@appshell@DLL_SUFFIX@
-    components/@DLL_PREFIX@perms@DLL_SUFFIX@
-  #else
-    components/@DLL_PREFIX@nsappshell@DLL_SUFFIX@
-    components/@DLL_PREFIX@permissions@DLL_SUFFIX@
   #endif
-  components/@DLL_PREFIX@pipboot@DLL_SUFFIX@
-  components/@DLL_PREFIX@pipnss@DLL_SUFFIX@
-  components/@DLL_PREFIX@pippki@DLL_SUFFIX@
-  #ifdef XP_WIN
-    components/@DLL_PREFIX@xppref32@DLL_SUFFIX@
-  #else
-    components/@DLL_PREFIX@pref@DLL_SUFFIX@
-  #endif
-  components/@DLL_PREFIX@rdf@DLL_SUFFIX@
-  components/@DLL_PREFIX@remoteservice@DLL_SUFFIX@
-  #ifdef XP_WIN
-    components/@DLL_PREFIX@spellchk@DLL_SUFFIX@
-    components/@DLL_PREFIX@strgcmps@DLL_SUFFIX@
-  #else
-    components/@DLL_PREFIX@spellchecker@DLL_SUFFIX@
-    components/@DLL_PREFIX@storagecomps@DLL_SUFFIX@
-  #endif
-  components/@DLL_PREFIX@system-pref@DLL_SUFFIX@
-  #ifdef XP_WIN
-    components/@DLL_PREFIX@tkautoc@DLL_SUFFIX@
-    components/@DLL_PREFIX@tkitcmps@DLL_SUFFIX@
-  #else
-    components/@DLL_PREFIX@tkautocomplete@DLL_SUFFIX@
-    components/@DLL_PREFIX@toolkitcomps@DLL_SUFFIX@
-  #endif
-  components/@DLL_PREFIX@txmgr@DLL_SUFFIX@
-  components/@DLL_PREFIX@uconv@DLL_SUFFIX@
-  components/@DLL_PREFIX@ucvmath@DLL_SUFFIX@
-  components/@DLL_PREFIX@universalchardet@DLL_SUFFIX@
-  components/@DLL_PREFIX@unixproxy@DLL_SUFFIX@
-  components/@DLL_PREFIX@osxproxy@DLL_SUFFIX@
-  components/@DLL_PREFIX@webbrwsr@DLL_SUFFIX@
-  components/@DLL_PREFIX@widget_gtk2@DLL_SUFFIX@
-  components/@DLL_PREFIX@widget_mac@DLL_SUFFIX@
-  components/@DLL_PREFIX@gkwidget@DLL_SUFFIX@
-  components/@DLL_PREFIX@windowds@DLL_SUFFIX@
-  #ifdef XP_WIN
-    components/@DLL_PREFIX@xpautoc@DLL_SUFFIX@
-    components/@DLL_PREFIX@xpc3250@DLL_SUFFIX@
-  #else
-    components/@DLL_PREFIX@xpautocomplete@DLL_SUFFIX@
-    components/@DLL_PREFIX@xpconnect@DLL_SUFFIX@
-  #endif
-  components/@DLL_PREFIX@zipwriter@DLL_SUFFIX@
-  @DLL_PREFIX@gfxpsshar@DLL_SUFFIX@
-  @DLL_PREFIX@gkgfx@DLL_SUFFIX@
-  @DLL_PREFIX@gtkxtbin@DLL_SUFFIX@
-  @DLL_PREFIX@mozz@DLL_SUFFIX@
-  @DLL_PREFIX@thebes@DLL_SUFFIX@
-  #ifdef XP_WIN
-    xpcshell.exe
-  #else
-    xpcshell
-  #endif
-  @DLL_PREFIX@xul@DLL_SUFFIX@
-  #ifdef XP_MACOSX
-    XUL
-  #endif
+  components/@DLL_PREFIX@mailcomps@DLL_SUFFIX@
+#endif
+components/@DLL_PREFIX@mork@DLL_SUFFIX@
+components/@DLL_PREFIX@mozfind@DLL_SUFFIX@
+components/@DLL_PREFIX@mozldap@DLL_SUFFIX@
+components/@DLL_PREFIX@msgMapi@DLL_SUFFIX@
+components/@DLL_PREFIX@msgsmime@DLL_SUFFIX@
+components/@DLL_PREFIX@necko@DLL_SUFFIX@
+#ifdef XP_WIN
+  components/@DLL_PREFIX@appshell@DLL_SUFFIX@
+  components/@DLL_PREFIX@perms@DLL_SUFFIX@
+#else
+  components/@DLL_PREFIX@nsappshell@DLL_SUFFIX@
+  components/@DLL_PREFIX@permissions@DLL_SUFFIX@
+#endif
+components/@DLL_PREFIX@pipboot@DLL_SUFFIX@
+components/@DLL_PREFIX@pipnss@DLL_SUFFIX@
+components/@DLL_PREFIX@pippki@DLL_SUFFIX@
+#ifdef XP_WIN
+  components/@DLL_PREFIX@xppref32@DLL_SUFFIX@
+#else
+  components/@DLL_PREFIX@pref@DLL_SUFFIX@
+#endif
+components/@DLL_PREFIX@rdf@DLL_SUFFIX@
+components/@DLL_PREFIX@remoteservice@DLL_SUFFIX@
+#ifdef XP_WIN
+  components/@DLL_PREFIX@spellchk@DLL_SUFFIX@
+  components/@DLL_PREFIX@strgcmps@DLL_SUFFIX@
+#else
+  components/@DLL_PREFIX@spellchecker@DLL_SUFFIX@
+  components/@DLL_PREFIX@storagecomps@DLL_SUFFIX@
+#endif
+components/@DLL_PREFIX@system-pref@DLL_SUFFIX@
+#ifdef XP_WIN
+  components/@DLL_PREFIX@tkautoc@DLL_SUFFIX@
+  components/@DLL_PREFIX@tkitcmps@DLL_SUFFIX@
+#else
+  components/@DLL_PREFIX@tkautocomplete@DLL_SUFFIX@
+  components/@DLL_PREFIX@toolkitcomps@DLL_SUFFIX@
+#endif
+components/@DLL_PREFIX@txmgr@DLL_SUFFIX@
+components/@DLL_PREFIX@uconv@DLL_SUFFIX@
+components/@DLL_PREFIX@ucvmath@DLL_SUFFIX@
+components/@DLL_PREFIX@universalchardet@DLL_SUFFIX@
+components/@DLL_PREFIX@unixproxy@DLL_SUFFIX@
+components/@DLL_PREFIX@osxproxy@DLL_SUFFIX@
+components/@DLL_PREFIX@webbrwsr@DLL_SUFFIX@
+components/@DLL_PREFIX@widget_gtk2@DLL_SUFFIX@
+components/@DLL_PREFIX@widget_mac@DLL_SUFFIX@
+components/@DLL_PREFIX@gkwidget@DLL_SUFFIX@
+components/@DLL_PREFIX@windowds@DLL_SUFFIX@
+#ifdef XP_WIN
+  components/@DLL_PREFIX@xpautoc@DLL_SUFFIX@
+  components/@DLL_PREFIX@xpc3250@DLL_SUFFIX@
+#else
+  components/@DLL_PREFIX@xpautocomplete@DLL_SUFFIX@
+  components/@DLL_PREFIX@xpconnect@DLL_SUFFIX@
+#endif
+components/@DLL_PREFIX@zipwriter@DLL_SUFFIX@
+@DLL_PREFIX@gfxpsshar@DLL_SUFFIX@
+@DLL_PREFIX@gkgfx@DLL_SUFFIX@
+@DLL_PREFIX@gtkxtbin@DLL_SUFFIX@
+@DLL_PREFIX@mozz@DLL_SUFFIX@
+@DLL_PREFIX@thebes@DLL_SUFFIX@
+#ifdef XP_WIN
+  xpcshell.exe
+#else
+  xpcshell
 #endif
 # ****************************************************************************
 # * End removing current shared libraries                                    *
 # ****************************************************************************
 
 # ****************************************************************************
 # * Remove the DLLs that were present at the time (2004-05) when we started  *
 # * shipping static builds on Windows, except for current shared libraries,  *
--- a/mailnews/Makefile.in
+++ b/mailnews/Makefile.in
@@ -61,17 +61,17 @@ PARALLEL_DIRS	+= \
 ifdef ENABLE_TESTS
 PARALLEL_DIRS += \
   test/performance/bloat \
   $(NULL)
 endif
 
 ifeq ($(OS_ARCH),WINNT)
 ifndef GNU_CC
-PARALLEL_DIRS	+= mapi/mapiDLL mapi/mapihook
+TOOL_DIRS += mapi/mapiDLL mapi/mapihook
 endif
 endif
 
 ifdef MOZ_STATIC_MAIL_BUILD
 DIRS += build
 else
 DIRS += base/build
 endif
--- a/mailnews/base/Makefile.in
+++ b/mailnews/base/Makefile.in
@@ -44,13 +44,13 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msgbase
 
 PARALLEL_DIRS	= public src util ispdata
 
 DIRS		= search/public
 
 ifdef ENABLE_TESTS
-DIRS += test
+TOOL_DIRS += test
 endif
 
 include $(topsrcdir)/config/rules.mk
 
--- a/mailnews/base/public/msgCore.h
+++ b/mailnews/base/public/msgCore.h
@@ -199,17 +199,17 @@ NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODUL
 #if defined(XP_WIN) || defined(XP_OS2)
 #define MSG_LINEBREAK "\015\012"
 #define MSG_LINEBREAK_LEN 2
 #else
 #define MSG_LINEBREAK "\012"
 #define MSG_LINEBREAK_LEN 1
 #endif
 
-#ifdef MOZ_STATIC_MAIL_BUILD
+#if defined(MOZ_STATIC_MAIL_BUILD) || defined(MOZ_ENABLE_LIBXUL)
 #define NS_MSG_BASE
 #define NS_MSG_BASE_STATIC_MEMBER_(type) type
 #else
 
 #ifdef _IMPL_NS_MSG_BASE
 #define NS_MSG_BASE                      NS_EXPORT
 #define NS_MSG_BASE_STATIC_MEMBER_(type) NS_EXPORT_STATIC_MEMBER_(type)
 #else
--- a/mailnews/base/test/Makefile.in
+++ b/mailnews/base/test/Makefile.in
@@ -40,46 +40,49 @@
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir = mailnews/base/test
 
 include $(DEPTH)/config/autoconf.mk
 
+ifndef MOZ_ENABLE_LIBXUL
 ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
 endif
 
-
+# XXX This needs functions exporting in the libxul case.
 CPP_UNIT_TESTS = \
     TestMsgStripRE.cpp \
     $(NULL)
+endif
 
 include $(topsrcdir)/config/config.mk
 
 XPCSHELL_TESTS = unit
 
 include $(topsrcdir)/config/rules.mk
 
 LOCAL_INCLUDES = \
     -I$(MOZILLA_SRCDIR)/xpcom/tests \
     $(NULL)
 
 ifndef MOZILLA_INTERNAL_API
 LIBS += $(XPCOM_GLUE_LDOPTS)
 endif
 
-LIBS +=   \
-    $(NULL)
-
+ifdef MOZ_ENABLE_LIBXUL
+LIBS += $(XPCOM_LIBS)
+else
 ifdef MOZ_STATIC_MAIL_BUILD
 LIBS +=   \
     ../../base/util/$(LIB_PREFIX)msgbsutl_s.$(LIB_SUFFIX) \
     $(NULL)
 else
 LIBS +=   $(call EXPAND_LIBNAME_PATH,msgbaseutil,../../base/util)
 endif
+endif
 
 LIBS +=   \
   $(XPCOM_LIBS) \
   $(NSPR_LIBS) \
   $(NULL)
--- a/mailnews/build/Makefile.in
+++ b/mailnews/build/Makefile.in
@@ -52,16 +52,18 @@ endif
 endif
 
 META_COMPONENT = mail
 
 EXPORT_LIBRARY = 1
 
 IS_COMPONENT	= 1
 MOZILLA_INTERNAL_API = 1
+GRE_MODULE	= 1
+LIBXUL_LIBRARY	= 1
 
 MODULE_NAME	= nsMailModule
 
 ifdef MOZ_LDAP_XPCOM
 DEFINES		+= -DMOZ_LDAP_XPCOM
 endif
 
 ifeq ($(OS_ARCH),WINNT)
--- a/mailnews/extensions/smime/build/Makefile.in
+++ b/mailnews/extensions/smime/build/Makefile.in
@@ -46,16 +46,17 @@ MODULE		= msgsmime
 LIBRARY_NAME	= msgsmime
 META_COMPONENT = mail
 EXPORT_LIBRARY = 1
 IS_COMPONENT	= 1
 MODULE_NAME	= nsMsgSMIMEModule
 ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
 endif
+LIBXUL_LIBRARY = 1
 
 
 ifndef MOZ_STATIC_MAIL_BUILD
 
 EXTRA_DSO_LIBS = msgbaseutil
 
 endif
 
--- a/mailnews/imap/Makefile.in
+++ b/mailnews/imap/Makefile.in
@@ -46,13 +46,13 @@ MODULE		= msgimap
 
 PARALLEL_DIRS	= public src
 
 ifndef MOZ_STATIC_MAIL_BUILD
 DIRS = build
 endif
 
 ifdef ENABLE_TESTS
-DIRS += test
+TOOL_DIRS += test
 endif
 
 include $(topsrcdir)/config/rules.mk
 
--- a/mailnews/imap/test/Makefile.in
+++ b/mailnews/imap/test/Makefile.in
@@ -40,24 +40,27 @@
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir = mailnews/imap/test
 
 include $(DEPTH)/config/autoconf.mk
 
+ifndef MOZ_ENABLE_LIBXUL
 ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
 endif
 
+# XXX This needs functions exporting in the libxul case.
 CPP_UNIT_TESTS = \
 		TestImapHdrXferInfo.cpp \
 		TestImapFlagAndUidState.cpp \
 		$(NULL)
+endif
 
 include $(topsrcdir)/config/config.mk
 
 XPCSHELL_TESTS = unit
 
 include $(topsrcdir)/config/rules.mk
 
 LOCAL_INCLUDES = \
--- a/mailnews/import/Makefile.in
+++ b/mailnews/import/Makefile.in
@@ -53,14 +53,14 @@ endif
 ifeq ($(OS_ARCH),WINNT)
 PARALLEL_DIRS	+= eudora/src
 ifndef GNU_CC
 PARALLEL_DIRS	+= oexpress outlook/src winlivemail
 endif
 endif
 
 ifdef ENABLE_TESTS
-PARALLEL_DIRS	+= test
+TOOL_DIRS += test
 endif
 
 DIRS = build
 
 include $(topsrcdir)/config/rules.mk
--- a/mailnews/import/build/Makefile.in
+++ b/mailnews/import/build/Makefile.in
@@ -45,16 +45,17 @@ include $(DEPTH)/config/autoconf.mk
 MODULE = import
 LIBRARY_NAME = import
 META_COMPONENT = mail
 EXPORT_LIBRARY = 1
 IS_COMPONENT	= 1
 ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
 endif
+LIBXUL_LIBRARY = 1
 
 MODULE_NAME	= nsImportServiceModule
 
 CPPSRCS		=  nsImportModule.cpp
 
 SHARED_LIBRARY_LIBS = \
 		../src/$(LIB_PREFIX)import_s.$(LIB_SUFFIX) \
 		../text/src/$(LIB_PREFIX)imptext_s.$(LIB_SUFFIX) \
--- a/mailnews/mapi/mapihook/src/Makefile.in
+++ b/mailnews/mapi/mapihook/src/Makefile.in
@@ -43,16 +43,17 @@ VPATH		= @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= msgMapi
 LIBRARY_NAME	= $(MODULE)
 MODULE_NAME	= msgMapiModule
 EXPORT_LIBRARY  = 1
 IS_COMPONENT	= 1
 META_COMPONENT	= mail
+LIBXUL_LIBRARY  = 1
 ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 MOZILLA_INTERNAL_API = 1
 endif
 
 
 CPPSRCS		= \
 		msgMapiFactory.cpp \
 		msgMapiHook.cpp \