media/webrtc/trunk/build/win/install-build-deps.py

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/webrtc/trunk/build/win/install-build-deps.py	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,47 @@
     1.4 +#!/usr/bin/env python
     1.5 +# Copyright (c) 2012 The Chromium Authors. All rights reserved.
     1.6 +# Use of this source code is governed by a BSD-style license that can be
     1.7 +# found in the LICENSE file.
     1.8 +
     1.9 +import shutil
    1.10 +import sys
    1.11 +import os
    1.12 +
    1.13 +def patch_msbuild():
    1.14 +  """VS2010 MSBuild has a ULDI bug that we patch here. See http://goo.gl/Pn8tj.
    1.15 +  """
    1.16 +  source_path = os.path.join(os.environ['ProgramFiles(x86)'],
    1.17 +                             "MSBuild",
    1.18 +                             "Microsoft.Cpp",
    1.19 +                             "v4.0",
    1.20 +                             "Microsoft.CppBuild.targets")
    1.21 +  backup_path = source_path + ".backup"
    1.22 +  if not os.path.exists(backup_path):
    1.23 +    try:
    1.24 +      print "Backing up %s..." % source_path
    1.25 +      shutil.copyfile(source_path, backup_path)
    1.26 +    except IOError:
    1.27 +      print "Could not back up %s to %s. Run as Administrator?" % (
    1.28 +          source_path, backup_path)
    1.29 +      return 1
    1.30 +
    1.31 +  source = open(source_path).read()
    1.32 +  base = ('''<Target Name="GetResolvedLinkObjs" Returns="@(ObjFullPath)" '''
    1.33 +          '''DependsOnTargets="$(CommonBuildOnlyTargets);ComputeCLOutputs;'''
    1.34 +          '''ResolvedLinkObjs"''')
    1.35 +  find = base + '>'
    1.36 +  replace = base + ''' Condition="'$(ConfigurationType)'=='StaticLibrary'">'''
    1.37 +  result = source.replace(find, replace)
    1.38 +
    1.39 +  if result != source:
    1.40 +    open(source_path, "w").write(result)
    1.41 +    print "Patched %s." % source_path
    1.42 +  return 0
    1.43 +
    1.44 +
    1.45 +def main():
    1.46 +  return patch_msbuild()
    1.47 +
    1.48 +
    1.49 +if __name__ == "__main__":
    1.50 +  sys.exit(main())

mercurial