Index: pylib/gyp/win_tool.py |
diff --git a/pylib/gyp/win_tool.py b/pylib/gyp/win_tool.py |
index 7f3b0a5413fb25eaebfc590489a5a4c2f4116efc..16f07c1495c95e9848779d8be921255c0829ea01 100755 |
--- a/pylib/gyp/win_tool.py |
+++ b/pylib/gyp/win_tool.py |
@@ -116,6 +116,48 @@ class WinTool(object): |
print line |
return link.returncode |
+ def ExecLinkWithManifests(self, arch, embed_manifest, out, ldcmd, resname, |
+ mt, rc, *manifests): |
+ """A wrapper for handling creating a manifest resource and then executing |
+ a link command.""" |
+ # The 'normal' way to do manifests is to have link generate a manifest |
+ # based on gathering dependencies from the object files, then merge that |
+ # manifest with other manifests supplied as sources, convert the merged |
+ # manifest to a resource, and then *relink*, including the compiled |
+ # version of the manifest resource. This breaks incremental linking, and |
+ # is generally overly complicated. Instead, we merge all the manifests |
+ # provided (along with one that includes what would normally be in the |
+ # linker-generated one, see msvs_emulation.py), and include that into the |
+ # first and only link. We still tell link to generate a manifest, but we |
+ # only use that to assert that our simpler process did not miss anything. |
+ variables = { |
+ 'python': sys.executable, |
+ 'arch': arch, |
+ 'out': out, |
+ 'ldcmd': ldcmd, |
+ 'resname': resname, |
+ 'mt': mt, |
+ 'rc': rc, |
+ 'manifests': ' '.join(manifests), |
+ } |
+ add_to_ld = '' |
+ if manifests: |
+ subprocess.check_call( |
+ '%(python)s gyp-win-tool manifest-wrapper %(arch)s %(mt)s -nologo ' |
+ '-manifest %(manifests)s -out:%(out)s.manifest' % variables) |
+ if embed_manifest == 'True': |
+ subprocess.check_call( |
+ '%(python)s gyp-win-tool manifest-to-rc %(arch)s %(out)s.manifest' |
+ ' %(out)s.manifest.rc %(resname)s' % variables) |
+ subprocess.check_call( |
+ '%(python)s gyp-win-tool rc-wrapper %(arch)s %(rc)s ' |
+ '%(out)s.manifest.rc' % variables) |
+ add_to_ld = ' %(out)s.manifest.res' % variables |
+ subprocess.check_call(ldcmd + add_to_ld) |
+ # TODO(scottmg): Run mt.exe on the theoretically complete manifest we |
+ # generated, merging it with the one the linker generated to confirm that |
+ # the linker generated one does not add anything. |
+ |
def ExecManifestWrapper(self, arch, *args): |
"""Run manifest tool with environment set. Strip out undesirable warning |
(some XML blocks are recognized by the OS loader, but not the manifest |