| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright 2017 The Chromium Authors. All rights reserved. | 3 # Copyright 2017 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 # Create a static library which exposes only symbols which are explicitly marked | 7 # Create a static library which exposes only symbols which are explicitly marked |
| 8 # as visible e.g., by __attribute__((visibility("default"))). | 8 # as visible e.g., by __attribute__((visibility("default"))). |
| 9 # | 9 # |
| 10 # See BUILD.gn in this directory for usage example. | 10 # See BUILD.gn in this directory for usage example. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 # Work around LD failure for x86 Debug buiilds when it fails with error: | 82 # Work around LD failure for x86 Debug buiilds when it fails with error: |
| 83 # ld: scattered reloc r_address too large for architecture i386 | 83 # ld: scattered reloc r_address too large for architecture i386 |
| 84 if options.current_cpu == "x86": | 84 if options.current_cpu == "x86": |
| 85 # Combmine input lib with dependencies into output lib. | 85 # Combmine input lib with dependencies into output lib. |
| 86 command = [ | 86 command = [ |
| 87 'xcrun', 'libtool', '-static', '-no_warning_for_no_symbols', | 87 'xcrun', 'libtool', '-static', '-no_warning_for_no_symbols', |
| 88 '-o', options.output_lib, | 88 '-o', options.output_lib, |
| 89 options.input_libs, options.deps_lib, | 89 options.input_libs, options.deps_lib, |
| 90 ] | 90 ] |
| 91 subprocess.check_call(command) | 91 subprocess.check_call(command) |
| 92 # Strip debug info from output lib so its size doesn't exceed 512mb. |
| 93 command = [ |
| 94 'xcrun', 'strip', '-S', options.output_lib, |
| 95 ] |
| 96 subprocess.check_call(command) |
| 92 return | 97 return |
| 93 | 98 |
| 94 if os.path.exists(options.output_lib): | 99 if os.path.exists(options.output_lib): |
| 95 os.remove(options.output_lib) | 100 os.remove(options.output_lib) |
| 96 | 101 |
| 97 # Creates a .a file which contains a single .o file. | 102 # Creates a .a file which contains a single .o file. |
| 98 command = [ | 103 command = [ |
| 99 'xcrun', 'ar', '-r', | 104 'xcrun', 'ar', '-r', |
| 100 options.output_lib, | 105 options.output_lib, |
| 101 options.output_obj, | 106 options.output_obj, |
| 102 ] | 107 ] |
| 103 subprocess.check_call(command) | 108 subprocess.check_call(command) |
| 104 | 109 |
| 105 | 110 |
| 106 if __name__ == "__main__": | 111 if __name__ == "__main__": |
| 107 main() | 112 main() |
| OLD | NEW |