Bug 602842 - Port bug 522770 - Implement enough of fakelibs to work around MSVC limitations; r=Callek
This commit is contained in:
Родитель
9444d4edb3
Коммит
95978e2895
|
@ -80,6 +80,11 @@ $(foreach x,$(CHECK_VARS),$(check-variable))
|
|||
|
||||
core_abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(CURDIR)/$(1)))
|
||||
|
||||
nullstr :=
|
||||
space :=$(nullstr) # EOL
|
||||
|
||||
core_winabspath = $(firstword $(subst /, ,$(call core_abspath,$(1)))):$(subst $(space),,$(patsubst %,\\%,$(wordlist 2,$(words $(subst /, ,$(call core_abspath,$(1)))), $(strip $(subst /, ,$(call core_abspath,$(1)))))))
|
||||
|
||||
# FINAL_TARGET specifies the location into which we copy end-user-shipped
|
||||
# build products (typelibs, components, chrome).
|
||||
#
|
||||
|
@ -321,6 +326,10 @@ STATIC_LIBRARY_NAME=$(LIBRARY_NAME)
|
|||
endif
|
||||
endif
|
||||
|
||||
ifeq (WINNT,$(OS_ARCH))
|
||||
MOZ_FAKELIBS = 1
|
||||
endif
|
||||
|
||||
# This comes from configure
|
||||
ifdef MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE
|
||||
NO_PROFILE_GUIDED_OPTIMIZE = 1
|
||||
|
@ -681,7 +690,7 @@ DEFINES += -DOSARCH=$(OS_ARCH)
|
|||
|
||||
######################################################################
|
||||
|
||||
GARBAGE += $(DEPENDENCIES) $(MKDEPENDENCIES) $(MKDEPENDENCIES).bak core $(wildcard core.[0-9]*) $(wildcard *.err) $(wildcard *.pure) $(wildcard *_pure_*.o) Templates.DB
|
||||
GARBAGE += $(DEPENDENCIES) $(MKDEPENDENCIES) $(MKDEPENDENCIES).bak core $(wildcard core.[0-9]*) $(wildcard *.err) $(wildcard *.pure) $(wildcard *_pure_*.o) Templates.DB $(FAKE_LIBRARY)
|
||||
|
||||
ifeq ($(OS_ARCH),Darwin)
|
||||
ifndef NSDISTMODE
|
||||
|
|
|
@ -121,6 +121,21 @@ EXPAND_LIBNAME_PATH = -L$(2) $(addprefix -l,$(1))
|
|||
EXPAND_MOZLIBNAME = $(addprefix -l,$(1))
|
||||
endif
|
||||
|
||||
ifdef MOZ_FAKELIBS
|
||||
# If a lib.fake is present, replace it with @lib.fake, otherwise just pass
|
||||
# the library name through unchanged.
|
||||
EXPAND_FAKELIBS = $(foreach f,$(1),$(if $(wildcard $(f).fake),@$(wildcard $(f).fake),$(f)))
|
||||
|
||||
# Also override EXPAND_LIBNAME_PATH and EXPAND_MOZLIBNAME on non-RELATIVE_PATH
|
||||
# platforms, so we can shortcut linking -lfoo if we have foo.a.fake
|
||||
ifndef _LIBNAME_RELATIVE_PATHS
|
||||
EXPAND_LIBNAME_PATH = $(if $(wildcard $(2)/$(LIB_PREFIX)$(1).$(LIB_SUFFIX).fake),@$(2)/$(LIB_PREFIX)$(1).$(LIB_SUFFIX).fake,-L$(2) $(addprefix -l,$(1)))
|
||||
EXPAND_MOZLIBNAME = $(if $(wildcard $(DIST)/lib/$(LIB_PREFIX)$(1).$(LIB_SUFFIX).fake),@$(DIST)/lib/$(LIB_PREFIX)$(1).$(LIB_SUFFIX).fake,$(addprefix -l,$(1)))
|
||||
endif
|
||||
else
|
||||
EXPAND_FAKELIBS = $1
|
||||
endif
|
||||
|
||||
ifdef EXTRA_DSO_LIBS
|
||||
EXTRA_DSO_LIBS := $(call EXPAND_MOZLIBNAME,$(EXTRA_DSO_LIBS))
|
||||
endif
|
||||
|
@ -231,6 +246,11 @@ endif # ENABLE_TESTS
|
|||
ifndef LIBRARY
|
||||
ifdef STATIC_LIBRARY_NAME
|
||||
LIBRARY := $(LIB_PREFIX)$(STATIC_LIBRARY_NAME).$(LIB_SUFFIX)
|
||||
ifdef MOZ_FAKELIBS
|
||||
ifndef SUPPRESS_FAKELIB
|
||||
FAKE_LIBRARY = $(LIBRARY).fake
|
||||
endif # SUPPRESS_FAKELIB
|
||||
endif # MOZ_FAKELIBS
|
||||
endif # STATIC_LIBRARY_NAME
|
||||
endif # LIBRARY
|
||||
|
||||
|
@ -531,7 +551,7 @@ endif
|
|||
#
|
||||
ifndef NO_LD_ARCHIVE_FLAGS
|
||||
ifdef SHARED_LIBRARY_LIBS
|
||||
EXTRA_DSO_LDOPTS := $(MKSHLIB_FORCE_ALL) $(SHARED_LIBRARY_LIBS) $(MKSHLIB_UNFORCE_ALL) $(EXTRA_DSO_LDOPTS)
|
||||
EXTRA_DSO_LDOPTS := $(MKSHLIB_FORCE_ALL) $(call EXPAND_FAKELIBS,$(SHARED_LIBRARY_LIBS)) $(MKSHLIB_UNFORCE_ALL) $(EXTRA_DSO_LDOPTS)
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -858,9 +878,9 @@ ifndef NO_DIST_INSTALL
|
|||
ifdef LIBRARY
|
||||
ifdef EXPORT_LIBRARY # Stage libs that will be linked into a static build
|
||||
ifdef IS_COMPONENT
|
||||
$(INSTALL) $(IFLAGS1) $(LIBRARY) $(MOZDEPTH)/staticlib/components
|
||||
$(INSTALL) $(IFLAGS1) $(LIBRARY) $(FAKE_LIBRARY) $(MOZDEPTH)/staticlib/components
|
||||
else
|
||||
$(INSTALL) $(IFLAGS1) $(LIBRARY) $(MOZDEPTH)/staticlib
|
||||
$(INSTALL) $(IFLAGS1) $(LIBRARY) $(FAKE_LIBRARY) $(MOZDEPTH)/staticlib
|
||||
endif
|
||||
endif # EXPORT_LIBRARY
|
||||
ifdef DIST_INSTALL
|
||||
|
@ -980,10 +1000,10 @@ alltags:
|
|||
$(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) $(EXE_DEF_FILE) $(RESFILE) $(GLOBAL_DEPS)
|
||||
@rm -f $@.manifest
|
||||
ifeq (WINCE,$(OS_ARCH))
|
||||
$(LD) -NOLOGO -OUT:$@ $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
|
||||
$(LD) -NOLOGO -OUT:$@ $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(call EXPAND_FAKELIBS,$(LIBS) $(EXTRA_LIBS) $(OS_LIBS))
|
||||
else
|
||||
ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
|
||||
$(LD) -NOLOGO -OUT:$@ -PDB:$(LINK_PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
|
||||
$(LD) -NOLOGO -OUT:$@ -PDB:$(LINK_PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(call EXPAND_FAKELIBS,$(LIBS) $(EXTRA_LIBS) $(OS_LIBS))
|
||||
ifdef MSMANIFEST_TOOL
|
||||
@if test -f $@.manifest; then \
|
||||
if test -f "$(srcdir)/$@.manifest"; then \
|
||||
|
@ -1005,9 +1025,9 @@ ifdef MOZ_PROFILE_GENERATE
|
|||
endif
|
||||
else # !WINNT || GNU_CC
|
||||
ifeq ($(CPP_PROG_LINK),1)
|
||||
$(CCC) -o $@ $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB) $(EXE_DEF_FILE)
|
||||
$(CCC) -o $@ $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(call EXPAND_FAKELIBS,$(LIBS) $(OS_LIBS) $(EXTRA_LIBS)) $(BIN_FLAGS) $(call EXPAND_FAKELIBS,$(WRAP_MALLOC_LIB)) $(EXE_DEF_FILE)
|
||||
else # ! CPP_PROG_LINK
|
||||
$(CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
|
||||
$(CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(call EXPAND_FAKELIBS,$(LIBS) $(OS_LIBS) $(EXTRA_LIBS)) $(BIN_FLAGS) $(EXE_DEF_FILE)
|
||||
endif # CPP_PROG_LINK
|
||||
endif # WINNT && !GNU_CC
|
||||
endif # WINCE
|
||||
|
@ -1064,10 +1084,10 @@ endif
|
|||
#
|
||||
$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
|
||||
ifeq (WINCE,$(OS_ARCH))
|
||||
$(LD) -nologo -entry:mainACRTStartup -out:$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
|
||||
$(LD) -nologo -entry:mainACRTStartup -out:$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(call EXPAND_FAKELIBS,$(LIBS) $(EXTRA_LIBS) $(OS_LIBS))
|
||||
else
|
||||
ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
|
||||
$(LD) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
|
||||
$(LD) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(call EXPAND_FAKELIBS,$(LIBS) $(EXTRA_LIBS) $(OS_LIBS))
|
||||
ifdef MSMANIFEST_TOOL
|
||||
@if test -f $@.manifest; then \
|
||||
mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
|
||||
|
@ -1076,9 +1096,9 @@ ifdef MSMANIFEST_TOOL
|
|||
endif # MSVC with manifest tool
|
||||
else
|
||||
ifeq ($(CPP_PROG_LINK),1)
|
||||
$(CCC) $(WRAP_MALLOC_CFLAGS) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(BIN_FLAGS)
|
||||
$(CCC) $(WRAP_MALLOC_CFLAGS) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(call EXPAND_FAKELIBS,$(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB)) $(BIN_FLAGS)
|
||||
else
|
||||
$(CC) $(WRAP_MALLOC_CFLAGS) $(CFLAGS) $(OUTOPTION)$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(BIN_FLAGS)
|
||||
$(CC) $(WRAP_MALLOC_CFLAGS) $(CFLAGS) $(OUTOPTION)$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(call EXPAND_FAKELIBS,$(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB)) $(BIN_FLAGS)
|
||||
endif # CPP_PROG_LINK
|
||||
endif # WINNT && !GNU_CC
|
||||
endif # WINCE
|
||||
|
@ -1140,6 +1160,17 @@ ifneq (,$(BUILD_STATIC_LIBS)$(FORCE_STATIC_LIB))
|
|||
LOBJS += $(SHARED_LIBRARY_LIBS)
|
||||
endif
|
||||
else
|
||||
NONFAKE_SHARED_LIBRARY_LIBS = $(filter-out %.fake,$call (EXPAND_FAKELIBS,$(SHARED_LIBRARY_LIBS)))
|
||||
ifeq (,$(NONFAKE_SHARED_LIBRARY_LIBS))
|
||||
# All of our SHARED_LIBRARY_LIBS have fake equivalents. Score!
|
||||
# Just pass the original object files around.
|
||||
# For shared libraries, these are already included in EXTRA_DSO_LDOPTS
|
||||
# above.
|
||||
ifndef SHARED_LIBRARY
|
||||
LOBJS += $(shell cat $(addsuffix .fake,$(SHARED_LIBRARY_LIBS)))
|
||||
endif
|
||||
SKIP_SUB_LOBJS := 1
|
||||
else
|
||||
ifneq (,$(filter OSF1 BSD_OS FreeBSD NetBSD OpenBSD SunOS Darwin,$(OS_ARCH)))
|
||||
CLEANUP1 := | egrep -v '(________64ELEL_|__.SYMDEF)'
|
||||
CLEANUP2 := rm -f ________64ELEL_ __.SYMDEF
|
||||
|
@ -1147,7 +1178,8 @@ else
|
|||
CLEANUP2 := true
|
||||
endif
|
||||
SUB_LOBJS = $(shell for lib in $(SHARED_LIBRARY_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;)
|
||||
endif
|
||||
endif # EXPAND_FAKELIBS
|
||||
endif # SHARED_LIBRARY_LIBS
|
||||
endif
|
||||
ifdef MOZILLA_PROBE_LIBS
|
||||
PROBE_LOBJS = $(shell for lib in $(MOZILLA_PROBE_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;)
|
||||
|
@ -1158,15 +1190,33 @@ endif
|
|||
|
||||
$(LIBRARY): $(OBJS) $(LOBJS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
|
||||
rm -f $@
|
||||
ifndef SKIP_SUB_LOBJS
|
||||
ifneq (,$(GNU_LD)$(filter-out OS2 WINNT WINCE, $(OS_ARCH)))
|
||||
ifdef SHARED_LIBRARY_LIBS
|
||||
@rm -f $(SUB_LOBJS)
|
||||
@for lib in $(SHARED_LIBRARY_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
|
||||
endif
|
||||
endif
|
||||
endif # SKIP_SUB_LOBJS
|
||||
$(AR) $(AR_FLAGS) $(OBJS) $(LOBJS) $(SUB_LOBJS)
|
||||
$(RANLIB) $@
|
||||
ifndef MOZ_FAKELIBS
|
||||
# Don't clean these up if we're building a fake lib, because then
|
||||
# we'll reference nonexistent object files in our fake lib.
|
||||
@rm -f foodummyfilefoo $(SUB_LOBJS)
|
||||
endif
|
||||
# Also produce a .fake file that just contains the names of the object files.
|
||||
# This can be used as a response file to the linker later instead of
|
||||
# linking the actual static library.
|
||||
ifdef MOZ_FAKELIBS
|
||||
ifndef SUPPRESS_FAKELIB
|
||||
ifeq (WINNT_,$(HOST_OS_ARCH)_$(.PYMAKE))
|
||||
echo "$(strip $(foreach f,$(OBJS) $(SEPARATE_OBJS) $(LOBJS) $(SUB_LOBJS),$(subst \,\\,$(call core_winabspath,$(f))))) " > $@.fake
|
||||
else
|
||||
echo "$(strip $(foreach f,$(OBJS) $(SEPARATE_OBJS) $(LOBJS) $(SUB_LOBJS),$(call core_abspath,$(f)))) " > $@.fake
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq (,$(filter-out WINNT WINCE, $(OS_ARCH)))
|
||||
$(IMPORT_LIBRARY): $(SHARED_LIBRARY)
|
||||
|
@ -1277,7 +1327,7 @@ endif
|
|||
ofiles=`$(AR_LIST) $${lib}`; \
|
||||
$(AR_DELETE) $${lib} $$ofiles; \
|
||||
done
|
||||
$(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(PROBE_LOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
|
||||
$(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(PROBE_LOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(call EXPAND_FAKELIBS,$(OS_LIBS) $(EXTRA_LIBS)) $(DEF_FILE) $(SHLIB_LDENDFILE)
|
||||
@rm -f $(PROBE_LOBJS)
|
||||
@rm -f $(DTRACE_PROBE_OBJ)
|
||||
@for lib in $(MOZILLA_PROBE_LIBS); do \
|
||||
|
@ -1286,7 +1336,7 @@ endif
|
|||
@rm -f $(MOZILLA_PROBE_LIBS)
|
||||
|
||||
else # ! DTRACE_LIB_DEPENDENT
|
||||
$(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(DTRACE_PROBE_OBJ) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
|
||||
$(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(DTRACE_PROBE_OBJ) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(call EXPAND_FAKELIBS,$(OS_LIBS) $(EXTRA_LIBS)) $(DEF_FILE) $(SHLIB_LDENDFILE)
|
||||
endif # DTRACE_LIB_DEPENDENT
|
||||
|
||||
ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
|
||||
|
|
13
configure.in
13
configure.in
|
@ -6594,14 +6594,9 @@ if test "$MOZ_TREE_CAIRO"; then
|
|||
PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
|
||||
fi
|
||||
|
||||
if test "$_WIN32_MSVC"; then
|
||||
MOZ_CAIRO_LIBS='$(DEPTH)/mozilla/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/mozilla/gfx/cairo/libpixman/src/mozlibpixman.lib'
|
||||
else
|
||||
MOZ_CAIRO_LIBS='$(DEPTH)/mozilla/gfx/cairo/cairo/src/$(LIB_PREFIX)mozcairo.$(LIB_SUFFIX) $(DEPTH)/mozilla/gfx/cairo/libpixman/src/$(LIB_PREFIX)mozlibpixman.$(LIB_SUFFIX)'" $CAIRO_FT_LIBS"
|
||||
|
||||
if test "$MOZ_X11"; then
|
||||
MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
|
||||
fi
|
||||
MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src) $(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'" $CAIRO_FT_LIBS"
|
||||
if test "$MOZ_X11"; then
|
||||
MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
|
||||
fi
|
||||
else
|
||||
PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
|
||||
|
@ -6617,7 +6612,7 @@ AC_SUBST(MOZ_CAIRO_LIBS)
|
|||
dnl qcms
|
||||
dnl ========================================================
|
||||
|
||||
QCMS_LIBS='$(DEPTH)/mozilla/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
|
||||
QCMS_LIBS='$(call EXPAND_LIBNAME_PATH,mozqcms,$(DEPTH)/gfx/qcms)'
|
||||
AC_SUBST(QCMS_LIBS)
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче