Bug 1399870 - make DEFFILE a Path instead of a string; r=gps

All but one of the current uses of DEFFILE use `SRCDIR + '/file.def'` to
get a srcdir-relative path anyway, and the other one wants an
objdir-relative path, so using Path makes everything clearer.

This makes it more straightforward to translate the paths for the WSL
build.
This commit is contained in:
Ted Mielczarek 2018-09-18 15:50:19 -04:00
Родитель 9d365405a5
Коммит de99592416
17 изменённых файлов: 37 добавлений и 22 удалений

Просмотреть файл

@ -8,7 +8,7 @@ GeckoSharedLibrary('IA2Marshal', linkage=None)
DEFINES['REGISTER_PROXY_DLL'] = True DEFINES['REGISTER_PROXY_DLL'] = True
DEFFILE = SRCDIR + '/IA2Marshal.def' DEFFILE = 'IA2Marshal.def'
OS_LIBS += [ OS_LIBS += [
'uuid', 'uuid',

Просмотреть файл

@ -18,7 +18,7 @@ DEFINES['REGISTER_PROXY_DLL'] = True
# of AccessibleMarshal.dll. # of AccessibleMarshal.dll.
DEFINES['PROXY_CLSID'] = 'IID_ISimpleDOMNode' DEFINES['PROXY_CLSID'] = 'IID_ISimpleDOMNode'
DEFFILE = SRCDIR + '/AccessibleMarshal.def' DEFFILE = 'AccessibleMarshal.def'
OS_LIBS += [ OS_LIBS += [
'kernel32', 'kernel32',

Просмотреть файл

@ -37,7 +37,7 @@ GENERATED_FILES += [
'HandlerData_p.c', 'HandlerData_p.c',
] ]
DEFFILE = SRCDIR + '/AccessibleHandler.def' DEFFILE = 'AccessibleHandler.def'
USE_LIBS += [ USE_LIBS += [
'mscom_oop', 'mscom_oop',

Просмотреть файл

@ -10,7 +10,7 @@ SOURCES += [
SharedLibrary('crashinjectdll') SharedLibrary('crashinjectdll')
DEFFILE = SRCDIR + '/crashinjectdll.def' DEFFILE = 'crashinjectdll.def'
USE_STATIC_LIBS = True USE_STATIC_LIBS = True
NO_PGO = True NO_PGO = True

Просмотреть файл

@ -153,9 +153,6 @@ CODFILE=$(basename $(@F)).cod
endif endif
endif # !GNU_CC endif # !GNU_CC
EXTRA_DEPS += $(DEFFILE)
endif # WINNT endif # WINNT
ifeq (arm-Darwin,$(CPU_ARCH)-$(OS_TARGET)) ifeq (arm-Darwin,$(CPU_ARCH)-$(OS_TARGET))

Просмотреть файл

@ -42,7 +42,7 @@ NO_PGO = True
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
RCFILE = 'nptest.rc' RCFILE = 'nptest.rc'
RESFILE = 'nptest.res' RESFILE = 'nptest.res'
DEFFILE = SRCDIR + '/nptest.def' DEFFILE = 'nptest.def'
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa' and '64' in CONFIG['OS_TEST']: if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa' and '64' in CONFIG['OS_TEST']:
OS_LIBS += ['-framework Carbon'] OS_LIBS += ['-framework Carbon']

Просмотреть файл

@ -153,6 +153,6 @@ OS_LIBS += [
# '/WX', # '/WX',
#] #]
DEFFILE = SRCDIR + '/../../checkout/src/libEGL/libEGL.def' DEFFILE = '../../checkout/src/libEGL/libEGL.def'
RCFILE = '../../checkout/src/libEGL/libEGL.rc' RCFILE = '../../checkout/src/libEGL/libEGL.rc'
GeckoSharedLibrary('libEGL', linkage=None) GeckoSharedLibrary('libEGL', linkage=None)

Просмотреть файл

@ -171,6 +171,6 @@ OS_LIBS += [
# '/WX', # '/WX',
#] #]
DEFFILE = SRCDIR + '/../../checkout/src/libGLESv2/libGLESv2_autogen.def' DEFFILE = '../../checkout/src/libGLESv2/libGLESv2_autogen.def'
RCFILE = '../../checkout/src/libGLESv2/libGLESv2.rc' RCFILE = '../../checkout/src/libGLESv2/libGLESv2.rc'
GeckoSharedLibrary('libGLESv2', linkage=None) GeckoSharedLibrary('libGLESv2', linkage=None)

2
gfx/angle/update-angle.py Normal file → Executable file
Просмотреть файл

@ -509,7 +509,7 @@ def export_target(root):
total_used_files.add(def_path) total_used_files.add(def_path)
def_rel_path = list(fixup_paths([def_path]))[0] def_rel_path = list(fixup_paths([def_path]))[0]
extras['DEFFILE'] = "SRCDIR + '/{}'".format(def_rel_path) extras['DEFFILE'] = "'{}'".format(def_rel_path)
os_libs = list(map( lambda x: x[:-len('.lib')], set(accum_desc.get('libs', [])) )) os_libs = list(map( lambda x: x[:-len('.lib')], set(accum_desc.get('libs', [])) ))

Просмотреть файл

@ -562,4 +562,4 @@ AllowCompilerWarnings()
GeckoSharedLibrary('pdfium', linkage=None) GeckoSharedLibrary('pdfium', linkage=None)
if CONFIG['OS_TARGET'] == 'WINNT': if CONFIG['OS_TARGET'] == 'WINNT':
DEFFILE = SRCDIR + '/pdfium.def' DEFFILE = 'pdfium.def'

Просмотреть файл

@ -30,7 +30,7 @@ if CONFIG['MOZ_UBSAN']:
] ]
if CONFIG['OS_TARGET'] == 'WINNT': if CONFIG['OS_TARGET'] == 'WINNT':
DEFFILE = 'mozglue.def' DEFFILE = '!mozglue.def'
# We'll break the DLL blocklist if we immediately load user32.dll # We'll break the DLL blocklist if we immediately load user32.dll
DELAYLOAD_DLLS += [ DELAYLOAD_DLLS += [
'user32.dll', 'user32.dll',

Просмотреть файл

@ -1614,7 +1614,7 @@ VARIABLES = {
This variable can only be used on Windows. This variable can only be used on Windows.
"""), """),
'DEFFILE': (unicode, unicode, 'DEFFILE': (Path, unicode,
"""The program .def (module definition) file. """The program .def (module definition) file.
This variable can only be used on Windows. This variable can only be used on Windows.

Просмотреть файл

@ -1036,7 +1036,6 @@ class TreeMetadataEmitter(LoggingMixin):
'RCFILE', 'RCFILE',
'RESFILE', 'RESFILE',
'RCINCLUDE', 'RCINCLUDE',
'DEFFILE',
'WIN32_EXE_LDFLAGS', 'WIN32_EXE_LDFLAGS',
'USE_EXTENSION_MANIFEST', 'USE_EXTENSION_MANIFEST',
'NO_JS_MANIFEST', 'NO_JS_MANIFEST',
@ -1067,13 +1066,28 @@ class TreeMetadataEmitter(LoggingMixin):
if 'LDFLAGS' in context and context['LDFLAGS']: if 'LDFLAGS' in context and context['LDFLAGS']:
computed_link_flags.resolve_flags('MOZBUILD', context['LDFLAGS']) computed_link_flags.resolve_flags('MOZBUILD', context['LDFLAGS'])
deffile = context['DEFFILE'] deffile = context.get('DEFFILE')
if deffile and context.config.substs.get('OS_ARCH') == 'WINNT': if deffile and context.config.substs.get('OS_TARGET') == 'WINNT':
if isinstance(deffile, SourcePath):
if not os.path.exists(deffile.full_path):
raise SandboxValidationError(
'Path specified in DEFFILE does not exist: %s '
'(resolved to %s)' % (deffile,
deffile.full_path), context)
path = mozpath.relpath(deffile.full_path, context.objdir)
else:
path = deffile.target_basename
# We don't have any better way to indicate that the def file
# is a dependency to whatever we're building beyond stuffing
# it into EXTRA_DEPS.
passthru.variables['EXTRA_DEPS'] = [path]
if context.config.substs.get('GNU_CC'): if context.config.substs.get('GNU_CC'):
computed_link_flags.resolve_flags('DEFFILE', [deffile]) computed_link_flags.resolve_flags('DEFFILE', [path])
else: else:
computed_link_flags.resolve_flags('DEFFILE', computed_link_flags.resolve_flags('DEFFILE',
['-DEF:' + deffile]) ['-DEF:' + path])
dist_install = context['DIST_INSTALL'] dist_install = context['DIST_INSTALL']
if dist_install is True: if dist_install is True:

Просмотреть файл

Просмотреть файл

@ -325,8 +325,10 @@ class TestRecursiveMakeBackend(BackendTester):
'RCINCLUDE': [ 'RCINCLUDE': [
'RCINCLUDE := bar.rc', 'RCINCLUDE := bar.rc',
], ],
'DEFFILE': [ 'EXTRA_DEPS': [
'DEFFILE := baz.def', 'EXTRA_DEPS += %s' % mozpath.join(mozpath.relpath(env.topsrcdir,
env.topobjdir),
'baz.def'),
], ],
'WIN32_EXE_LDFLAGS': [ 'WIN32_EXE_LDFLAGS': [
'WIN32_EXE_LDFLAGS += -subsystem:console', 'WIN32_EXE_LDFLAGS += -subsystem:console',

Просмотреть файл

Просмотреть файл

@ -190,7 +190,9 @@ class TestEmitterBasic(unittest.TestCase):
'RCFILE': 'foo.rc', 'RCFILE': 'foo.rc',
'RESFILE': 'bar.res', 'RESFILE': 'bar.res',
'RCINCLUDE': 'bar.rc', 'RCINCLUDE': 'bar.rc',
'DEFFILE': 'baz.def', 'EXTRA_DEPS': [mozpath.join(mozpath.relpath(reader.config.topsrcdir,
reader.config.topobjdir),
'baz.def')],
'WIN32_EXE_LDFLAGS': ['-subsystem:console'], 'WIN32_EXE_LDFLAGS': ['-subsystem:console'],
} }