Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(644)

Unified Diff: webrtc/build/ios/merge_ios_libs.py

Issue 1875003004: Fix WebRTC API framework build. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Update scripts Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« webrtc/build/ios/flatten_ios_headers.py ('K') | « webrtc/build/ios/merge_ios_libs ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/build/ios/merge_ios_libs.py
diff --git a/webrtc/build/ios/merge_ios_libs b/webrtc/build/ios/merge_ios_libs.py
similarity index 82%
rename from webrtc/build/ios/merge_ios_libs
rename to webrtc/build/ios/merge_ios_libs.py
index d96d5e3c0c69c0b93d7ae6aab39061f939bfca7c..0b9a337a3cd57a927ccf45840132473163633950 100755
--- a/webrtc/build/ios/merge_ios_libs
+++ b/webrtc/build/ios/merge_ios_libs.py
@@ -16,6 +16,8 @@ import re
import subprocess
import sys
+# Valid arch subdir names.
+VALID_ARCHS = ['arm_libs', 'arm64_libs', 'ia32_libs', 'x64_libs']
def MergeLibs(lib_base_dir):
kjellander_webrtc 2016/04/15 04:59:41 nit: +1 blank line before top-level definition htt
tkchin_webrtc 2016/04/16 00:34:19 Done.
"""Merges generated iOS libraries for different archs.
@@ -29,24 +31,22 @@ def MergeLibs(lib_base_dir):
Returns:
Exit code of libtool.
"""
- include_dir_name = 'include'
- output_dir_name = 'lib'
+ output_dir_name = 'fat_libs'
archs = [arch for arch in os.listdir(lib_base_dir)
- if arch[:1] != '.' and arch != output_dir_name
- and arch != include_dir_name]
+ if arch in VALID_ARCHS]
# For each arch, find (library name, libary path) for arch. We will merge
# all libraries with the same name.
libs = {}
- for dirpath, _, filenames in os.walk(lib_base_dir):
- if dirpath.endswith(output_dir_name):
+ for lib_dir in [os.path.join(lib_base_dir, arch) for arch in VALID_ARCHS]:
+ if not os.path.exists(lib_dir):
continue
- for filename in filenames:
- if not filename.endswith('.a'):
- continue
- entry = libs.get(filename, [])
- entry.append(os.path.join(dirpath, filename))
- libs[filename] = entry
-
+ for dirpath, _, filenames in os.walk(lib_dir):
+ for filename in filenames:
+ if not filename.endswith('.a'):
+ continue
+ entry = libs.get(filename, [])
+ entry.append(os.path.join(dirpath, filename))
+ libs[filename] = entry
orphaned_libs = {}
valid_libs = {}
for library, paths in libs.items():
@@ -69,7 +69,6 @@ def MergeLibs(lib_base_dir):
if not found:
base_prefix = library[:-2].split('_')[0]
for valid_lib, valid_paths in valid_libs.items():
- prefix = '_'.join(components)
if valid_lib[:len(base_prefix)] == base_prefix:
valid_paths.extend(paths)
found = True
@@ -89,6 +88,7 @@ def MergeLibs(lib_base_dir):
libtool_re = re.compile(r'^.*libtool:.*file: .* has no symbols$')
# Merge libraries using libtool.
+ libtool_returncode = 0
for library, paths in valid_libs.items():
cmd_list = ['libtool', '-static', '-v', '-o',
os.path.join(output_dir_path, library)] + paths
@@ -99,14 +99,15 @@ def MergeLibs(lib_base_dir):
print >>sys.stderr, line
# Unconditionally touch the output .a file on the command line if present
# and the command succeeded. A bit hacky.
- if not libtoolout.returncode:
+ libtool_returncode = libtoolout.returncode
+ if not libtool_returncode:
for i in range(len(cmd_list) - 1):
if cmd_list[i] == '-o' and cmd_list[i+1].endswith('.a'):
os.utime(cmd_list[i+1], None)
break
else:
- return libtoolout.returncode
- return libtoolout.returncode
+ return libtool_returncode
kjellander_webrtc 2016/04/15 04:59:42 You can skip this else statement.
tkchin_webrtc 2016/04/16 00:34:19 Done.
+ return libtool_returncode
def Main():
« webrtc/build/ios/flatten_ios_headers.py ('K') | « webrtc/build/ios/merge_ios_libs ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698