зеркало из https://github.com/mozilla/gecko-dev.git
bug 487396 - fix some of the jemalloc windows build madness. r=bsmedberg
This commit is contained in:
Родитель
ceea2583e6
Коммит
9778d6ab76
|
@ -597,12 +597,11 @@ MOZ_QUANTIFY = @MOZ_QUANTIFY@
|
|||
MSMANIFEST_TOOL = @MSMANIFEST_TOOL@
|
||||
WIN32_REDIST_DIR = @WIN32_REDIST_DIR@
|
||||
WIN32_CRT_SRC_DIR = @WIN32_CRT_SRC_DIR@
|
||||
WIN32_CUSTOM_CRT_DIR = @WIN32_CUSTOM_CRT_DIR@
|
||||
# These are for custom CRT building
|
||||
MOZ_MEMORY_LDFLAGS = @MOZ_MEMORY_LDFLAGS@
|
||||
|
||||
# This is for custom CRT building
|
||||
ifdef MOZ_MEMORY
|
||||
ifneq (,$(WIN32_CRT_SRC_DIR)$(WIN32_CUSTOM_CRT_DIR))
|
||||
export LIB = @MOZ_LIB@
|
||||
export PATH = @MOZ_PATH@
|
||||
ifdef WIN32_CRT_SRC_DIR
|
||||
DLLFLAGS = @DLLFLAGS@
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -254,6 +254,14 @@ OS_CXXFLAGS += -FR
|
|||
endif
|
||||
else # ! MOZ_DEBUG
|
||||
|
||||
# We don't build a static CRT when building a custom CRT,
|
||||
# it appears to be broken. So don't link to jemalloc if
|
||||
# the Makefile wants static CRT linking.
|
||||
ifeq ($(MOZ_MEMORY)_$(USE_STATIC_LIBS),1_)
|
||||
# Disable default CRT libs and add the right lib path for the linker
|
||||
OS_LDFLAGS += $(MOZ_MEMORY_LDFLAGS)
|
||||
endif
|
||||
|
||||
# MOZ_DEBUG_SYMBOLS generates debug symbols in separate PDB files.
|
||||
# Used for generating an optimized build with debugging symbols.
|
||||
# Used in the Windows nightlies to generate symbols for crash reporting.
|
||||
|
|
|
@ -42,6 +42,8 @@ VPATH = @srcdir@
|
|||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
USE_STATIC_LIBS = 1
|
||||
|
||||
# undefine (as best we can, thanks gmake!) so we don't need build_number
|
||||
MOZILLA_OFFICIAL =
|
||||
BUILD_OFFICIAL =
|
||||
|
|
45
configure.in
45
configure.in
|
@ -6587,41 +6587,29 @@ if test "$MOZ_MEMORY"; then
|
|||
;;
|
||||
msvc*|mks*|cygwin*|mingw*)
|
||||
AC_DEFINE(MOZ_MEMORY_WINDOWS)
|
||||
dnl XXX: should test for vc8sp1 here, otherwise patching the crt src
|
||||
dnl will fail miserably
|
||||
if test "$_CC_SUITE" -lt "8"; then
|
||||
AC_MSG_ERROR([Building jemalloc requires Visual C++ 2005 or better])
|
||||
dnl This is sort of awful. Will revisit if we add support for more versions
|
||||
if test "$CC_VERSION" -ne "14.00.50727.762"; then
|
||||
AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 currently.])
|
||||
fi
|
||||
if test -z "$WIN32_CRT_SRC_DIR" -a -z "$WIN32_CUSTOM_CRT_DIR"; then
|
||||
if test -z "$WIN32_CRT_SRC_DIR"; then
|
||||
if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
|
||||
AC_MSG_ERROR([When building jemalloc, either set WIN32_CRT_SRC_DIR to the path to the Visual C++ CRT source (usually VCINSTALLDIR\crt\src), or set WIN32_CUSTOM_CRT_DIR to the path to a folder containing a pre-built CRT DLL.])
|
||||
AC_MSG_ERROR([When building jemalloc, set WIN32_CRT_SRC_DIR to the path to the Visual C++ CRT source (usually VCINSTALLDIR\crt\src, but VCINSTALLDIR is not set, so I can't autodetect it for you).])
|
||||
else
|
||||
WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
|
||||
fi
|
||||
fi
|
||||
if test -z "$WIN32_CRT_SRC_DIR"; then
|
||||
# pre-built dll
|
||||
WIN32_CUSTOM_CRT_DIR=`cd "$WIN32_CUSTOM_CRT_DIR" && pwd`
|
||||
_WIN_UNIX_CRT_PATH="$WIN32_CUSTOM_CRT_DIR"
|
||||
else
|
||||
# CRT source directory
|
||||
WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd`
|
||||
_CRT_BASE_DIR=`basename "$WIN32_CRT_SRC_DIR"`
|
||||
_WIN_UNIX_CRT_PATH="$_objdir/memory/jemalloc/$_CRT_BASE_DIR/build/intel"
|
||||
|
||||
if test ! -d "$WIN32_CRT_SRC_DIR"; then
|
||||
AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
|
||||
fi
|
||||
dnl need win32 paths in LIB, hence this python abuse. extra brackets
|
||||
dnl are to avoid m4
|
||||
_WIN_CRT_PATH=[`$PYTHON -c 'import sys, os.path; print os.path.normpath(sys.argv[1])' "$_WIN_UNIX_CRT_PATH"`]
|
||||
MOZ_LIB="$_WIN_CRT_PATH;$LIB"
|
||||
dnl Needs to be in PATH too, since our tools will wind up linked against it.
|
||||
dnl This needs to be unix style.
|
||||
MOZ_PATH="$PATH:$_WIN_UNIX_CRT_PATH"
|
||||
WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
|
||||
_objdir_win=`pwd -W`
|
||||
WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/intel"
|
||||
dnl Statically link the C++ stdlib. We only use this for Breakpad anyway.
|
||||
AC_DEFINE(_STATIC_CPPLIB)
|
||||
dnl Don't generate a manifest, since we're linking to a custom CRT.
|
||||
LDFLAGS="$LDFLAGS -MANIFEST:NO"
|
||||
MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -DEFAULTLIB:mozcrt19"
|
||||
dnl Also pass this to NSPR/NSS
|
||||
DLLFLAGS="$DLLFLAGS -MANIFEST:NO"
|
||||
DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
|
||||
export DLLFLAGS
|
||||
;;
|
||||
*wince)
|
||||
|
@ -6634,10 +6622,8 @@ if test "$MOZ_MEMORY"; then
|
|||
esac
|
||||
fi
|
||||
AC_SUBST(MOZ_MEMORY)
|
||||
AC_SUBST(MOZ_MEMORY_LDFLAGS)
|
||||
AC_SUBST(WIN32_CRT_SRC_DIR)
|
||||
AC_SUBST(WIN32_CUSTOM_CRT_DIR)
|
||||
AC_SUBST(MOZ_LIB)
|
||||
AC_SUBST(MOZ_PATH)
|
||||
dnl Need to set this for make because NSS doesn't have configure
|
||||
AC_SUBST(DLLFLAGS)
|
||||
|
||||
|
@ -8530,6 +8516,9 @@ ac_configure_args="$ac_configure_args --libdir=$dist/lib"
|
|||
ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
|
||||
if test "$MOZ_MEMORY"; then
|
||||
ac_configure_args="$ac_configure_args --enable-jemalloc"
|
||||
if test -n "$MOZ_MEMORY_LDFLAGS"; then
|
||||
export MOZ_MEMORY_LDFLAGS
|
||||
fi
|
||||
fi
|
||||
AC_OUTPUT_SUBDIRS(js/src)
|
||||
ac_configure_args="$_SUBDIR_CONFIG_ARGS"
|
||||
|
|
|
@ -334,8 +334,7 @@ MOZ_DEBUG_SYMBOLS = @MOZ_DEBUG_SYMBOLS@
|
|||
MOZ_QUANTIFY = @MOZ_QUANTIFY@
|
||||
MSMANIFEST_TOOL = @MSMANIFEST_TOOL@
|
||||
WIN32_REDIST_DIR = @WIN32_REDIST_DIR@
|
||||
WIN32_CRT_SRC_DIR = @WIN32_CRT_SRC_DIR@
|
||||
WIN32_CUSTOM_CRT_DIR = @WIN32_CUSTOM_CRT_DIR@
|
||||
MOZ_MEMORY_LDFLAGS = @MOZ_MEMORY_LDFLAGS@
|
||||
|
||||
# Codesighs tools option, enables win32 mapfiles.
|
||||
MOZ_MAPINFO = @MOZ_MAPINFO@
|
||||
|
|
|
@ -254,6 +254,14 @@ OS_CXXFLAGS += -FR
|
|||
endif
|
||||
else # ! MOZ_DEBUG
|
||||
|
||||
# We don't build a static CRT when building a custom CRT,
|
||||
# it appears to be broken. So don't link to jemalloc if
|
||||
# the Makefile wants static CRT linking.
|
||||
ifeq ($(MOZ_MEMORY)_$(USE_STATIC_LIBS),1_)
|
||||
# Disable default CRT libs and add the right lib path for the linker
|
||||
OS_LDFLAGS += $(MOZ_MEMORY_LDFLAGS)
|
||||
endif
|
||||
|
||||
# MOZ_DEBUG_SYMBOLS generates debug symbols in separate PDB files.
|
||||
# Used for generating an optimized build with debugging symbols.
|
||||
# Used in the Windows nightlies to generate symbols for crash reporting.
|
||||
|
|
|
@ -4199,42 +4199,7 @@ if test "$MOZ_MEMORY"; then
|
|||
;;
|
||||
msvc*|mks*|cygwin*|mingw*)
|
||||
AC_DEFINE(MOZ_MEMORY_WINDOWS)
|
||||
dnl XXX: should test for vc8sp1 here, otherwise patching the crt src
|
||||
dnl will fail miserably
|
||||
if test "$_CC_SUITE" -lt "8"; then
|
||||
AC_MSG_ERROR([Building jemalloc requires Visual C++ 2005 or better])
|
||||
fi
|
||||
if test -z "$WIN32_CRT_SRC_DIR" -a -z "$WIN32_CUSTOM_CRT_DIR"; then
|
||||
if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
|
||||
AC_MSG_ERROR([When building jemalloc, either set WIN32_CRT_SRC_DIR to the path to the Visual C++ CRT source (usually VCINSTALLDIR\crt\src), or set WIN32_CUSTOM_CRT_DIR to the path to a folder containing a pre-built CRT DLL.])
|
||||
else
|
||||
WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
|
||||
fi
|
||||
fi
|
||||
if test -z "$WIN32_CRT_SRC_DIR"; then
|
||||
# pre-built dll
|
||||
WIN32_CUSTOM_CRT_DIR=`cd "$WIN32_CUSTOM_CRT_DIR" && pwd`
|
||||
_WIN_UNIX_CRT_PATH="$WIN32_CUSTOM_CRT_DIR"
|
||||
else
|
||||
# CRT source directory
|
||||
WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd`
|
||||
_CRT_BASE_DIR=`basename "$WIN32_CRT_SRC_DIR"`
|
||||
_WIN_UNIX_CRT_PATH="$_objdir/memory/jemalloc/$_CRT_BASE_DIR/build/intel"
|
||||
fi
|
||||
dnl need win32 paths in LIB, hence this python abuse. extra brackets
|
||||
dnl are to avoid m4
|
||||
_WIN_CRT_PATH=[`$PYTHON -c 'import sys, os.path; print os.path.normpath(sys.argv[1])' "$_WIN_UNIX_CRT_PATH"`]
|
||||
MOZ_LIB="$_WIN_CRT_PATH;$LIB"
|
||||
dnl Needs to be in PATH too, since our tools will wind up linked against it.
|
||||
dnl This needs to be unix style.
|
||||
MOZ_PATH="$PATH:$_WIN_UNIX_CRT_PATH"
|
||||
dnl Statically link the C++ stdlib. We only use this for Breakpad anyway.
|
||||
AC_DEFINE(_STATIC_CPPLIB)
|
||||
dnl Don't generate a manifest, since we're linking to a custom CRT.
|
||||
LDFLAGS="$LDFLAGS -MANIFEST:NO"
|
||||
dnl Also pass this to NSPR/NSS
|
||||
DLLFLAGS="$DLLFLAGS -MANIFEST:NO"
|
||||
export DLLFLAGS
|
||||
# the interesting bits will get passed down in MOZ_MEMORY_LDFLAGS
|
||||
;;
|
||||
*wince)
|
||||
AC_DEFINE(MOZ_MEMORY_WINCE)
|
||||
|
@ -4246,12 +4211,7 @@ if test "$MOZ_MEMORY"; then
|
|||
esac
|
||||
fi
|
||||
AC_SUBST(MOZ_MEMORY)
|
||||
AC_SUBST(WIN32_CRT_SRC_DIR)
|
||||
AC_SUBST(WIN32_CUSTOM_CRT_DIR)
|
||||
AC_SUBST(MOZ_LIB)
|
||||
AC_SUBST(MOZ_PATH)
|
||||
dnl Need to set this for make because NSS doesn't have configure
|
||||
AC_SUBST(DLLFLAGS)
|
||||
AC_SUBST(MOZ_MEMORY_LDFLAGS)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Use malloc wrapper lib
|
||||
|
|
|
@ -54,23 +54,30 @@ DEFINES+= -DMOZCE_SHUNT_H
|
|||
endif
|
||||
|
||||
ifeq (WINNT,$(OS_TARGET))
|
||||
# Two options for Windows, either you build the CRT from source,
|
||||
# or you use a pre-built DLL.
|
||||
ifneq (,$(WIN32_CRT_SRC_DIR))
|
||||
# Building the CRT from source
|
||||
CRT_OBJ_DIR=./$(shell basename "$(WIN32_CRT_SRC_DIR)")
|
||||
libs:: $(CRT_OBJ_DIR)/build/intel/mozcrt19.dll
|
||||
$(INSTALL) $< $(FINAL_TARGET)
|
||||
CRT_OBJ_DIR = $(CURDIR)/crtsrc
|
||||
MOZ_CRT_DLL_NAME = mozcrt19
|
||||
MOZ_CRT_STATIC_LIBS = libcmt libcpmt
|
||||
MOZ_CRT_DLL = $(CRT_OBJ_DIR)/build/intel/$(MOZ_CRT_DLL_NAME).dll
|
||||
MOZ_CRT_IMPORT_LIB = $(CRT_OBJ_DIR)/build/intel/$(MOZ_CRT_DLL_NAME).lib
|
||||
|
||||
# copy the CRT DLL to dist/bin,
|
||||
# copy the import lib to dist/lib
|
||||
libs:: $(MOZ_CRT_DLL) $(MOZ_CRT_IMPORT_LIB)
|
||||
$(INSTALL) $(MOZ_CRT_DLL) $(FINAL_TARGET)
|
||||
$(INSTALL) $(MOZ_CRT_IMPORT_LIB) $(DIST)/lib
|
||||
|
||||
$(MOZ_CRT_IMPORT_LIB): $(MOZ_CRT_DLL)
|
||||
|
||||
define EXTRACT_CMD
|
||||
cd $(CRT_OBJ_DIR)/intel/$(i)_lib && lib "-extract:..\\build\\intel\\$(i)_obj\\unhandld.obj" eh.lib
|
||||
|
||||
endef
|
||||
endef # don't touch the blank line. actually, don't touch anything in this file.
|
||||
|
||||
# patch if necessary
|
||||
$(CRT_OBJ_DIR)/jemalloc.c: $(srcdir)/crtsp1.diff
|
||||
rm -rf $(CRT_OBJ_DIR)
|
||||
cp -R "$(WIN32_CRT_SRC_DIR)" .
|
||||
cp -R "$(WIN32_CRT_SRC_DIR)" $(CRT_OBJ_DIR)
|
||||
# per http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1189363&SiteID=1
|
||||
$(foreach i,dll mt xdll xmt,$(EXTRACT_CMD))
|
||||
# truly awful
|
||||
|
@ -78,22 +85,21 @@ $(CRT_OBJ_DIR)/jemalloc.c: $(srcdir)/crtsp1.diff
|
|||
$(PERL) $(srcdir)/apply-ed-patches.pl $(srcdir)/crtsp1.diff \
|
||||
$(CRT_OBJ_DIR) $(srcdir)/ed.exe
|
||||
|
||||
$(CRT_OBJ_DIR)/build/intel/mozcrt19.dll: \
|
||||
$(MOZ_CRT_DLL): \
|
||||
$(CRT_OBJ_DIR)/jemalloc.c $(srcdir)/jemalloc.c $(srcdir)/jemalloc.h \
|
||||
$(srcdir)/ql.h $(srcdir)/qr.h $(srcdir)/rb.h
|
||||
cp $(srcdir)/jemalloc.c $(srcdir)/jemalloc.h $(srcdir)/ql.h \
|
||||
$(srcdir)/qr.h $(srcdir)/rb.h $(CRT_OBJ_DIR)
|
||||
# this pretty much sucks, but nmake and make don't play well together
|
||||
$(PYTHON) $(srcdir)/build-crt.py $(CRT_OBJ_DIR)
|
||||
#XXX: these don't link right for some reason
|
||||
rm $(CRT_OBJ_DIR)/build/intel/{libcmt,libcpmt}.lib
|
||||
else
|
||||
# Using a pre-built DLL, so just install it.
|
||||
libs:: $(WIN32_CUSTOM_CRT_DIR)/mozcrt19.dll
|
||||
$(INSTALL) $< $(FINAL_TARGET)
|
||||
endif
|
||||
# XXX: these don't link right for some reason; the problem is likely
|
||||
# that not all the standard symbols are exported; looks like MSFT
|
||||
# never updated the sample.def files; could probably fix if someone
|
||||
# were ever bored enough. :-)
|
||||
rm -f $(addsuffix .lib, $(addprefix $(CRT_OBJ_DIR)/build/intel/, $(MOZ_CRT_STATIC_LIBS)))
|
||||
rm -f $(addsuffix .pdb, $(addprefix $(CRT_OBJ_DIR)/build/intel/, $(MOZ_CRT_STATIC_LIBS)))
|
||||
|
||||
else
|
||||
else # Not Windows
|
||||
|
||||
MODULE_OPTIMIZE_FLAGS = -O2
|
||||
ifeq ($(OS_ARCH),SunOS)
|
||||
|
|
|
@ -5,4 +5,4 @@ import os, sys
|
|||
if 'MAKEFLAGS' in os.environ:
|
||||
del os.environ['MAKEFLAGS']
|
||||
os.chdir(sys.argv[1])
|
||||
sys.exit(os.system('nmake dll_ mt RETAIL_DLL_NAME=mozcrt19 RETAIL_LIB_NAME=msvcrt'))
|
||||
sys.exit(os.system('nmake dll_ mt'))
|
||||
|
|
|
@ -130,7 +130,7 @@ LINKIMPLIB=link -lib -nologo
|
|||
209d
|
||||
21,22c
|
||||
RETAIL_DLL_NAME=MOZCRT19
|
||||
RETAIL_LIB_NAME=msvcrt
|
||||
RETAIL_LIB_NAME=mozcrt19
|
||||
.
|
||||
diff -re crt/src/makefile.inc crt-sp1/src/makefile.inc
|
||||
1623a
|
||||
|
|
|
@ -73,9 +73,7 @@ HOST_LDFLAGS += -ladvapi32.lib
|
|||
endif
|
||||
endif
|
||||
|
||||
ifdef STATIC_LIBIDL
|
||||
USE_STATIC_LIBS = 1
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),Darwin)
|
||||
# The only reason to not always strip the SDK out is that the libraries
|
||||
|
|
|
@ -56,6 +56,7 @@ HOST_CSRCS = $(CSRCS)
|
|||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
USE_STATIC_LIBS = 1
|
||||
|
||||
# Force use of PIC
|
||||
FORCE_USE_PIC = 1
|
||||
|
|
|
@ -60,6 +60,8 @@ endif
|
|||
|
||||
LIBS = $(DIST)/lib/$(LIB_PREFIX)xpt.$(LIB_SUFFIX)
|
||||
|
||||
USE_STATIC_LIBS = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
# Do not link to jemalloc
|
||||
|
|
Загрузка…
Ссылка в новой задаче