Skip to content

Commit

Permalink
Bug 920908 - Use EXPAND_PATH_LIBNAME when linking against libxul/libm…
Browse files Browse the repository at this point in the history
…ozalloc. r=gps
  • Loading branch information
glandium committed Sep 26, 2013
1 parent be75b7f commit ea02cd0
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 33 deletions.
7 changes: 7 additions & 0 deletions config/expandlibs.py
Expand Up @@ -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']

Expand Down
23 changes: 17 additions & 6 deletions config/expandlibs_exec.py
Expand Up @@ -23,14 +23,22 @@
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
import tempfile
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
Expand Down Expand Up @@ -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()
18 changes: 5 additions & 13 deletions configure.in
Expand Up @@ -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)'
Expand Down Expand Up @@ -1978,6 +1977,7 @@ ia64*-hpux*)
MC=mc.exe
# certain versions of cygwin's makedepend barf on the
# #include <string> 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"
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand All @@ -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
;;
Expand All @@ -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
Expand Down
7 changes: 7 additions & 0 deletions js/src/config/expandlibs.py
Expand Up @@ -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']

Expand Down
23 changes: 17 additions & 6 deletions js/src/config/expandlibs_exec.py
Expand Up @@ -23,14 +23,22 @@
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
import tempfile
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
Expand Down Expand Up @@ -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()
8 changes: 0 additions & 8 deletions js/src/configure.in
Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ea02cd0

Please sign in to comment.