bigger-libxul-win32
author Ted Mielczarek <ted.mielczarek@gmail.com>
Thu, 11 Nov 2010 07:32:51 -0500
changeset 362 73917dc8748206a61836bbc8cac7385cc93d868f
parent 308 17854273f6aa22ed0252287268c46dad3626efbd
permissions -rw-r--r--
patch landed

# HG changeset patch
# User Ted Mielczarek <ted.mielczarek@gmail.com>
# Date 1275676865 14400
# Node ID 878c5fb2cf396a335a16f83a2aa344ae8bd5ca9d
# Parent  7e514bf60ed113b3d54f00a76c398a98905f7aaf
imported patch bigger-libxul-win32

diff --git a/configure.in b/configure.in
--- a/configure.in
+++ b/configure.in
@@ -2260,6 +2260,9 @@
     dnl Need to force-link against mozalloc because it's used in the shunt
     LIBS="$LIBS \$(LIBXUL_DIST)/lib/mozalloc.lib"
     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
+    if test -n "$MOZ_MAXIMUM_LIBXUL"; then
+        LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xul.lib'
+    fi
     STATIC_XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xul.lib'
     LIB_PREFIX=
     LIB_SUFFIX=lib 
@@ -2385,6 +2388,9 @@
         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
+        if test -n "$MOZ_MAXIMUM_LIBXUL"; then
+            LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xul.lib'
+        fi
         STATIC_XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xul.lib'
         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
         if test $_MSC_VER -ge 1400; then
@@ -2623,6 +2629,9 @@
     MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
     DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
     LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
+    if test -n "$MOZ_MAXIMUM_LIBXUL"; then
+        LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib'
+    fi
     STATIC_XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xul.lib'
     TARGET_MD_ARCH=os2
     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
@@ -8045,6 +8054,7 @@
         AC_DEFINE(MOZ_MAXIMUM_LIBXUL)
         MOZ_JS_LIBS="$STATIC_JS_LIBS"
         XPCOM_FROZEN_LDOPTS="$STATIC_XPCOM_FROZEN_LDOPTS"
+        AC_DEFINE(STATIC_JS_API)
         export JS_NO_SHARED_LIBRARY=1
     fi
 else
diff --git a/ipc/app/Makefile.in b/ipc/app/Makefile.in
--- a/ipc/app/Makefile.in
+++ b/ipc/app/Makefile.in
@@ -89,6 +89,9 @@
 
 ifeq ($(OS_ARCH),WINNT)
 OS_LIBS += $(call EXPAND_LIBNAME,comctl32 comdlg32 uuid shell32 ole32 oleaut32 version winspool)
+ifdef MOZ_MAXIMUM_LIBXUL
+LIBS += $(DIST)/lib/mozalloc.lib
+endif
 OS_LIBS += $(call EXPAND_LIBNAME,usp10 msimg32)
 endif
 
diff --git a/js/src/configure.in b/js/src/configure.in
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -4925,6 +4925,10 @@
     BUILD_STATIC_LIBS=1,
     BUILD_STATIC_LIBS=)
 
+if test -n "$JS_NO_SHARED_LIBRARY"; then
+    AC_DEFINE(STATIC_JS_API)
+fi
+
 dnl ========================================================
 dnl = Link js shell to system readline
 dnl ========================================================
diff --git a/js/src/xpconnect/src/xpcwrappednativejsops.cpp b/js/src/xpconnect/src/xpcwrappednativejsops.cpp
--- a/js/src/xpconnect/src/xpcwrappednativejsops.cpp
+++ b/js/src/xpconnect/src/xpcwrappednativejsops.cpp
@@ -1283,7 +1283,13 @@
 
 /***************************************************************************/
 
-extern "C" JS_IMPORT_DATA(JSObjectOps) js_ObjectOps;
+extern "C"
+#ifndef STATIC_JS_API
+JS_IMPORT_DATA(JSObjectOps)
+#else
+JSObjectOps
+#endif
+js_ObjectOps;
 
 static JSObjectOps XPC_WN_WithCall_JSOps;
 static JSObjectOps XPC_WN_NoCall_JSOps;
diff --git a/memory/mozalloc/mozalloc.h b/memory/mozalloc/mozalloc.h
--- a/memory/mozalloc/mozalloc.h
+++ b/memory/mozalloc/mozalloc.h
@@ -51,6 +51,11 @@
 #  include <new>
 #endif
 
+#if defined(MOZ_MAXIMUM_LIBXUL)
+// everything will be linked into the same DLL
+#  undef  MOZALLOC_EXPORT
+#  define MOZALLOC_EXPORT
+#endif
 
 #if defined(MOZALLOC_EXPORT)
 /* do nothing: it's been defined to __declspec(dllexport) by
diff --git a/memory/mozalloc/msvc_throw_wrapper.cpp b/memory/mozalloc/msvc_throw_wrapper.cpp
--- a/memory/mozalloc/msvc_throw_wrapper.cpp
+++ b/memory/mozalloc/msvc_throw_wrapper.cpp
@@ -51,8 +51,9 @@
 // NB: user code is not supposed to touch the std:: namespace.  We're
 // doing this after careful review because we want to define our own
 // exception throwing semantics.  Don't try this at home!
-
+#ifndef MOZ_MAXIMUM_LIBXUL
 __declspec(dllexport) void mozilla_Throw(const exception& e);
+#endif
 
 void
 mozilla_Throw(const exception& e)
diff --git a/memory/mozalloc/msvc_throw_wrapper.h b/memory/mozalloc/msvc_throw_wrapper.h
--- a/memory/mozalloc/msvc_throw_wrapper.h
+++ b/memory/mozalloc/msvc_throw_wrapper.h
@@ -46,6 +46,19 @@
 #    error "Unable to wrap _Throw(); CRT _Throw() already declared"
 #  endif
 #  define _Throw  mozilla_Throw
+
+#  ifdef MOZ_MAXIMUM_LIBXUL
+// Ensure that _Throw() doesn't wind up __declspec(dllimport)
+#    include <yvals.h>
+#    pragma push_macro("_CRTIMP2_PURE")
+#    undef _CRTIMP2_PURE
+#    define _CRTIMP2_PURE
+#  endif
+
 #  include <exception>
 
+#  ifdef MOZ_MAXIMUM_LIBXUL
+#    pragma pop_macro("_CRTIMP2_PURE")
+#  endif
+
 #endif  // ifndef mozilla_msvc_throw_wrapper_h