diff --git a/config/expandlibs.py b/config/expandlibs.py index b739dad522525..b63492b0e5b40 100644 --- a/config/expandlibs.py +++ b/config/expandlibs.py @@ -68,6 +68,13 @@ def isObject(path): ends with OBJ_SUFFIX or .i_o''' return os.path.splitext(path)[1] in [conf.OBJ_SUFFIX, '.i_o'] +def isDynamicLib(path): + '''Returns whether the given path points to a dynamic library, that is, + ends with DLL_SUFFIX.''' + # On mac, the xul library is named XUL, instead of libxul.dylib. Assume any + # file by that name is a dynamic library. + return os.path.splitext(path)[1] == conf.DLL_SUFFIX or os.path.basename(path) == 'XUL' + class LibDescriptor(dict): KEYS = ['OBJS', 'LIBS'] diff --git a/config/expandlibs_exec.py b/config/expandlibs_exec.py index 89dab4d6719aa..d8d9ea9d937a7 100644 --- a/config/expandlibs_exec.py +++ b/config/expandlibs_exec.py @@ -23,7 +23,14 @@ from __future__ import with_statement import sys import os -from expandlibs import ExpandArgs, relativize, isObject, ensureParentDir, ExpandLibsDeps +from expandlibs import ( + ExpandArgs, + relativize, + isDynamicLib, + isObject, + ensureParentDir, + ExpandLibsDeps, +) import expandlibs_config as conf from optparse import OptionParser import subprocess @@ -31,6 +38,7 @@ import shutil import subprocess import re +from mozbuild.makeutil import Makefile # The are the insert points for a GNU ld linker script, assuming a more # or less "standard" default linker script. This is not a dict because @@ -333,12 +341,15 @@ def main(): if not options.depend: return ensureParentDir(options.depend) - with open(options.depend, 'w') as depfile: - depfile.write("%s : %s\n" % (options.target, ' '.join(dep for dep in deps if os.path.isfile(dep) and dep != options.target))) + mk = Makefile() + deps = [dep for dep in deps if os.path.isfile(dep) and dep != options.target] + no_dynamic_lib = [dep for dep in deps if not isDynamicLib(dep)] + mk.create_rule([options.target]).add_dependencies(no_dynamic_lib) + if len(deps) != len(no_dynamic_lib): + mk.create_rule(['%s_order_only' % options.target]).add_dependencies(dep for dep in deps if isDynamicLib(dep)) - for dep in deps: - if os.path.isfile(dep) and dep != options.target: - depfile.write("%s :\n" % dep) + with open(options.depend, 'w') as depfile: + mk.dump(depfile, removal_guard=True) if __name__ == '__main__': main() diff --git a/configure.in b/configure.in index 0cb14b633abb3..18730281e0a39 100644 --- a/configure.in +++ b/configure.in @@ -894,9 +894,8 @@ MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)' MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)' MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)' -DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxul -lxpcom_core -lmozalloc' MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib' -XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxul -lmozalloc' +XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/bin)' LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS)' XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)' XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)' @@ -1978,6 +1977,7 @@ ia64*-hpux*) MC=mc.exe # certain versions of cygwin's makedepend barf on the # #include vs -I./dist/include/string issue so don't use it + XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/lib)' if test -n "$GNU_CC" -o -n "$CLANG_CC"; then CC="$CC -mwindows" CXX="$CXX -mwindows" @@ -1996,8 +1996,6 @@ ia64*-hpux*) # mingw doesn't require kernel32, user32, and advapi32 explicitly LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32" MOZ_FIX_LINK_PATHS= - DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxul -lxpcom_core -lmozalloc' - XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxul -lmozalloc' DLL_PREFIX= IMPORT_LIB_SUFFIX=dll.a @@ -2072,9 +2070,6 @@ ia64*-hpux*) WARNINGS_AS_ERRORS='-WX' MOZ_OPTIMIZE_FLAGS='-O1' MOZ_FIX_LINK_PATHS= - DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib' - XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib' - LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib' MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)' LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT" if test -z "$DEVELOPER_OPTIONS"; then @@ -2246,7 +2241,6 @@ ia64*-hpux*) MOZ_DEBUG_FLAGS="-g -fno-inline" MOZ_OPTIMIZE_FLAGS="-O2" MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA" - DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib' LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib' TARGET_MD_ARCH=os2 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2" @@ -3198,7 +3192,6 @@ AC_CACHE_CHECK( ) if test "$ac_cv_func_iconv" = "yes"; then AC_DEFINE(HAVE_ICONV) - DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS" LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS" LIBICONV="$_ICONV_LIBS" AC_CACHE_CHECK( @@ -4429,8 +4422,7 @@ cairo-cocoa) TK_CFLAGS="-DNO_X11" CFLAGS="$CFLAGS $TK_CFLAGS" CXXFLAGS="$CXXFLAGS $TK_CFLAGS" - DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/bin/XUL -lxpcom_core -lmozalloc' - XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL -lmozalloc' + XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL $(call EXPAND_LIBNAME_PATH,mozalloc,$(LIBXUL_DIST)/bin)' MOZ_USER_DIR="Mozilla" MOZ_FS_LAYOUT=bundle MOZ_WEBGL=1 @@ -4445,8 +4437,7 @@ cairo-uikit) TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText' CFLAGS="$CFLAGS $TK_CFLAGS" CXXFLAGS="$CXXFLAGS $TK_CFLAGS" - DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/bin/XUL -lxpcom_core -lmozalloc' - XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL -lmozalloc' + XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL $(call EXPAND_LIBNAME_PATH,mozalloc,$(LIBXUL_DIST)/bin)' MOZ_USER_DIR="Mozilla" MOZ_FS_LAYOUT=bundle ;; @@ -4462,6 +4453,7 @@ cairo-android) ;; cairo-gonk) + XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/lib)' AC_DEFINE(MOZ_WIDGET_GONK) AC_DEFINE(MOZ_TOUCH) MOZ_WIDGET_TOOLKIT=gonk diff --git a/js/src/config/expandlibs.py b/js/src/config/expandlibs.py index b739dad522525..b63492b0e5b40 100644 --- a/js/src/config/expandlibs.py +++ b/js/src/config/expandlibs.py @@ -68,6 +68,13 @@ def isObject(path): ends with OBJ_SUFFIX or .i_o''' return os.path.splitext(path)[1] in [conf.OBJ_SUFFIX, '.i_o'] +def isDynamicLib(path): + '''Returns whether the given path points to a dynamic library, that is, + ends with DLL_SUFFIX.''' + # On mac, the xul library is named XUL, instead of libxul.dylib. Assume any + # file by that name is a dynamic library. + return os.path.splitext(path)[1] == conf.DLL_SUFFIX or os.path.basename(path) == 'XUL' + class LibDescriptor(dict): KEYS = ['OBJS', 'LIBS'] diff --git a/js/src/config/expandlibs_exec.py b/js/src/config/expandlibs_exec.py index 89dab4d6719aa..d8d9ea9d937a7 100644 --- a/js/src/config/expandlibs_exec.py +++ b/js/src/config/expandlibs_exec.py @@ -23,7 +23,14 @@ from __future__ import with_statement import sys import os -from expandlibs import ExpandArgs, relativize, isObject, ensureParentDir, ExpandLibsDeps +from expandlibs import ( + ExpandArgs, + relativize, + isDynamicLib, + isObject, + ensureParentDir, + ExpandLibsDeps, +) import expandlibs_config as conf from optparse import OptionParser import subprocess @@ -31,6 +38,7 @@ import shutil import subprocess import re +from mozbuild.makeutil import Makefile # The are the insert points for a GNU ld linker script, assuming a more # or less "standard" default linker script. This is not a dict because @@ -333,12 +341,15 @@ def main(): if not options.depend: return ensureParentDir(options.depend) - with open(options.depend, 'w') as depfile: - depfile.write("%s : %s\n" % (options.target, ' '.join(dep for dep in deps if os.path.isfile(dep) and dep != options.target))) + mk = Makefile() + deps = [dep for dep in deps if os.path.isfile(dep) and dep != options.target] + no_dynamic_lib = [dep for dep in deps if not isDynamicLib(dep)] + mk.create_rule([options.target]).add_dependencies(no_dynamic_lib) + if len(deps) != len(no_dynamic_lib): + mk.create_rule(['%s_order_only' % options.target]).add_dependencies(dep for dep in deps if isDynamicLib(dep)) - for dep in deps: - if os.path.isfile(dep) and dep != options.target: - depfile.write("%s :\n" % dep) + with open(options.depend, 'w') as depfile: + mk.dump(depfile, removal_guard=True) if __name__ == '__main__': main() diff --git a/js/src/configure.in b/js/src/configure.in index b67be2d0e8498..0ba866267bfb2 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -1449,7 +1449,6 @@ case "$target" in _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa' TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"' LDFLAGS="$LDFLAGS -lobjc" - LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL' # The ExceptionHandling framework is needed for Objective-C exception # logging code in nsObjCExceptions.h. Currently we only use that in debug # builds. @@ -1592,8 +1591,6 @@ ia64*-hpux*) # mingw doesn't require kernel32, user32, and advapi32 explicitly LIBS="$LIBS -lgdi32 -lwinmm -lwsock32 -lpsapi" MOZ_FIX_LINK_PATHS= - DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc' - XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc' DLL_PREFIX= IMPORT_LIB_SUFFIX=dll.a @@ -1655,9 +1652,6 @@ ia64*-hpux*) WARNINGS_AS_ERRORS='-WX' MOZ_OPTIMIZE_FLAGS="-O2" MOZ_FIX_LINK_PATHS= - 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' MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)' LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT" if test -z "$DEVELOPER_OPTIONS"; then @@ -1817,8 +1811,6 @@ ia64*-hpux*) MOZ_DEBUG_FLAGS="-g -fno-inline" MOZ_OPTIMIZE_FLAGS="-O2" 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' TARGET_MD_ARCH=os2 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2" RC=rc.exe