Bug 991983 - Define SOURCES as SourcePath. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 15 May 2015 09:49:20 +0900
changeset 245920 a2d46c1cdb8e88d10c21c473eb2f86fe39bd50cc
parent 245919 fa6d843f9086ed92aa4bb55bd1eb59428478f691
child 245921 bd8f1e56cdaf9888d001a3cfba706e4d1b794a66
push idunknown
push userunknown
push dateunknown
reviewersgps
bugs991983
milestone41.0a1
Bug 991983 - Define SOURCES as SourcePath. r=gps
dom/media/directshow/moz.build
dom/plugins/test/testplugin/javaplugin/moz.build
dom/plugins/test/testplugin/secondplugin/moz.build
dom/plugins/test/testplugin/testplugin.mozbuild
gfx/tests/gtest/moz.build
intl/unicharutil/util/objs.mozbuild
intl/unicharutil/util/standalone/moz.build
media/mtransport/common.build
mfbt/moz.build
mfbt/objs.mozbuild
mfbt/staticruntime/moz.build
netwerk/standalone/moz.build
python/mozbuild/mozbuild/frontend/context.py
python/mozbuild/mozbuild/frontend/emitter.py
python/mozbuild/mozbuild/frontend/gyp_reader.py
python/mozbuild/mozbuild/frontend/reader.py
rdf/util/objs.mozbuild
security/sandbox/moz.build
security/sandbox/objs.mozbuild
security/sandbox/staticruntime/moz.build
toolkit/crashreporter/google-breakpad/src/client/windows/crash_generation/objs.mozbuild
toolkit/crashreporter/google-breakpad/src/client/windows/handler/objs.mozbuild
toolkit/crashreporter/google-breakpad/src/client/windows/sender/objs.mozbuild
toolkit/crashreporter/google-breakpad/src/common/windows/objs.mozbuild
toolkit/mozapps/update/updater/updater-common.build
toolkit/profile/moz.build
xpcom/glue/objs.mozbuild
xpcom/libxpcomrt/moz.build
--- a/dom/media/directshow/moz.build
+++ b/dom/media/directshow/moz.build
@@ -23,22 +23,22 @@ UNIFIED_SOURCES += [
 
 SOURCES += [
     'AudioSinkFilter.cpp',
 ]
 
 # If WebRTC isn't being built, we need to compile the DirectShow base classes so that
 # they're available at link time.
 if not CONFIG['MOZ_WEBRTC']:
-    SOURCES += [ '%s/%s' % (TOPSRCDIR, p) for p in [
-        'media/webrtc/trunk/webrtc/modules/video_capture/windows/BaseFilter.cpp',
-        'media/webrtc/trunk/webrtc/modules/video_capture/windows/BaseInputPin.cpp',
-        'media/webrtc/trunk/webrtc/modules/video_capture/windows/BasePin.cpp',
-        'media/webrtc/trunk/webrtc/modules/video_capture/windows/MediaType.cpp',
-    ]]
+    SOURCES += [
+        '/media/webrtc/trunk/webrtc/modules/video_capture/windows/BaseFilter.cpp',
+        '/media/webrtc/trunk/webrtc/modules/video_capture/windows/BaseInputPin.cpp',
+        '/media/webrtc/trunk/webrtc/modules/video_capture/windows/BasePin.cpp',
+        '/media/webrtc/trunk/webrtc/modules/video_capture/windows/MediaType.cpp',
+    ]
 
 FAIL_ON_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
     '/media/webrtc/trunk/webrtc/modules/video_capture/windows',
 ]
 
--- a/dom/plugins/test/testplugin/javaplugin/moz.build
+++ b/dom/plugins/test/testplugin/javaplugin/moz.build
@@ -1,10 +1,10 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 SharedLibrary('nptestjava')
 
-relative_path = '..'
+relative_path = 'javaplugin'
 include('../testplugin.mozbuild')
--- a/dom/plugins/test/testplugin/secondplugin/moz.build
+++ b/dom/plugins/test/testplugin/secondplugin/moz.build
@@ -1,10 +1,10 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 SharedLibrary('npsecondtest')
 
-relative_path = '..'
+relative_path = 'secondplugin'
 include('../testplugin.mozbuild')
--- a/dom/plugins/test/testplugin/testplugin.mozbuild
+++ b/dom/plugins/test/testplugin/testplugin.mozbuild
@@ -1,45 +1,45 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 DIST_INSTALL = False
 
