Bug 736564 - Ship mozglue and jemalloc libraries in the SDK. r=bsmedberg,r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 03 May 2012 08:36:12 +0200
changeset 96997 4b4f59ac01ac2240dcd4e736084327cebbd72d9b
parent 96996 77bf50b33a056c78879afac18b606c69d770067a
child 96998 400bb4853ff36956760883a182804256e776ceaf
push idunknown
push userunknown
push dateunknown
reviewersbsmedberg, ted
bugs736564
milestone15.0a1
Bug 736564 - Ship mozglue and jemalloc libraries in the SDK. r=bsmedberg,r=ted As one import library on Windows, as one shared library on OSX and Android, and as two separate static libraries on systems where mozglue is a static library.
configure.in
memory/jemalloc/Makefile.in
mozglue/build/Makefile.in
--- a/configure.in
+++ b/configure.in
@@ -7182,17 +7182,23 @@ elif test "${OS_TARGET}" = "WINNT" -o "$
   dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
   if test -z "$GNU_CC"; then
     MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
   else
     MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
   fi
 else
   dnl On other Unix systems, we only want to link executables against mozglue
-  MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib) $(MKSHLIB_UNFORCE_ALL)'
+  MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
+  dnl On other Unix systems, where mozglue is a static library, jemalloc is
+  dnl separated for the SDK, so we need to add it here.
+  if test "$MOZ_MEMORY" = 1; then
+    MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,jemalloc,$(LIBXUL_DIST)/lib)'
+  fi
+  MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
   if test -n "$GNU_CC"; then
     dnl And we need mozglue symbols to be exported.
     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
   fi
   if test "$MOZ_LINKER" = 1; then
     MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $ZLIB_LIBS"
   fi
 fi
--- a/memory/jemalloc/Makefile.in
+++ b/memory/jemalloc/Makefile.in
@@ -48,16 +48,20 @@ MODULE		= jemalloc
 # jemalloc.c properly uses 'static', so don't burden it with manually exposing
 # symbols.
 VISIBILITY_FLAGS=
 
 CSRCS = jemalloc.c
 EXPORTS = jemalloc.h jemalloc_types.h
 LIBRARY_NAME = jemalloc
 FORCE_STATIC_LIB= 1
+ifdef MOZ_GLUE_PROGRAM_LDFLAGS
+SDK_LIBRARY = $(REAL_LIBRARY)
+DIST_INSTALL = 1
+endif
 
 ifeq ($(OS_ARCH),SunOS)
 ifndef GNU_CC
 MODULE_OPTIMIZE_FLAGS = -xO5
 endif
 endif
 
 ifeq (Linux,$(OS_TARGET))
--- a/mozglue/build/Makefile.in
+++ b/mozglue/build/Makefile.in
@@ -42,33 +42,45 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = mozglue
 LIBRARY_NAME = mozglue
 DIST_INSTALL = 1
 
-ifdef MOZ_MEMORY
-SHARED_LIBRARY_LIBS = $(call EXPAND_LIBNAME_PATH,memory,$(DEPTH)/memory/build)
-SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,jemalloc,$(DEPTH)/memory/jemalloc)
-else
-# Temporary, until bug 662814 lands
-VISIBILITY_FLAGS =
-CPPSRCS = dummy.cpp
-endif
- 
 # Build mozglue as a shared lib on Windows, OSX and Android.
 # If this is ever changed, update MOZ_SHARED_MOZGLUE in browser/installer/Makefile.in
 ifneq (,$(filter WINNT Darwin Android,$(OS_TARGET)))
 FORCE_SHARED_LIB = 1
 else
 FORCE_STATIC_LIB = 1
 endif
 
+# Keep jemalloc separated when mozglue is statically linked
+ifeq (1_1,$(MOZ_MEMORY)_$(FORCE_SHARED_LIB))
+SHARED_LIBRARY_LIBS = $(call EXPAND_LIBNAME_PATH,memory,$(DEPTH)/memory/build)
+SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,jemalloc,$(DEPTH)/memory/jemalloc)
+else
+# Temporary, until bug 662814 lands
+VISIBILITY_FLAGS =
+CPPSRCS = dummy.cpp
+
+ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
+SDK_LIBRARY = $(IMPORT_LIBRARY)
+else
+ifdef FORCE_SHARED_LIB
+SDK_LIBRARY = $(SHARED_LIBRARY)
+else
+SDK_LIBRARY = $(REAL_LIBRARY)
+endif
+endif
+
+endif
+ 
 MOZ_GLUE_LDFLAGS = # Don't link against ourselves
 
 ifeq (WINNT,$(OS_TARGET))
 DEFFILE = mozglue.def
 
 mozglue.def: mozglue.def.in
 	$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(ACDEFINES) $< > $@