bug 1399870 - Make DEFFILE a Path instead of a string. r=gps

DEFFILE is currently just used as a passthrough variable. All but one of
the current uses of it 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.

MozReview-Commit-ID: IRokABaZW2c

--HG--
extra : rebase_source : ae74c984bb2aab70211dc5974a8b052651e025dd
This commit is contained in:
Ted Mielczarek 2017-09-14 06:24:43 -04:00
parent 2fffce65cd
commit 8439a24741
13 changed files with 26 additions and 14 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -15,4 +15,4 @@ SHARED_LIBRARY_NAME = 'lgpllibs'
if CONFIG['MOZ_LIBAV_FFT']:
DIRS += ['/media/libav']
DEFFILE = SRCDIR + '/lgpllibs.def'
DEFFILE = 'lgpllibs.def'

View File

@ -170,14 +170,14 @@ CODFILE=$(basename $(@F)).cod
endif
ifdef DEFFILE
OS_LDFLAGS += -DEF:$(call normalizepath,$(DEFFILE))
OS_LDFLAGS += -DEF:$(DEFFILE)
EXTRA_DEPS += $(DEFFILE)
endif
else #!GNU_CC
ifdef DEFFILE
OS_LDFLAGS += $(call normalizepath,$(DEFFILE))
OS_LDFLAGS += $(DEFFILE)
EXTRA_DEPS += $(DEFFILE)
endif

View File

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

View File

@ -79,6 +79,6 @@ else:
GeckoSharedLibrary('libEGL', linkage=None)
RCFILE = SRCDIR + '/libEGL.rc'
DEFFILE = SRCDIR + '/libEGL.def'
DEFFILE = 'libEGL.def'
USE_LIBS += ['libANGLE']

View File

@ -84,7 +84,7 @@ else:
GeckoSharedLibrary('libGLESv2', linkage=None)
RCFILE = SRCDIR + '/libGLESv2.rc'
DEFFILE = SRCDIR + '/libGLESv2.def'
DEFFILE = 'libGLESv2.def'
USE_LIBS += ['libANGLE']

View File

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

View File

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

View File

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

View File

@ -913,7 +913,6 @@ class TreeMetadataEmitter(LoggingMixin):
'RCFILE',
'RESFILE',
'RCINCLUDE',
'DEFFILE',
'WIN32_EXE_LDFLAGS',
'LD_VERSION_SCRIPT',
'USE_EXTENSION_MANIFEST',
@ -924,6 +923,19 @@ class TreeMetadataEmitter(LoggingMixin):
if v in context and context[v]:
passthru.variables[v] = context[v]
deffile = context.get('DEFFILE')
if deffile:
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
passthru.variables['DEFFILE'] = path
if context.config.substs.get('OS_TARGET') == 'WINNT' and \
context['DELAYLOAD_DLLS']:
context['LDFLAGS'].extend([('-DELAYLOAD:%s' % dll)