-UNIFIED_SOURCES += [ '%s/%s' % (relative_path, p) for p in [
+UNIFIED_SOURCES += [
     'nptest.cpp',
     'nptest_utils.cpp',
-]]
+]
 
 UNIFIED_SOURCES += [
-    'nptest_name.cpp',
+    '%s/nptest_name.cpp' % relative_path,
 ]
 
 toolkit = CONFIG['MOZ_WIDGET_TOOLKIT']
 if toolkit == 'cocoa':
     UNIFIED_SOURCES += [
-        relative_path + '/nptest_macosx.mm'
+        'nptest_macosx.mm'
     ]
 elif toolkit in ('gtk2', 'gtk3'):
     UNIFIED_SOURCES += [
-        relative_path + '/nptest_gtk2.cpp',
+        'nptest_gtk2.cpp',
     ]
 elif toolkit == 'android':
     UNIFIED_SOURCES += [
-        relative_path + '/nptest_droid.cpp',
+        'nptest_droid.cpp',
     ]
 elif toolkit == 'qt':
     UNIFIED_SOURCES += [
-        relative_path + '/nptest_qt.cpp',
+        'nptest_qt.cpp',
     ]
 elif toolkit == 'windows':
     UNIFIED_SOURCES += [
-        relative_path + '/nptest_windows.cpp',
+        'nptest_windows.cpp',
     ]
     OS_LIBS += [
         'msimg32',
     ]
 
 # must link statically with the CRT; nptest isn't Gecko code
 USE_STATIC_LIBS = True
 
--- a/gfx/tests/gtest/moz.build
+++ b/gfx/tests/gtest/moz.build
@@ -24,17 +24,17 @@ UNIFIED_SOURCES += [
     #'gfxTextRunPerfTest.cpp',
     'TestTiledLayerBuffer.cpp',
     'TestVsync.cpp',
 ]
 
 # Because of gkmedia on windows we won't find these
 # symbols in xul.dll.
 if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'windows':
