OLD | NEW |
| (Empty) |
1 #!/usr/bin/env python | |
2 # | |
3 # Copyright 2013 The Chromium Authors. All rights reserved. | |
4 # Use of this source code is governed by a BSD-style license that can be | |
5 # found in the LICENSE file. | |
6 | |
7 import json | |
8 import optparse | |
9 import os | |
10 import sys | |
11 | |
12 from pylib import build_utils | |
13 | |
14 | |
15 def StripLibrary(android_strip, android_strip_args, library_path, output_path): | |
16 strip_cmd = ([android_strip] + | |
17 android_strip_args + | |
18 ['-o', output_path, library_path]) | |
19 build_utils.CheckCallDie(strip_cmd) | |
20 | |
21 | |
22 def main(argv): | |
23 parser = optparse.OptionParser() | |
24 | |
25 parser.add_option('--android-strip', | |
26 help='Path to the toolchain\'s strip binary') | |
27 parser.add_option('--android-strip-arg', action='append', | |
28 help='Argument to be passed to strip') | |
29 parser.add_option('--libraries-dir', | |
30 help='Directory for un-stripped libraries') | |
31 parser.add_option('--stripped-libraries-dir', | |
32 help='Directory for stripped libraries') | |
33 parser.add_option('--libraries-file', | |
34 help='Path to json file containing list of libraries') | |
35 parser.add_option('--stamp', help='Path to touch on success') | |
36 | |
37 | |
38 options, _ = parser.parse_args() | |
39 | |
40 with open(options.libraries_file, 'r') as libfile: | |
41 libraries = json.load(libfile) | |
42 | |
43 build_utils.MakeDirectory(options.stripped_libraries_dir) | |
44 | |
45 for library in libraries: | |
46 library_path = os.path.join(options.libraries_dir, library) | |
47 stripped_library_path = os.path.join( | |
48 options.stripped_libraries_dir, library) | |
49 StripLibrary(options.android_strip, options.android_strip_arg, library_path, | |
50 stripped_library_path) | |
51 | |
52 if options.stamp: | |
53 build_utils.Touch(options.stamp) | |
54 | |
55 | |
56 if __name__ == '__main__': | |
57 sys.exit(main(sys.argv)) | |
OLD | NEW |