diff options
author | Martin Storsjo <martin@martin.st> | 2017-09-13 06:55:44 +0000 |
---|---|---|
committer | Martin Storsjo <martin@martin.st> | 2017-09-13 06:55:44 +0000 |
commit | fb8eb6fce81e2f385de9b493f9cb352db572fb78 (patch) | |
tree | da58cec35cff9021724df10551ed50373e9710d6 /libcxx/utils/merge_archives.py | |
parent | 6cab129464a853bfd05d568598b206e5c4b5ceaa (diff) | |
download | bcm5719-llvm-fb8eb6fce81e2f385de9b493f9cb352db572fb78.tar.gz bcm5719-llvm-fb8eb6fce81e2f385de9b493f9cb352db572fb78.zip |
Use CMAKE_AR instead of the system default 'ar' for merging static libraries
Using the system default 'ar' might not be the right choice when
cross compiling.
Don't prepend the ar options by a dash, not all ar implementations
support that (llvm-ar doesn't).
Also pass the 's' option when creating the merged library, to create
an index.
Differential Revision: https://reviews.llvm.org/D37134
llvm-svn: 313122
Diffstat (limited to 'libcxx/utils/merge_archives.py')
-rwxr-xr-x | libcxx/utils/merge_archives.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libcxx/utils/merge_archives.py b/libcxx/utils/merge_archives.py index ee0f7d334f5..58d92f0e21e 100755 --- a/libcxx/utils/merge_archives.py +++ b/libcxx/utils/merge_archives.py @@ -94,12 +94,18 @@ def main(): help='Paths to search for the libraries along', action='append', nargs=1) parser.add_argument( + '--ar', dest='ar_exe', required=False, + help='The ar executable to use, finds \'ar\' in the path if not given', + type=str, action='store') + parser.add_argument( 'archives', metavar='archives', nargs='+', help='The archives to merge') args = parser.parse_args() - ar_exe = distutils.spawn.find_executable('ar') + ar_exe = args.ar_exe + if not ar_exe: + ar_exe = distutils.spawn.find_executable('ar') if not ar_exe: print_and_exit("failed to find 'ar' executable") @@ -115,13 +121,13 @@ def main(): temp_directory_root = tempfile.mkdtemp('.libcxx.merge.archives') for arc in archives: - execute_command_verbose([ar_exe, '-x', arc], cwd=temp_directory_root, + execute_command_verbose([ar_exe, 'x', arc], cwd=temp_directory_root, verbose=args.verbose) files = glob.glob(os.path.join(temp_directory_root, '*.o*')) if not files: print_and_exit('Failed to glob for %s' % temp_directory_root) - cmd = [ar_exe, '-qc', args.output] + files + cmd = [ar_exe, 'qcs', args.output] + files execute_command_verbose(cmd, cwd=temp_directory_root, verbose=args.verbose) |