Bug 1091383 - Move delayload logic entirely in moz.build frontend code. r=gps

This commit is contained in:
Mike Hommey
2014-11-04 13:48:25 +09:00
parent b4c476e205
commit 40ad22f0fc
6 changed files with 35 additions and 49 deletions

View File

@@ -282,10 +282,6 @@ endif
endif # MOZ_PROFILE_USE endif # MOZ_PROFILE_USE
endif # NO_PROFILE_GUIDED_OPTIMIZE endif # NO_PROFILE_GUIDED_OPTIMIZE
ifdef _MSC_VER
OS_LDFLAGS += $(DELAYLOAD_LDFLAGS)
endif # _MSC_VER
MAKE_JARS_FLAGS = \ MAKE_JARS_FLAGS = \
-t $(topsrcdir) \ -t $(topsrcdir) \
-f $(MOZ_CHROME_FILE_FORMAT) \ -f $(MOZ_CHROME_FILE_FORMAT) \

View File

@@ -479,12 +479,6 @@ ifeq ($(OS_ARCH),GNU)
OS_CPPFLAGS += -DPATH_MAX=1024 -DMAXPATHLEN=1024 OS_CPPFLAGS += -DPATH_MAX=1024 -DMAXPATHLEN=1024
endif endif
ifeq ($(OS_ARCH),WINNT)
ifdef USE_DELAYIMP
OS_LIBS += $(call EXPAND_LIBNAME,delayimp)
endif
endif
# #
# MINGW32 # MINGW32
# #

View File

