OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 # | 6 # |
7 # This script takes libcmt.lib for VS2005/08/10/12/13 and removes the allocation | 7 # This script takes libcmt.lib for VS2005/08/10/12/13 and removes the allocation |
8 # related functions from it. | 8 # related functions from it. |
9 # | 9 # |
10 # Usage: prep_libc.py <VCLibDir> <OutputDir> <arch> | 10 # Usage: prep_libc.py <VCLibDir> <OutputDir> <arch> |
11 # | 11 # |
12 # VCLibDir is the path where VC is installed, something like: | 12 # VCLibDir is the path where VC is installed, something like: |
13 # C:\Program Files\Microsoft Visual Studio 8\VC\lib | 13 # C:\Program Files\Microsoft Visual Studio 8\VC\lib |
14 # OutputDir is the directory where the modified libcmt file should be stored. | 14 # OutputDir is the directory where the modified libcmt file should be stored. |
15 # arch is either 'ia32' or 'x64' | 15 # arch is one of: 'ia32', 'x86' or 'x64'. ia32 and x86 are synonyms. |
16 | 16 |
17 import os | 17 import os |
18 import shutil | 18 import shutil |
19 import subprocess | 19 import subprocess |
20 import sys | 20 import sys |
21 | 21 |
22 def run(command, filter=None): | 22 def run(command, filter=None): |
23 """Run |command|, removing any lines that match |filter|. The filter is | 23 """Run |command|, removing any lines that match |filter|. The filter is |
24 to remove the echoing of input filename that 'lib' does.""" | 24 to remove the echoing of input filename that 'lib' does.""" |
25 popen = subprocess.Popen( | 25 popen = subprocess.Popen( |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 'heapmin', 'sbheap', 'calloc', 'recalloc', 'calloc_impl', | 61 'heapmin', 'sbheap', 'calloc', 'recalloc', 'calloc_impl', |
62 'new_mode', 'newopnt', 'newaopnt'] | 62 'new_mode', 'newopnt', 'newaopnt'] |
63 for obj in objfiles: | 63 for obj in objfiles: |
64 for vspath in vspaths: | 64 for vspath in vspaths: |
65 cmd = ('lib /nologo /ignore:4006,4014,4221 /remove:%s%s.obj %s' % | 65 cmd = ('lib /nologo /ignore:4006,4014,4221 /remove:%s%s.obj %s' % |
66 (vspath, obj, output_lib)) | 66 (vspath, obj, output_lib)) |
67 run(cmd, obj + '.obj') | 67 run(cmd, obj + '.obj') |
68 | 68 |
69 if __name__ == "__main__": | 69 if __name__ == "__main__": |
70 sys.exit(main()) | 70 sys.exit(main()) |
OLD | NEW |