This revision was automatically updated to reflect the committed changes.
Closed by commit rL313122: Use CMAKE_AR instead of the system default 'ar' for 
merging static libraries (authored by mstorsjo).

Changed prior to commit:
  https://reviews.llvm.org/D37134?vs=114908&id=114981#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D37134

Files:
  libcxx/trunk/lib/CMakeLists.txt
  libcxx/trunk/utils/merge_archives.py


Index: libcxx/trunk/lib/CMakeLists.txt
===================================================================
--- libcxx/trunk/lib/CMakeLists.txt
+++ libcxx/trunk/lib/CMakeLists.txt
@@ -270,6 +270,7 @@
       ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/merge_archives.py
     ARGS
       -o $<TARGET_LINKER_FILE:cxx_static>
+      --ar "${CMAKE_AR}"
       "$<TARGET_LINKER_FILE:cxx_static>"
       "${MERGE_ARCHIVES_ABI_TARGET}"
       "${MERGE_ARCHIVES_SEARCH_PATHS}"
Index: libcxx/trunk/utils/merge_archives.py
===================================================================
--- libcxx/trunk/utils/merge_archives.py
+++ libcxx/trunk/utils/merge_archives.py
@@ -94,12 +94,18 @@
         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 @@
     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)
 
 


Index: libcxx/trunk/lib/CMakeLists.txt
===================================================================
--- libcxx/trunk/lib/CMakeLists.txt
+++ libcxx/trunk/lib/CMakeLists.txt
@@ -270,6 +270,7 @@
       ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/merge_archives.py
     ARGS
       -o $<TARGET_LINKER_FILE:cxx_static>
+      --ar "${CMAKE_AR}"
       "$<TARGET_LINKER_FILE:cxx_static>"
       "${MERGE_ARCHIVES_ABI_TARGET}"
       "${MERGE_ARCHIVES_SEARCH_PATHS}"
Index: libcxx/trunk/utils/merge_archives.py
===================================================================
--- libcxx/trunk/utils/merge_archives.py
+++ libcxx/trunk/utils/merge_archives.py
@@ -94,12 +94,18 @@
         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 @@
     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)
 
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to