Bug 562313 - Statically link binary browser components into firefox.exe, r=ted
☠☠ backed out by 4bbe896fbc03 ☠ ☠
authorBenjamin Smedberg <benjamin@smedbergs.us>
Fri, 27 Aug 2010 22:09:23 +0000
changeset 51611 7c0438df676786d8fa91cea905fb4d6371c404dd
parent 51610 895362d682038cf017b8f26da872d81a5a4bdca3
child 51612 d8d15133068723736f55c9bfa61650e48c97b3d1
child 51617 4bbe896fbc0394cc59dd539097d56536c30ddedd
push idunknown
push userunknown
push dateunknown
reviewersted
bugs562313
milestone2.0b5pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 562313 - Statically link binary browser components into firefox.exe, r=ted
browser/app/Makefile.in
browser/app/nsBrowserApp.cpp
browser/components/build/Makefile.in
browser/components/build/nsModule.cpp
browser/components/dirprovider/Makefile.in
browser/installer/Makefile.in
browser/installer/package-manifest.in
browser/installer/removed-files.in
--- a/browser/app/Makefile.in
+++ b/browser/app/Makefile.in
@@ -87,16 +87,22 @@ else
 ifneq (,$(filter OS2 WINCE WINNT,$(OS_ARCH)))
 PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
 else
 PROGRAM = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
 endif
 
 CPPSRCS = nsBrowserApp.cpp
 
