From 8439a24741fe5cc86569a2f3e73923dc0b48d9eb Mon Sep 17 00:00:00 2001 From: Ted Mielczarek Date: Thu, 14 Sep 2017 06:24:43 -0400 Subject: [PATCH] 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 --- accessible/interfaces/ia2/moz.build | 2 +- accessible/interfaces/msaa/moz.build | 2 +- accessible/ipc/win/handler/moz.build | 2 +- build/win32/crashinjectdll/moz.build | 2 +- config/external/lgpllibs/moz.build | 2 +- config/rules.mk | 4 ++-- dom/plugins/test/testplugin/testplugin.mozbuild | 2 +- gfx/angle/src/libEGL/moz.build | 2 +- gfx/angle/src/libGLESv2/moz.build | 2 +- modules/pdfium/moz.build | 2 +- mozglue/build/moz.build | 2 +- python/mozbuild/mozbuild/frontend/context.py | 2 +- python/mozbuild/mozbuild/frontend/emitter.py | 14 +++++++++++++- 13 files changed, 26 insertions(+), 14 deletions(-) diff --git a/accessible/interfaces/ia2/moz.build b/accessible/interfaces/ia2/moz.build index 7826d156c935..160d5450d73c 100644 --- a/accessible/interfaces/ia2/moz.build +++ b/accessible/interfaces/ia2/moz.build @@ -8,7 +8,7 @@ GeckoSharedLibrary('IA2Marshal', linkage=None) DEFINES['REGISTER_PROXY_DLL'] = True -DEFFILE = SRCDIR + '/IA2Marshal.def' +DEFFILE = 'IA2Marshal.def' OS_LIBS += [ 'uuid', diff --git a/accessible/interfaces/msaa/moz.build b/accessible/interfaces/msaa/moz.build index cbd7681e5003..79d42cf77dad 100644 --- a/accessible/interfaces/msaa/moz.build +++ b/accessible/interfaces/msaa/moz.build @@ -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', diff --git a/accessible/ipc/win/handler/moz.build b/accessible/ipc/win/handler/moz.build index 9874c2fb7708..fe22cb4d65f8 100644 --- a/accessible/ipc/win/handler/moz.build +++ b/accessible/ipc/win/handler/moz.build @@ -32,7 +32,7 @@ GENERATED_FILES += [ 'HandlerData_p.c', ] -DEFFILE = SRCDIR + '/AccessibleHandler.def' +DEFFILE = 'AccessibleHandler.def' USE_LIBS += [ 'mscom_oop', diff --git a/build/win32/crashinjectdll/moz.build b/build/win32/crashinjectdll/moz.build index d062589e775a..270b88ec07f6 100644 --- a/build/win32/crashinjectdll/moz.build +++ b/build/win32/crashinjectdll/moz.build @@ -10,7 +10,7 @@ SOURCES += [ SharedLibrary('crashinjectdll') -DEFFILE = SRCDIR + '/crashinjectdll.def' +DEFFILE = 'crashinjectdll.def' USE_STATIC_LIBS = True NO_PGO = True diff --git a/config/external/lgpllibs/moz.build b/config/external/lgpllibs/moz.build index fad4bfb46459..024f3d0307db 100644 --- a/config/external/lgpllibs/moz.build +++ b/config/external/lgpllibs/moz.build @@ -15,4 +15,4 @@ SHARED_LIBRARY_NAME = 'lgpllibs' if CONFIG['MOZ_LIBAV_FFT']: DIRS += ['/media/libav'] - DEFFILE = SRCDIR + '/lgpllibs.def' + DEFFILE = 'lgpllibs.def' diff --git a/config/rules.mk b/config/rules.mk index 1b4a378720d8..7cda50f643ec 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -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 diff --git a/dom/plugins/test/testplugin/testplugin.mozbuild b/dom/plugins/test/testplugin/testplugin.mozbuild index a3b960221e49..912c1b48fca5 100644 --- a/dom/plugins/test/testplugin/testplugin.mozbuild +++ b/dom/plugins/test/testplugin/testplugin.mozbuild @@ -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'] diff --git a/gfx/angle/src/libEGL/moz.build b/gfx/angle/src/libEGL/moz.build index 3f3bce913987..9717b5c730e3 100644 --- a/gfx/angle/src/libEGL/moz.build +++ b/gfx/angle/src/libEGL/moz.build @@ -79,6 +79,6 @@ else: GeckoSharedLibrary('libEGL', linkage=None) RCFILE = SRCDIR + '/libEGL.rc' -DEFFILE = SRCDIR + '/libEGL.def' +DEFFILE = 'libEGL.def' USE_LIBS += ['libANGLE'] diff --git a/gfx/angle/src/libGLESv2/moz.build b/gfx/angle/src/libGLESv2/moz.build index a5644435aa6b..604b8e5d34bb 100644 --- a/gfx/angle/src/libGLESv2/moz.build +++ b/gfx/angle/src/libGLESv2/moz.build @@ -84,7 +84,7 @@ else: GeckoSharedLibrary('libGLESv2', linkage=None) RCFILE = SRCDIR + '/libGLESv2.rc' -DEFFILE = SRCDIR + '/libGLESv2.def' +DEFFILE = 'libGLESv2.def' USE_LIBS += ['libANGLE'] diff --git a/modules/pdfium/moz.build b/modules/pdfium/moz.build index 78cc535ee042..b501d567f14c 100644 --- a/modules/pdfium/moz.build +++ b/modules/pdfium/moz.build @@ -562,4 +562,4 @@ ALLOW_COMPILER_WARNINGS = True GeckoSharedLibrary('pdfium', linkage=None) if CONFIG['OS_TARGET'] == 'WINNT': - DEFFILE = SRCDIR + '/pdfium.def' + DEFFILE = 'pdfium.def' diff --git a/mozglue/build/moz.build b/mozglue/build/moz.build index 085406bee210..a6d4d050ece0 100644 --- a/mozglue/build/moz.build +++ b/mozglue/build/moz.build @@ -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', diff --git a/python/mozbuild/mozbuild/frontend/context.py b/python/mozbuild/mozbuild/frontend/context.py index a7d9b0db0d37..35f1ab7f9c23 100644 --- a/python/mozbuild/mozbuild/frontend/context.py +++ b/python/mozbuild/mozbuild/frontend/context.py @@ -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. diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py index 5cb0095d5071..f0ab60534e2c 100644 --- a/python/mozbuild/mozbuild/frontend/emitter.py +++ b/python/mozbuild/mozbuild/frontend/emitter.py @@ -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)