OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2014 The Chromium Authors. All rights reserved. | 3 # Copyright 2014 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 """Pack relocations in a library (or copy unchanged). | 7 """Pack relocations in a library (or copy unchanged). |
8 | 8 |
9 If --enable-packing and --configuration-name=='Release', invoke the | 9 If --enable-packing and --configuration-name=='Release', invoke the |
10 relocation_packer tool to pack the .rel.dyn or .rela.dyn section in the given | 10 relocation_packer tool to pack the .rel.dyn or .rela.dyn section in the given |
11 library files. This step is inserted after the libraries are stripped. | 11 library files. This step is inserted after the libraries are stripped. |
12 | 12 |
13 If --enable-packing is zero, the script copies files verbatim, with no | 13 If --enable-packing is zero, the script copies files verbatim, with no |
14 attempt to pack relocations. | 14 attempt to pack relocations. |
15 | 15 |
16 Any library listed in --exclude-packing-list is also copied verbatim, | 16 Any library listed in --exclude-packing-list is also copied verbatim, |
17 irrespective of any --enable-packing setting. Typically this would be | 17 irrespective of any --enable-packing setting. Typically this would be |
18 'libchromium_android_linker.so'. | 18 'libchromium_android_linker.so'. |
19 """ | 19 """ |
20 | 20 |
21 import optparse | 21 import optparse |
22 import os | 22 import os |
23 import shlex | |
24 import shutil | 23 import shutil |
25 import sys | 24 import sys |
26 import tempfile | 25 import tempfile |
27 | 26 |
28 from util import build_utils | 27 from util import build_utils |
29 | 28 |
30 def PackLibraryRelocations(android_pack_relocations, library_path, output_path): | 29 def PackLibraryRelocations(android_pack_relocations, library_path, output_path): |
31 shutil.copy(library_path, output_path) | 30 shutil.copy(library_path, output_path) |
32 pack_command = [android_pack_relocations, output_path] | 31 pack_command = [android_pack_relocations, output_path] |
33 build_utils.CheckOutput(pack_command) | 32 build_utils.CheckOutput(pack_command) |
(...skipping 28 matching lines...) Expand all Loading... |
62 help='Directory for stripped libraries') | 61 help='Directory for stripped libraries') |
63 parser.add_option('--packed-libraries-dir', | 62 parser.add_option('--packed-libraries-dir', |
64 help='Directory for packed libraries') | 63 help='Directory for packed libraries') |
65 parser.add_option('--libraries', action='append', | 64 parser.add_option('--libraries', action='append', |
66 help='List of libraries') | 65 help='List of libraries') |
67 parser.add_option('--stamp', help='Path to touch on success') | 66 parser.add_option('--stamp', help='Path to touch on success') |
68 | 67 |
69 options, _ = parser.parse_args(args) | 68 options, _ = parser.parse_args(args) |
70 enable_packing = (options.enable_packing == '1' and | 69 enable_packing = (options.enable_packing == '1' and |
71 options.configuration_name == 'Release') | 70 options.configuration_name == 'Release') |
72 exclude_packing_set = set(shlex.split(options.exclude_packing_list)) | 71 exclude_packing_set = set(build_utils.ParseGypList( |
| 72 options.exclude_packing_list)) |
73 | 73 |
74 libraries = [] | 74 libraries = [] |
75 for libs_arg in options.libraries: | 75 for libs_arg in options.libraries: |
76 libraries += build_utils.ParseGypList(libs_arg) | 76 libraries += build_utils.ParseGypList(libs_arg) |
77 | 77 |
78 if options.clear_dir: | 78 if options.clear_dir: |
79 build_utils.DeleteDirectory(options.packed_libraries_dir) | 79 build_utils.DeleteDirectory(options.packed_libraries_dir) |
80 | 80 |
81 build_utils.MakeDirectory(options.packed_libraries_dir) | 81 build_utils.MakeDirectory(options.packed_libraries_dir) |
82 | 82 |
(...skipping 15 matching lines...) Expand all Loading... |
98 libraries + build_utils.GetPythonDependencies()) | 98 libraries + build_utils.GetPythonDependencies()) |
99 | 99 |
100 if options.stamp: | 100 if options.stamp: |
101 build_utils.Touch(options.stamp) | 101 build_utils.Touch(options.stamp) |
102 | 102 |
103 return 0 | 103 return 0 |
104 | 104 |
105 | 105 |
106 if __name__ == '__main__': | 106 if __name__ == '__main__': |
107 sys.exit(main(sys.argv[1:])) | 107 sys.exit(main(sys.argv[1:])) |
OLD | NEW |