Bug 376041 - Link browser components against the CRT statically (on Windows), to solve CRT embedding issues, r=luser
--- a/browser/components/bookmarks/src/Makefile.in
+++ b/browser/components/bookmarks/src/Makefile.in
@@ -41,16 +41,17 @@ srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = bookmarks
LIBRARY_NAME = bookmarks_s
FORCE_STATIC_LIB = 1
FORCE_USE_PIC = 1
+USE_STATIC_LIBS = 1
REQUIRES = xpcom \
string \
rdf \
widget \
necko \
nkcache \
uconv \
--- a/browser/components/build/Makefile.in
+++ b/browser/components/build/Makefile.in
@@ -7,16 +7,20 @@ include $(DEPTH)/config/autoconf.mk
MODULE = browsercomps
LIBRARY_NAME = browsercomps
SHORT_LIBNAME = brwsrcmp
IS_COMPONENT = 1
MODULE_NAME = nsBrowserCompsModule
FORCE_SHARED_LIB = 1
+# Because we are an application component, link against the CRT statically
+# (on Windows)
+USE_STATIC_LIBS = 1
+
REQUIRES = \
docshell \
xpcom \
string \
pref \
rdf \
uriloader \
webbrowserpersist \
@@ -71,17 +75,16 @@ endif
ifdef MOZ_SAFE_BROWSING
REQUIRES += safebrowsing
LOCAL_INCLUDES += -I$(srcdir)/../safebrowsing/src
SHARED_LIBRARY_LIBS += ../safebrowsing/src/$(LIB_PREFIX)safebrowsing_s.$(LIB_SUFFIX)
endif
EXTRA_DSO_LDOPTS += \
$(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
- $(MOZ_UNICHARUTIL_LIBS) \
$(LIBXUL_DIST)/../modules/libreg/src/$(LIB_PREFIX)mozreg_s.$(LIB_SUFFIX) \
$(MOZ_JS_LIBS) \
$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
# Mac: Need to link with CoreFoundation for Mac Migrators (PList reading code)
# GTK2: Need to link with glib for GNOME shell service
--- a/browser/components/dirprovider/Makefile.in
+++ b/browser/components/dirprovider/Makefile.in
@@ -46,16 +46,20 @@ MODULE = browsercomps
LIBRARY_NAME = browserdirprovider
ifneq ($(OS_ARCH),WINNT)
SHORT_LIBNAME = brwsrdir
endif
IS_COMPONENT = 1
MODULE_NAME = BrowserDirProvider
FORCE_SHARED_LIB = 1
+# Because we are an application component, link against the CRT statically
+# (on Windows)
+USE_STATIC_LIBS = 1
+
REQUIRES = \
xpcom \
string \
pref \
xulapp \
$(NULL)
CPPSRCS = nsBrowserDirectoryProvider.cpp
--- a/browser/components/feeds/src/Makefile.in
+++ b/browser/components/feeds/src/Makefile.in
@@ -40,16 +40,17 @@ srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = browser_feeds
LIBRARY_NAME = browser_feeds_s
FORCE_STATIC_LIB = 1
FORCE_USE_PIC = 1
+USE_STATIC_LIBS = 1
DEFINES += \
-DMOZ_APP_NAME=$(MOZ_APP_NAME) \
-DMOZ_APP_DISPLAYNAME=$(MOZ_APP_DISPLAYNAME) \
$(NULL)
EXTRA_PP_COMPONENTS = \
FeedConverter.js \
--- a/browser/components/migration/src/Makefile.in
+++ b/browser/components/migration/src/Makefile.in
@@ -40,16 +40,17 @@ srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = migration
LIBRARY_NAME = migration_s
FORCE_STATIC_LIB = 1
FORCE_USE_PIC = 1
+USE_STATIC_LIBS = 1
REQUIRES = \
xpcom \
string \
necko \
history \
libreg \
browsercomps \
--- a/browser/components/safebrowsing/src/Makefile.in
+++ b/browser/components/safebrowsing/src/Makefile.in
@@ -40,16 +40,17 @@ srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = safebrowsing
LIBRARY_NAME = safebrowsing_s
FORCE_STATIC_LIB = 1
FORCE_USE_PIC = 1
+USE_STATIC_LIBS = 1
REQUIRES = \
necko \
safebrowsing \
string \
uriloader \
xpcom
--- a/browser/components/shell/src/Makefile.in
+++ b/browser/components/shell/src/Makefile.in
@@ -40,16 +40,17 @@ topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = shellservice
FORCE_STATIC_LIB = 1
FORCE_USE_PIC = 1
+USE_STATIC_LIBS = 1
REQUIRES = \
xpcom \
string \
uriloader \
webbrowserpersist \
dom \
intl \
--- a/intl/unicharutil/util/Makefile.in
+++ b/intl/unicharutil/util/Makefile.in
@@ -65,10 +65,18 @@ EXPORTS = \
$(NULL)
CPPSRCS = \
nsUnicharUtils.cpp \
$(NULL)
FORCE_STATIC_LIB = 1
FORCE_USE_PIC = 1
+USE_STATIC_LIBS = 1
include $(topsrcdir)/config/rules.mk
+
+ifdef _MSC_VER
+# Don't include directives about which CRT to use
+OS_COMPILE_CXXFLAGS += -Zl
+OS_COMPILE_CFLAGS += -Zl
+DEFINES += -D_USE_ANSI_CPP
+endif
--- a/modules/libreg/src/Makefile.in
+++ b/modules/libreg/src/Makefile.in
@@ -60,22 +60,30 @@ PROGOBJS = $(addprefix R_,$(BIN_S
FORCE_STATIC_LIB = 1
# Force use of PIC
FORCE_USE_PIC = 1
# We do want this in the static libraries list
EXPORT_LIBRARY = 1
+USE_STATIC_LIBS = 1
+
include $(topsrcdir)/config/config.mk
DEFINES += -DUSE_BUFFERED_REGISTRY_IO
# Memory mapped files are not supported under QNX, Neutrino, HP-UX and BeOS
#ifeq (,$(filter BeOS HP-UX QNX,$(OS_ARCH)))
#CSRCS += mmapio.c
#DEFINES += -DUSE_MMAP_REGISTRY_IO
#endif
include $(topsrcdir)/config/rules.mk
R_%.o: %.c
$(CC) $(OUTOPTION)$@ -c $(COMPILE_CFLAGS) -DSTANDALONE_REGISTRY $<
+ifdef _MSC_VER
+# Don't include directives about which CRT to use
+OS_COMPILE_CXXFLAGS += -Zl
+OS_COMPILE_CFLAGS += -Zl
+DEFINES += -D_USE_ANSI_CPP
+endif