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 ce69a70520
commit 24ed7656db
6 changed files with 35 additions and 49 deletions

View File

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

View File

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

View File

@ -413,6 +413,12 @@ class TreeMetadataEmitter(LoggingMixin):
if v in context and 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']:
if v in context and context[v]:
passthru.variables['MOZBUILD_' + v] = context[v]
@ -421,11 +427,6 @@ class TreeMetadataEmitter(LoggingMixin):
if context['NO_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(
SOURCES={
'.s': 'ASFILES',

View File

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

View File

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