-    UNIFIED_SOURCES += [ '%s/gfx/2d/unittest/%s' % (TOPSRCDIR, p) for p in [
+    UNIFIED_SOURCES += [ '/gfx/2d/unittest/%s' % p for p in [
         'TestBase.cpp',
         'TestBugs.cpp',
         'TestPoint.cpp',
         'TestScaling.cpp',
     ]]
     UNIFIED_SOURCES += [
         'TestMoz2D.cpp',
         'TestRect.cpp',
--- a/intl/unicharutil/util/objs.mozbuild
+++ b/intl/unicharutil/util/objs.mozbuild
@@ -17,11 +17,11 @@ intl_unicharutil_util_lcppsrcs += [
     'IrishCasing.cpp',
     'nsBidiUtils.cpp',
     'nsSpecialCasingData.cpp',
     'nsUnicharUtils.cpp',
     'nsUnicodeProperties.cpp',
 ]
 
 intl_unicharutil_util_cppsrcs = [
-    '%s/intl/unicharutil/util/%s' % (TOPSRCDIR, s) \
+    '/intl/unicharutil/util/%s' % s
         for s in intl_unicharutil_util_lcppsrcs
 ]
--- a/intl/unicharutil/util/standalone/moz.build
+++ b/intl/unicharutil/util/standalone/moz.build
@@ -2,22 +2,15 @@
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
     Library('unicharutil_standalone')
 
-intl_unicharutil_util_lcppsrcs = [
-    'nsUnicodeProperties.cpp',
+UNIFIED_SOURCES += [
+    '../nsUnicodeProperties.cpp',
 ]
 
-intl_unicharutil_util_cppsrcs = [
-    '%s/intl/unicharutil/util/%s' % (TOPSRCDIR, s) \
-        for s in intl_unicharutil_util_lcppsrcs
-]
-
-UNIFIED_SOURCES += intl_unicharutil_util_cppsrcs
-
 for var in ('MOZILLA_INTERNAL_API', 'MOZILLA_XPCOMRT_API', 'MOZILLA_EXTERNAL_LINKAGE',
             'NR_SOCKET_IS_VOID_PTR', 'HAVE_STRDUP'):
     DEFINES[var] = True
--- a/media/mtransport/common.build
+++ b/media/mtransport/common.build
@@ -26,17 +26,17 @@ mtransport_lcppsrcs = [
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
     mtransport_lcppsrcs += [
         'gonk_addrs.cpp',
     ]
 
 mtransport_cppsrcs = [
-    '%s/media/mtransport/%s' % (TOPSRCDIR, s) for s in sorted(mtransport_lcppsrcs)
+    '/media/mtransport/%s' % s for s in sorted(mtransport_lcppsrcs)
 ]
 
 LOCAL_INCLUDES += [
     '/media/mtransport/',
     '/media/mtransport/third_party/',
     '/media/mtransport/third_party/nICEr/src/crypto',
     '/media/mtransport/third_party/nICEr/src/ice',
     '/media/mtransport/third_party/nICEr/src/net',
--- a/mfbt/moz.build
+++ b/mfbt/moz.build
@@ -108,9 +108,9 @@ DEFINES['IMPL_MFBT'] = True
 
 SOURCES += mfbt_nonunified_src_cppsrcs
 
 DISABLE_STL_WRAPPING = True
 
 # Suppress warnings in third-party code.
 if CONFIG['GNU_CXX']:
     # TODO: Remove this LZ4 warning suppression after bug 993267 is fixed.
-    SOURCES[TOPSRCDIR + '/mfbt/Compression.cpp'].flags += ['-Wno-unused-function']
+    SOURCES['/mfbt/Compression.cpp'].flags += ['-Wno-unused-function']
--- a/mfbt/objs.mozbuild
+++ b/mfbt/objs.mozbuild
@@ -18,21 +18,21 @@ mfbt_src_lcppsrcs = [
     'JSONWriter.cpp',
     'Poison.cpp',
     'SHA1.cpp',
     'TaggedAnonymousMemory.cpp',
     'unused.cpp',
 ]
 
 mfbt_src_cppsrcs = [
-    '%s/mfbt/%s' % (TOPSRCDIR, s) for s in mfbt_src_lcppsrcs
+    '/mfbt/%s' % s for s in mfbt_src_lcppsrcs
 ]
 
 # Compression.cpp cannot be built in unified mode because it pulls in Windows system headers.
 # Decimal.cpp doesn't build in unified mode with gcc.
 mfbt_nonunified_src_lcppsrcs = [
     'Compression.cpp',
     'decimal/Decimal.cpp',
 ]
 
 mfbt_nonunified_src_cppsrcs = [
-    '%s/mfbt/%s' % (TOPSRCDIR, s) for s in mfbt_nonunified_src_lcppsrcs
+    '/mfbt/%s' % s for s in mfbt_nonunified_src_lcppsrcs
 ]
--- a/mfbt/staticruntime/moz.build
+++ b/mfbt/staticruntime/moz.build
@@ -16,9 +16,9 @@ SOURCES += mfbt_nonunified_src_cppsrcs
 
 USE_STATIC_LIBS = True
 
 DISABLE_STL_WRAPPING = True
 
 # Suppress warnings in third-party code.
 if CONFIG['GNU_CXX']:
     # TODO: Remove this LZ4 warning suppression after bug 993267 is fixed.
-    SOURCES[TOPSRCDIR + '/mfbt/Compression.cpp'].flags += ['-Wno-unused-function']
+    SOURCES['/mfbt/Compression.cpp'].flags += ['-Wno-unused-function']
--- a/netwerk/standalone/moz.build
+++ b/netwerk/standalone/moz.build
@@ -13,32 +13,32 @@ src_list = [
 
 netwerk_base_src = [
     'nsDNSPrefetch.cpp',
     'nsNetAddr.cpp',
     'nsSocketTransportService2.cpp',
     'nsURLHelper.cpp',
 ]
 src_list += [
-    '%s/netwerk/base/%s' % (TOPSRCDIR, s) for s in netwerk_base_src
+    '/netwerk/base/%s' % s for s in netwerk_base_src
 ]
 
 netwerk_dns_src = [
     'nsHostResolver.cpp',
     'DNS.cpp',
     'DNSListenerProxy.cpp',
     'GetAddrInfo.cpp',
     'nameprep.c',
     'nsDNSService2.cpp',
     'nsIDNService.cpp',
     'punycode.c',
     'race.c',
 ]
 src_list += [
-    '%s/netwerk/dns/%s' % (TOPSRCDIR, s) for s in netwerk_dns_src
+    '/netwerk/dns/%s' % s for s in netwerk_dns_src
 ]
 
 SOURCES += sorted(src_list)
 
 FAIL_ON_WARNINGS = True
 
 LOCAL_INCLUDES = [
     '../base',
--- a/python/mozbuild/mozbuild/frontend/context.py
+++ b/python/mozbuild/mozbuild/frontend/context.py
@@ -659,17 +659,17 @@ VARIABLES = {
 
     'ANDROID_ECLIPSE_PROJECT_TARGETS': (dict, dict,
         """Defines Android Eclipse project targets.
 
         This variable should not be populated directly. Instead, it should
         populated by calling add_android_eclipse{_library}_project().
         """, 'export'),
 
-    'SOURCES': (StrictOrderingOnAppendListWithFlagsFactory({'no_pgo': bool, 'flags': List}), list,
+    'SOURCES': (ContextDerivedTypedListWithItems(SourcePath, StrictOrderingOnAppendListWithFlagsFactory({'no_pgo': bool, 'flags': List})), list,
         """Source code files.
 
         This variable contains a list of source code files to compile.
         Accepts assembler, C, C++, Objective C/C++.
         """, None),
 
     'GENERATED_SOURCES': (StrictOrderingOnAppendList, list,
         """Generated source code files.
@@ -678,17 +678,17 @@ VARIABLES = {
         compile. Accepts assembler, C, C++, Objective C/C++.
         """, None),
 
     'FILES_PER_UNIFIED_FILE': (int, int,
         """The number of source files to compile into each unified source file.
 
         """, 'None'),
 
-    'UNIFIED_SOURCES': (StrictOrderingOnAppendList, list,
+    'UNIFIED_SOURCES': (ContextDerivedTypedList(SourcePath, StrictOrderingOnAppendList), list,
         """Source code files that can be compiled together.
 
         This variable contains a list of source code files to compile,
         that can be concatenated all together and built as a single source
         file. This can help make the build faster and reduce the debug info
         size.
         """, None),
 
@@ -911,17 +911,17 @@ VARIABLES = {
         This variable only has an effect when building with MSVC.
         """, None),
 
     'GENERATED_INCLUDES' : (StrictOrderingOnAppendList, list,
         """Directories generated by the build system to be searched for include
         files by the compiler.
         """, None),
 
-    'HOST_SOURCES': (StrictOrderingOnAppendList, list,
+    'HOST_SOURCES': (ContextDerivedTypedList(SourcePath, StrictOrderingOnAppendList), list,
         """Source code files to compile with the host compiler.
 
         This variable contains a list of source code files to compile.
         with the host compiler.
         """, None),
 
     'IS_COMPONENT': (bool, bool,
         """Whether the library contains a binary XPCOM component manifest.
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -715,20 +715,20 @@ class TreeMetadataEmitter(LoggingMixin):
         all_sources = {}
         all_flags = {}
         for symbol in ('SOURCES', 'HOST_SOURCES', 'UNIFIED_SOURCES',
                        'GENERATED_SOURCES'):
             srcs = all_sources[symbol] = []
             context_srcs = context.get(symbol, [])
             for f in context_srcs:
                 if symbol.startswith('GENERATED_'):
-                    full_path = mozpath.join(context.objdir, f)
+                    full_path = mozpath.normpath(
+                        mozpath.join(context.objdir, f))
                 else:
-                    full_path = mozpath.join(context.srcdir, f)
-                full_path = mozpath.normpath(full_path)
+                    full_path = f.full_path
                 srcs.append(full_path)
                 if symbol == 'SOURCES':
                     flags = context_srcs[f]
                     if flags:
                         all_flags[full_path] = flags
 
         for symbol in ('SOURCES', 'HOST_SOURCES', 'UNIFIED_SOURCES'):
             for src in all_sources[symbol]:
--- a/python/mozbuild/mozbuild/frontend/gyp_reader.py
+++ b/python/mozbuild/mozbuild/frontend/gyp_reader.py
@@ -7,16 +7,17 @@ import gyp
 import sys
 import time
 import os
 from itertools import chain
 import mozpack.path as mozpath
 from mozpack.files import FileFinder
 from .sandbox import alphabetical_sorted
 from .context import (
+    SourcePath,
     TemplateContext,
     VARIABLES,
 )
 from mozbuild.util import (
     List,
     memoize,
 )
 from .reader import SandboxValidationError
@@ -151,23 +152,30 @@ def read_from_gyp(config, path, output, 
             # Remove leading 'lib' from the target_name if any, and use as
             # library name.
             name = spec['target_name']
             if name.startswith('lib'):
                 name = name[3:]
             # The context expects an unicode string.
             context['LIBRARY_NAME'] = name.decode('utf-8')
             # gyp files contain headers and asm sources in sources lists.
-            sources = set(mozpath.normpath(mozpath.join(context.srcdir, f))
-                for f in spec.get('sources', [])
-                if mozpath.splitext(f)[-1] != '.h')
-            asm_sources = set(f for f in sources if f.endswith('.S'))
+            sources = []
+            unified_sources = []
+            extensions = set()
+            for f in spec.get('sources', []):
+                ext = mozpath.splitext(f)[-1]
+                extensions.add(ext)
+                s = SourcePath(context, f)
+                if ext == '.h':
+                    continue
+                if ext != '.S' and s not in non_unified_sources:
+                    unified_sources.append(s)
+                else:
+                    sources.append(s)
 
-            unified_sources = sources - non_unified_sources - asm_sources
-            sources -= unified_sources
             # The context expects alphabetical order when adding sources
             context['SOURCES'] = alphabetical_sorted(sources)
             context['UNIFIED_SOURCES'] = alphabetical_sorted(unified_sources)
 
             for define in target_conf.get('defines', []):
                 if '=' in define:
                     name, value = define.split('=', 1)
                     context['DEFINES'][name] = value
@@ -196,20 +204,16 @@ def read_from_gyp(config, path, output, 
             if flags:
                 suffix_map = {
                     '.c': 'CFLAGS',
                     '.cpp': 'CXXFLAGS',
                     '.cc': 'CXXFLAGS',
                     '.m': 'CMFLAGS',
                     '.mm': 'CMMFLAGS',
                 }
-                extensions = {
-                    mozpath.splitext(f)[-1]
-                    for f in chain(sources, unified_sources)
-                }
                 variables = (
                     suffix_map[e]
                     for e in extensions if e in suffix_map
                 )
                 for var in variables:
                     context[var].extend(flags)
         else:
             # Ignore other types than static_library because we don't have
--- a/python/mozbuild/mozbuild/frontend/reader.py
+++ b/python/mozbuild/mozbuild/frontend/reader.py
@@ -61,16 +61,17 @@ from .sandbox import (
 
 from .context import (
     Context,
     ContextDerivedValue,
     Files,
     FUNCTIONS,
     VARIABLES,
     DEPRECATION_HINTS,
+    SourcePath,
     SPECIAL_VARIABLES,
     SUBCONTEXTS,
     SubContext,
     TemplateContext,
 )
 
 if sys.version_info.major == 2:
     text_type = unicode
@@ -1062,18 +1063,18 @@ class BuildReader(object):
             # The make backend assumes contexts for sub-directories are
             # emitted after their parent, so accumulate the gyp contexts.
             # We could emit the parent context before processing gyp
             # configuration, but we need to add the gyp objdirs to that context
             # first.
             from .gyp_reader import read_from_gyp
             non_unified_sources = set()
             for s in gyp_dir.non_unified_sources:
-                source = mozpath.normpath(mozpath.join(curdir, s))
-                if not os.path.exists(source):
+                source = SourcePath(context, s)
+                if not os.path.exists(source.full_path):
                     raise SandboxValidationError('Cannot find %s.' % source,
                         context)
                 non_unified_sources.add(source)
             for gyp_context in read_from_gyp(context.config,
                                              mozpath.join(curdir, gyp_dir.input),
                                              mozpath.join(context.objdir,
                                                           target_dir),
                                              gyp_dir.variables,
--- a/rdf/util/objs.mozbuild
+++ b/rdf/util/objs.mozbuild
@@ -1,13 +1,9 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-rdf_util_src_lcppsrcs = [
-    'nsRDFResource.cpp',
+rdf_util_src_cppsrcs = [
+    '/rdf/util/nsRDFResource.cpp',
 ]
-
-rdf_util_src_cppsrcs = [
-    '%s/rdf/util/%s' % (TOPSRCDIR, s) for s in rdf_util_src_lcppsrcs
-]
--- a/security/sandbox/moz.build
+++ b/security/sandbox/moz.build
@@ -31,17 +31,17 @@ elif CONFIG['OS_ARCH'] == 'WINNT':
         'chromium-shim/sandbox/win/sandboxLogging.h',
     ]
 
     include('objs.mozbuild')
     SOURCES += security_sandbox_cppsrcs
 
     # Bug 1102853 tracks looking at removing this.
     if CONFIG['CPU_ARCH'] == 'x86_64':
-        SOURCES['%s/security/sandbox/chromium/sandbox/win/src/sharedmem_ipc_client.cc' % TOPSRCDIR].no_pgo = True
+        SOURCES['/security/sandbox/chromium/sandbox/win/src/sharedmem_ipc_client.cc'].no_pgo = True
 
     for var in ('UNICODE', '_UNICODE', 'NS_NO_XPCOM', 'SANDBOX_EXPORTS',
                 'NOMINMAX', '_CRT_RAND_S', 'CHROMIUM_SANDBOX_BUILD'):
         DEFINES[var] = True
 
     LOCAL_INCLUDES += ['/security/sandbox/chromium-shim']
     LOCAL_INCLUDES += ['/security/sandbox/chromium']
     LOCAL_INCLUDES += ['/nsprpub']
--- a/security/sandbox/objs.mozbuild
+++ b/security/sandbox/objs.mozbuild
@@ -120,11 +120,11 @@ if CONFIG['OS_ARCH'] == 'WINNT':
             'chromium/sandbox/win/src/sidestep/ia32_opcode_map.cpp',
             'chromium/sandbox/win/src/sidestep/mini_disassembler.cpp',
             'chromium/sandbox/win/src/sidestep/preamble_patcher_with_stub.cpp',
             'chromium/sandbox/win/src/sidestep_resolver.cc',
             'chromium/sandbox/win/src/Wow64.cc',
         ]
 
     security_sandbox_cppsrcs = [
-        '%s/security/sandbox/%s' % (TOPSRCDIR, s)
+        '/security/sandbox/%s' % s
             for s in sorted(security_sandbox_lcppsrcs)
     ]
--- a/security/sandbox/staticruntime/moz.build
+++ b/security/sandbox/staticruntime/moz.build
@@ -9,17 +9,17 @@ if CONFIG['OS_ARCH'] == 'WINNT':
     FORCE_STATIC_LIB = True
     USE_STATIC_LIBS = True
 
     include('../objs.mozbuild')
     SOURCES += security_sandbox_cppsrcs
 
     # Bug 1102853 tracks looking at removing this.
     if CONFIG['CPU_ARCH'] == 'x86_64':
-        SOURCES['%s/security/sandbox/chromium/sandbox/win/src/sharedmem_ipc_client.cc' % TOPSRCDIR].no_pgo = True
+        SOURCES['/security/sandbox/chromium/sandbox/win/src/sharedmem_ipc_client.cc'].no_pgo = True
 
     for var in ('UNICODE', '_UNICODE', 'NS_NO_XPCOM', 'SANDBOX_EXPORTS',
                 'NOMINMAX', '_CRT_RAND_S', 'CHROMIUM_SANDBOX_BUILD'):
         DEFINES[var] = True
 
     LOCAL_INCLUDES += ['/security/sandbox/chromium-shim']
     LOCAL_INCLUDES += ['/security/sandbox/chromium']
     LOCAL_INCLUDES += ['/nsprpub']
--- a/toolkit/crashreporter/google-breakpad/src/client/windows/crash_generation/objs.mozbuild
+++ b/toolkit/crashreporter/google-breakpad/src/client/windows/crash_generation/objs.mozbuild
@@ -8,10 +8,10 @@ lobjs_crash_generation = [
     'client_info.cc',
     'crash_generation_client.cc',
     'crash_generation_server.cc',
     'minidump_generator.cc',
 ]
 
 subdir = 'toolkit/crashreporter/google-breakpad/src/client/windows/crash_generation'
 objs_crash_generation = [
-    '%s/%s/%s' % (TOPSRCDIR, subdir, s) for s in lobjs_crash_generation
+    '/%s/%s' % (subdir, s) for s in lobjs_crash_generation
 ]
--- a/toolkit/crashreporter/google-breakpad/src/client/windows/handler/objs.mozbuild
+++ b/toolkit/crashreporter/google-breakpad/src/client/windows/handler/objs.mozbuild
@@ -5,10 +5,10 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 lobjs_handler = [
     'exception_handler.cc',
 ]
 
 subdir = 'toolkit/crashreporter/google-breakpad/src/client/windows/handler'
 objs_handler = [
-    '%s/%s/%s' % (TOPSRCDIR, subdir, s) for s in lobjs_handler
+    '/%s/%s' % (subdir, s) for s in lobjs_handler
 ]
--- a/toolkit/crashreporter/google-breakpad/src/client/windows/sender/objs.mozbuild
+++ b/toolkit/crashreporter/google-breakpad/src/client/windows/sender/objs.mozbuild
@@ -5,10 +5,10 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 lobjs_sender = [
     'crash_report_sender.cc',
 ]
 
 subdir = 'toolkit/crashreporter/google-breakpad/src/client/windows/sender'
 objs_sender = [
-    '%s/%s/%s' % (TOPSRCDIR, subdir, s) for s in lobjs_sender
+    '/%s/%s' % (subdir, s) for s in lobjs_sender
 ]
--- a/toolkit/crashreporter/google-breakpad/src/common/windows/objs.mozbuild
+++ b/toolkit/crashreporter/google-breakpad/src/common/windows/objs.mozbuild
@@ -6,10 +6,10 @@
 
 lobjs_common = [
     'guid_string.cc',
     'string_utils.cc',
 ]
 
 subdir = 'toolkit/crashreporter/google-breakpad/src/common/windows'
 objs_common = [
-    '%s/%s/%s' % (TOPSRCDIR, subdir, s) for s in lobjs_common
+    '/%s/%s' % (subdir, s) for s in lobjs_common
 ]
--- a/toolkit/mozapps/update/updater/updater-common.build
+++ b/toolkit/mozapps/update/updater/updater-common.build
@@ -96,17 +96,17 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'go
         'sysutils',
     ]
 
 if have_progressui == 0:
     srcs += [
         'progressui_null.cpp',
     ]
 
-SOURCES += ['%s%s' % (updater_rel_path, f) for f in sorted(srcs)]
+SOURCES += sorted(srcs)
 
 DEFINES['NS_NO_XPCOM'] = True
 DISABLE_STL_WRAPPING = True
 for var in ('MAR_CHANNEL_ID', 'MOZ_APP_VERSION'):
     DEFINES[var] = '"%s"' % CONFIG[var]
 
 LOCAL_INCLUDES += [
     '/toolkit/mozapps/update/common',
--- a/toolkit/profile/moz.build
+++ b/toolkit/profile/moz.build
@@ -9,20 +9,24 @@ MOCHITEST_CHROME_MANIFESTS += ['test/chr
 XPIDL_SOURCES += [
     'nsIProfileMigrator.idl',
     'nsIToolkitProfile.idl',
     'nsIToolkitProfileService.idl',
 ]
 
 XPIDL_MODULE = 'toolkitprofile'
 
-UNIFIED_SOURCES += [ TOPSRCDIR + '/profile/dirserviceprovider/nsProfileLock.cpp' ]
+UNIFIED_SOURCES += [
+    '/profile/dirserviceprovider/nsProfileLock.cpp'
+]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
-    UNIFIED_SOURCES += [ TOPSRCDIR + '/profile/dirserviceprovider/ProfileUnlockerWin.cpp' ]
+    UNIFIED_SOURCES += [
+        '/profile/dirserviceprovider/ProfileUnlockerWin.cpp'
+    ]
 
 UNIFIED_SOURCES += [
     'nsToolkitProfileService.cpp'
 ]
 
 LOCAL_INCLUDES += [
     '../xre',
     '/profile/dirserviceprovider',
--- a/xpcom/glue/objs.mozbuild
+++ b/xpcom/glue/objs.mozbuild
@@ -29,21 +29,21 @@ xpcom_glue_src_lcppsrcs = [
     'nsThreadUtils.cpp',
     'nsTObserverArray.cpp',
     'nsVersionComparator.cpp',
     'nsWeakReference.cpp',
     'pldhash.cpp',
 ]
 
 xpcom_glue_src_cppsrcs = [
-    '%s/xpcom/glue/%s' % (TOPSRCDIR, s) for s in xpcom_glue_src_lcppsrcs
+    '/xpcom/glue/%s' % s for s in xpcom_glue_src_lcppsrcs
 ]
 
 xpcom_gluens_src_lcppsrcs = [
     'BlockingResourceBase.cpp',
     'GenericFactory.cpp',
     'nsProxyRelease.cpp',
     'nsTextFormatter.cpp',
 ]
 
 xpcom_gluens_src_cppsrcs = [
-    '%s/xpcom/glue/%s' % (TOPSRCDIR, s) for s in xpcom_gluens_src_lcppsrcs
+    '/xpcom/glue/%s' % s for s in xpcom_gluens_src_lcppsrcs
 ]
--- a/xpcom/libxpcomrt/moz.build
+++ b/xpcom/libxpcomrt/moz.build
@@ -13,33 +13,33 @@ src_list = [
 ]
 
 xpcom_base_src = [
     'nsDebugImpl.cpp',
     'nsMemoryImpl.cpp',
     'nsUUIDGenerator.cpp',
 ]
 src_list += [
-    '%s/xpcom/base/%s' % (TOPSRCDIR, s) for s in xpcom_base_src
+    '/xpcom/base/%s' % s for s in xpcom_base_src
 ]
 
 xpcom_build_src = [
     'FileLocation.cpp',
     'Services.cpp',
 ]
 src_list += [
-    '%s/xpcom/build/%s' % (TOPSRCDIR, s) for s in xpcom_build_src
+    '/xpcom/build/%s' % s for s in xpcom_build_src
 ]
 
 xpcom_components_src = [
     'nsCategoryManager.cpp',
     'nsComponentManager.cpp',
 ]
 src_list += [
-    '%s/xpcom/components/%s' % (TOPSRCDIR, s) for s in xpcom_components_src
+    '/xpcom/components/%s' % s for s in xpcom_components_src
 ]
 
 xpcom_ds_src = [
     'nsObserverList.cpp',
     'nsObserverService.cpp',
     'nsStringEnumerator.cpp',
     'nsSupportsPrimitives.cpp',
 ]
@@ -53,17 +53,17 @@ elif CONFIG['HAVE_CLOCK_MONOTONIC']:
     ]
 elif CONFIG['OS_ARCH'] == 'Darwin':
     xpcom_ds_src += [
         'TimeStamp_darwin.cpp',
     ]
 elif CONFIG['COMPILE_ENVIRONMENT']:
     error('No TimeStamp implementation on this platform.  Build will not succeed')
 src_list += [
-    '%s/xpcom/ds/%s' % (TOPSRCDIR, s) for s in xpcom_ds_src
+    '/xpcom/ds/%s' % s for s in xpcom_ds_src
 ]
 
 xpcom_glue_src = [
     'BlockingResourceBase.cpp',
     'nsArrayEnumerator.cpp',
     'nsClassInfoImpl.cpp',
     'nsCOMArray.cpp',
     'nsCOMPtr.cpp',
@@ -79,63 +79,63 @@ xpcom_glue_src = [
     'nsTArray.cpp',
     'nsTHashtable.cpp',
     'nsTObserverArray.cpp',
     'nsThreadUtils.cpp',
     'nsWeakReference.cpp',
     'pldhash.cpp',
 ]
 src_list += [
-    '%s/xpcom/glue/%s' % (TOPSRCDIR, s) for s in xpcom_glue_src
+    '/xpcom/glue/%s' % s for s in xpcom_glue_src
 ]
 
 xpcom_io_src = [
     'nsNativeCharsetUtils.cpp',
 ]
 src_list += [
-    '%s/xpcom/io/%s' % (TOPSRCDIR, s) for s in xpcom_io_src
+    '/xpcom/io/%s' % s for s in xpcom_io_src
 ]
 
 xpcom_string_src = [
     'nsDependentSubstring.cpp',
     'nsPromiseFlatString.cpp',
     'nsReadableUtils.cpp',
     'nsString.cpp',
     'nsStringComparator.cpp',
     'nsStringObsolete.cpp',
     'nsSubstring.cpp',
     'nsSubstringTuple.cpp',
 ]
 if CONFIG['INTEL_ARCHITECTURE']:
     xpcom_string_src += ['nsUTF8UtilsSSE2.cpp']
 src_list += [
-    '%s/xpcom/string/%s' % (TOPSRCDIR, s) for s in xpcom_string_src
+    '/xpcom/string/%s' % s for s in xpcom_string_src
 ]
 
 xpcom_threads_src = [
     'LazyIdleThread.cpp',
     'nsEnvironment.cpp',
     'nsEventQueue.cpp',
     'nsMemoryPressure.cpp',
     'nsProcessCommon.cpp',
     'nsThread.cpp',
     'nsThreadManager.cpp',
     'nsThreadPool.cpp',
     'nsTimerImpl.cpp',
     'TimerThread.cpp',
 ]
 src_list += [
-    '%s/xpcom/threads/%s' % (TOPSRCDIR, s) for s in xpcom_threads_src
+    '/xpcom/threads/%s' % s for s in xpcom_threads_src
 ]
 
 
 SOURCES += sorted(src_list)
 
 if CONFIG['INTEL_ARCHITECTURE']:
-    sse_string_path = '%s/xpcom/string/nsUTF8UtilsSSE2.cpp' % TOPSRCDIR
+    sse_string_path = '/xpcom/string/nsUTF8UtilsSSE2.cpp'
     SOURCES[sse_string_path].flags += CONFIG['SSE2_FLAGS']
 
 GENERATED_INCLUDES += ['..']
 LOCAL_INCLUDES = [
     '../base',
     '../build',
     '../components',
     '../ds',