+LIBS += \
+  $(call EXPAND_LIBNAME_PATH,browsercomps,../components/build) \
+  $(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
+  $(LIBXUL_DIST)/lib/$(LIB_PREFIX)mozreg_s.$(LIB_SUFFIX) \
+  $(NULL)
+
 LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
 
 ifdef BUILD_STATIC_LIBS
 ifdef _MSC_VER
 STATIC_COMPONENTS_LINKER_PATH = -LIBPATH:$(DEPTH)/staticlib
 else
 STATIC_COMPONENTS_LINKER_PATH = -L$(DEPTH)/staticlib
 endif
--- a/browser/app/nsBrowserApp.cpp
+++ b/browser/app/nsBrowserApp.cpp
@@ -101,16 +101,18 @@ static PRBool IsArg(const char* arg, con
  */
 class ScopedLogging
 {
 public:
   ScopedLogging() { NS_LogInit(); }
   ~ScopedLogging() { NS_LogTerm(); }
 };
 
+extern const mozilla::Module kBrowserModule;
+
 int main(int argc, char* argv[])
 {
   ScopedLogging log;
 
   nsCOMPtr<nsILocalFile> appini;
   nsresult rv = XRE_GetBinaryPath(argv[0], getter_AddRefs(appini));
   if (NS_FAILED(rv)) {
     Output("Couldn't calculate the application directory.");
@@ -150,14 +152,16 @@ int main(int argc, char* argv[])
 
   nsXREAppData *appData;
   rv = XRE_CreateAppData(appini, &appData);
   if (NS_FAILED(rv)) {
     Output("Couldn't read application.ini");
     return 255;
   }
 
+  XRE_AddStaticComponent(&kBrowserModule);
+
   int result = XRE_main(argc, argv, appData);
   XRE_FreeAppData(appData);
   if (appEnv)
     PR_smprintf_free(appEnv);
   return result;
 }
--- a/browser/components/build/Makefile.in
+++ b/browser/components/build/Makefile.in
@@ -2,28 +2,25 @@ DEPTH=../../..
 topsrcdir=@top_srcdir@
 srcdir=@srcdir@
 VPATH=@srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = browsercomps
 LIBRARY_NAME = browsercomps
-SHORT_LIBNAME = brwsrcmp
+
+ifdef LIBXUL_SDK
 IS_COMPONENT = 1
-MODULE_NAME = nsBrowserCompsModule
 FORCE_SHARED_LIB = 1
-
-# Because we are an application component, link against the CRT statically
-# (on Windows, but only if we're not building our own CRT for jemalloc)
-ifndef MOZ_MEMORY
-USE_STATIC_LIBS = 1
+else
+FORCE_STATIC_LIB = 1
+DEFINES += -DBROWSERCOMPS_LINK_STATICALLY
 endif
 
-
 EXPORTS = nsBrowserCompsCID.h
 
 CPPSRCS = nsModule.cpp \
           $(NULL)
 
 ifeq ($(OS_ARCH),WINNT)
 OS_LIBS	+= $(call EXPAND_LIBNAME,ole32 shell32)
 endif
--- a/browser/components/build/nsModule.cpp
+++ b/browser/components/build/nsModule.cpp
@@ -232,17 +232,18 @@ static const mozilla::Module::ContractID
 };
 
 static const mozilla::Module::CategoryEntry kBrowserCategories[] = {
     { XPCOM_DIRECTORY_PROVIDER_CATEGORY, "browser-directory-provider", NS_BROWSERDIRECTORYPROVIDER_CONTRACTID },
     { NS_CONTENT_SNIFFER_CATEGORY, "Feed Sniffer", NS_FEEDSNIFFER_CONTRACTID },
     { NULL }
 };
 
-static const mozilla::Module kBrowserModule = {
+extern const mozilla::Module kBrowserModule = {
     mozilla::Module::kVersion,
     kBrowserCIDs,
     kBrowserContracts,
     kBrowserCategories
 };
 
+#ifndef BROWSERCOMPS_LINK_STATICALLY
 NSMODULE_DEFN(nsBrowserCompsModule) = &kBrowserModule;
-
+#endif
--- a/browser/components/dirprovider/Makefile.in
+++ b/browser/components/dirprovider/Makefile.in
@@ -58,14 +58,9 @@ endif
 
 EXPORTS_NAMESPACES = mozilla/browser
 EXPORTS_mozilla/browser = DirectoryProvider.h
 
 CPPSRCS = DirectoryProvider.cpp
 
 LOCAL_INCLUDES = -I$(srcdir)/../build
 
-EXTRA_DSO_LDOPTS = \
-	$(XPCOM_GLUE_LDOPTS) \
-	$(NSPR_LIBS) \
-	$(NULL)
-
 include $(topsrcdir)/config/rules.mk
--- a/browser/installer/Makefile.in
+++ b/browser/installer/Makefile.in
@@ -105,16 +105,18 @@ 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
 
 ifndef LIBXUL_SDK
 INSTALL_SDK = 1
+else
+DEFINES += -DLIBXUL_SDK=1
 endif
 
 include $(topsrcdir)/toolkit/mozapps/installer/packager.mk
 
 ifeq (bundle, $(MOZ_FS_LAYOUT))
 BINPATH = $(_BINPATH)
 DEFINES += -DAPPNAME=$(_APPNAME)
 else
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -329,20 +329,18 @@
 @BINPATH@/components/nsUpdateTimerManager.manifest
 @BINPATH@/components/nsUpdateTimerManager.js
 @BINPATH@/components/pluginGlue.manifest
 @BINPATH@/components/nsSessionStore.manifest
 @BINPATH@/components/nsSessionStartup.js
 @BINPATH@/components/nsSessionStore.js
 @BINPATH@/components/nsURLFormatter.manifest
 @BINPATH@/components/nsURLFormatter.js
-#ifndef XP_OS2
+#ifdef LIBXUL_SDK
 @BINPATH@/components/@DLL_PREFIX@browsercomps@DLL_SUFFIX@
-#else
-@BINPATH@/components/brwsrcmp@DLL_SUFFIX@
 #endif
 @BINPATH@/components/txEXSLTRegExFunctions.manifest
 @BINPATH@/components/txEXSLTRegExFunctions.js
 @BINPATH@/components/toolkitplaces.manifest
 @BINPATH@/components/nsLivemarkService.js
 @BINPATH@/components/nsTaggingService.js
 @BINPATH@/components/nsPlacesDBFlush.js
 @BINPATH@/components/nsPlacesAutoComplete.manifest
--- a/browser/installer/removed-files.in
+++ b/browser/installer/removed-files.in
@@ -32,16 +32,19 @@ chrome/m3ffxtbr.manifest
 chrome/overlayinfo/
 chrome/pippki.manifest
 chrome/reporter.jar
 chrome/reporter.manifest
 chrome/toolkit.manifest
 component.reg
 components/browser.manifest
 components/components.list
+#ifndef LIBXUL_SDK
+components/@DLL_PREFIX@browsercomps@DLL_SUFFIX@
+#endif
 components/@DLL_PREFIX@browserdirprovider@DLL_SUFFIX@
 components/@DLL_PREFIX@brwsrdir@DLL_SUFFIX@
 components/@DLL_PREFIX@myspell@DLL_SUFFIX@
 components/@DLL_PREFIX@spellchecker@DLL_SUFFIX@
 components/@DLL_PREFIX@spellchk@DLL_SUFFIX@
 components/aboutCertError.js
 components/aboutPrivateBrowsing.js
 components/aboutRights.js