@@ -413,6 +413,12 @@ class TreeMetadataEmitter(LoggingMixin):
if v in context and context[v]: if v in context and context[v]:
passthru.variables[v] = context[v] passthru.variables[v] = context[v]
if context.config.substs.get('OS_TARGET') == 'WINNT' and \
context['DELAYLOAD_DLLS']:
context['LDFLAGS'].extend([('-DELAYLOAD:%s' % dll)
for dll in context['DELAYLOAD_DLLS']])
context['OS_LIBS'].append('delayimp')
for v in ['CFLAGS', 'CXXFLAGS', 'CMFLAGS', 'CMMFLAGS', 'LDFLAGS']: for v in ['CFLAGS', 'CXXFLAGS', 'CMFLAGS', 'CMMFLAGS', 'LDFLAGS']:
if v in context and context[v]: if v in context and context[v]:
passthru.variables['MOZBUILD_' + v] = context[v] passthru.variables['MOZBUILD_' + v] = context[v]
@@ -421,11 +427,6 @@ class TreeMetadataEmitter(LoggingMixin):
if context['NO_VISIBILITY_FLAGS']: if context['NO_VISIBILITY_FLAGS']:
passthru.variables['VISIBILITY_FLAGS'] = '' passthru.variables['VISIBILITY_FLAGS'] = ''
if context['DELAYLOAD_DLLS']:
passthru.variables['DELAYLOAD_LDFLAGS'] = [('-DELAYLOAD:%s' % dll)
for dll in context['DELAYLOAD_DLLS']]
passthru.variables['USE_DELAYIMP'] = True
varmap = dict( varmap = dict(
SOURCES={ SOURCES={
'.s': 'ASFILES', '.s': 'ASFILES',

View File

@@ -31,7 +31,7 @@ test_data_path = mozpath.join(test_data_path, 'data')
CONFIGS = defaultdict(lambda: { CONFIGS = defaultdict(lambda: {
'defines': [], 'defines': [],
'non_global_defines': [], 'non_global_defines': [],
'substs': [], 'substs': [('OS_TARGET', 'WINNT')],
}, { }, {
'android_eclipse': { 'android_eclipse': {
'defines': [ 'defines': [

View File

@@ -304,13 +304,6 @@ class TestRecursiveMakeBackend(BackendTester):
'VISIBILITY_FLAGS': [ 'VISIBILITY_FLAGS': [
'VISIBILITY_FLAGS :=', 'VISIBILITY_FLAGS :=',
], ],
'DELAYLOAD_LDFLAGS': [
'DELAYLOAD_LDFLAGS += -DELAYLOAD:foo.dll',
'DELAYLOAD_LDFLAGS += -DELAYLOAD:bar.dll',
],
'USE_DELAYIMP': [
'USE_DELAYIMP := 1',
],
'RCFILE': [ 'RCFILE': [
'RCFILE := foo.rc', 'RCFILE := foo.rc',
], ],
@@ -337,6 +330,8 @@ class TestRecursiveMakeBackend(BackendTester):
'MOZBUILD_LDFLAGS': [ 'MOZBUILD_LDFLAGS': [
'MOZBUILD_LDFLAGS += -framework Foo', 'MOZBUILD_LDFLAGS += -framework Foo',
'MOZBUILD_LDFLAGS += -x', 'MOZBUILD_LDFLAGS += -x',
'MOZBUILD_LDFLAGS += -DELAYLOAD:foo.dll',
'MOZBUILD_LDFLAGS += -DELAYLOAD:bar.dll',
], ],
'WIN32_EXE_LDFLAGS': [ 'WIN32_EXE_LDFLAGS': [
'WIN32_EXE_LDFLAGS += -subsystem:console', 'WIN32_EXE_LDFLAGS += -subsystem:console',

View File

@@ -56,6 +56,7 @@ class TestEmitterBasic(unittest.TestCase):
config = MockConfig(mozpath.join(data_path, name), extra_substs=dict( config = MockConfig(mozpath.join(data_path, name), extra_substs=dict(
ENABLE_TESTS='1', ENABLE_TESTS='1',
BIN_SUFFIX='.prog', BIN_SUFFIX='.prog',
OS_TARGET='WINNT',
)) ))
return BuildReader(config) return BuildReader(config)
@@ -148,32 +149,31 @@ class TestEmitterBasic(unittest.TestCase):
self.assertEqual(len(objs), 1) self.assertEqual(len(objs), 1)
self.assertIsInstance(objs[0], VariablePassthru) self.assertIsInstance(objs[0], VariablePassthru)
wanted = dict( wanted = {
ASFILES=['fans.asm', 'tans.s'], 'ASFILES': ['fans.asm', 'tans.s'],
CMMSRCS=['fans.mm', 'tans.mm'], 'CMMSRCS': ['fans.mm', 'tans.mm'],
CSRCS=['fans.c', 'tans.c'], 'CSRCS': ['fans.c', 'tans.c'],
DISABLE_STL_WRAPPING=True, 'DISABLE_STL_WRAPPING': True,
EXTRA_COMPONENTS=['fans.js', 'tans.js'], 'EXTRA_COMPONENTS': ['fans.js', 'tans.js'],
EXTRA_PP_COMPONENTS=['fans.pp.js', 'tans.pp.js'], 'EXTRA_PP_COMPONENTS': ['fans.pp.js', 'tans.pp.js'],
FAIL_ON_WARNINGS=True, 'FAIL_ON_WARNINGS': True,
HOST_CPPSRCS=['fans.cpp', 'tans.cpp'], 'HOST_CPPSRCS': ['fans.cpp', 'tans.cpp'],
HOST_CSRCS=['fans.c', 'tans.c'], 'HOST_CSRCS': ['fans.c', 'tans.c'],
MSVC_ENABLE_PGO=True, 'MSVC_ENABLE_PGO': True,
NO_DIST_INSTALL=True, 'NO_DIST_INSTALL': True,
SSRCS=['bans.S', 'fans.S'], 'SSRCS': ['bans.S', 'fans.S'],
VISIBILITY_FLAGS='', 'VISIBILITY_FLAGS': '',
DELAYLOAD_LDFLAGS=['-DELAYLOAD:foo.dll', '-DELAYLOAD:bar.dll'], 'RCFILE': 'foo.rc',
USE_DELAYIMP=True, 'RESFILE': 'bar.res',
RCFILE='foo.rc', 'RCINCLUDE': 'bar.rc',
RESFILE='bar.res', 'DEFFILE': 'baz.def',
RCINCLUDE='bar.rc', 'USE_STATIC_LIBS': True,
DEFFILE='baz.def', 'MOZBUILD_CFLAGS': ['-fno-exceptions', '-w'],
USE_STATIC_LIBS=True, 'MOZBUILD_CXXFLAGS': ['-fcxx-exceptions', '-include foo.h'],
MOZBUILD_CFLAGS=['-fno-exceptions', '-w'], 'MOZBUILD_LDFLAGS': ['-framework Foo', '-x', '-DELAYLOAD:foo.dll',
MOZBUILD_CXXFLAGS=['-fcxx-exceptions', '-include foo.h'], '-DELAYLOAD:bar.dll'],
MOZBUILD_LDFLAGS=['-framework Foo', '-x'], 'WIN32_EXE_LDFLAGS': ['-subsystem:console'],
WIN32_EXE_LDFLAGS=['-subsystem:console'], }
)
variables = objs[0].variables variables = objs[0].variables
maxDiff = self.maxDiff maxDiff = self.maxDiff