| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 3 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
| 4 # | 4 # |
| 5 # Use of this source code is governed by a BSD-style license | 5 # Use of this source code is governed by a BSD-style license |
| 6 # that can be found in the LICENSE file in the root of the source | 6 # that can be found in the LICENSE file in the root of the source |
| 7 # tree. An additional intellectual property rights grant can be found | 7 # tree. An additional intellectual property rights grant can be found |
| 8 # in the file PATENTS. All contributing project authors may | 8 # in the file PATENTS. All contributing project authors may |
| 9 # be found in the AUTHORS file in the root of the source tree. | 9 # be found in the AUTHORS file in the root of the source tree. |
| 10 | 10 |
| 11 """WebRTC iOS FAT libraries build script. | 11 """WebRTC iOS FAT libraries build script. |
| 12 Each architecture is compiled separately before being merged together. | 12 Each architecture is compiled separately before being merged together. |
| 13 By default, the library is created in out_ios_libs/. (Change with -o.) | 13 By default, the library is created in out_ios_libs/. (Change with -o.) |
| 14 The headers will be copied to out_ios_libs/include. | 14 The headers will be copied to out_ios_libs/include. |
| 15 """ | 15 """ |
| 16 | 16 |
| 17 import argparse | 17 import argparse |
| 18 import distutils.dir_util | 18 import distutils.dir_util |
| 19 import logging | 19 import logging |
| 20 import os | 20 import os |
| 21 import shutil | 21 import shutil |
| 22 import subprocess | 22 import subprocess |
| 23 import sys | 23 import sys |
| 24 | 24 |
| 25 | 25 |
| 26 os.environ['PATH'] = '/usr/libexec' + os.pathsep + os.environ['PATH'] | 26 os.environ['PATH'] = '/usr/libexec' + os.pathsep + os.environ['PATH'] |
| 27 | 27 |
| 28 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | 28 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
| 29 WEBRTC_BASE_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, '..', '..')) | 29 WEBRTC_SRC_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, '..', '..')) |
| 30 SDK_OUTPUT_DIR = os.path.join(WEBRTC_BASE_DIR, 'out_ios_libs') | 30 SDK_OUTPUT_DIR = os.path.join(WEBRTC_SRC_DIR, 'out_ios_libs') |
| 31 SDK_LIB_NAME = 'librtc_sdk_objc.a' | 31 SDK_LIB_NAME = 'librtc_sdk_objc.a' |
| 32 SDK_FRAMEWORK_NAME = 'WebRTC.framework' | 32 SDK_FRAMEWORK_NAME = 'WebRTC.framework' |
| 33 | 33 |
| 34 DEFAULT_ARCHS = ENABLED_ARCHS = ['arm64', 'arm', 'x64', 'x86'] | 34 DEFAULT_ARCHS = ENABLED_ARCHS = ['arm64', 'arm', 'x64', 'x86'] |
| 35 IOS_DEPLOYMENT_TARGET = '8.0' | 35 IOS_DEPLOYMENT_TARGET = '8.0' |
| 36 LIBVPX_BUILD_VP9 = False | 36 LIBVPX_BUILD_VP9 = False |
| 37 | 37 |
| 38 | 38 |
| 39 def _ParseArgs(): | 39 def _ParseArgs(): |
| 40 parser = argparse.ArgumentParser(description=__doc__) | 40 parser = argparse.ArgumentParser(description=__doc__) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 63 parser.add_argument('--use-goma', action='store_true', default=False, | 63 parser.add_argument('--use-goma', action='store_true', default=False, |
| 64 help='Use goma to build.') | 64 help='Use goma to build.') |
| 65 parser.add_argument('--extra-gn-args', default=[], nargs='*', | 65 parser.add_argument('--extra-gn-args', default=[], nargs='*', |
| 66 help='Additional GN args to be used during Ninja generation.') | 66 help='Additional GN args to be used during Ninja generation.') |
| 67 | 67 |
| 68 return parser.parse_args() | 68 return parser.parse_args() |
| 69 | 69 |
| 70 | 70 |
| 71 def _RunCommand(cmd): | 71 def _RunCommand(cmd): |
| 72 logging.debug('Running: %r', cmd) | 72 logging.debug('Running: %r', cmd) |
| 73 subprocess.check_call(cmd) | 73 subprocess.check_call(cmd, cwd=WEBRTC_SRC_DIR) |
| 74 | 74 |
| 75 | 75 |
| 76 def _CleanArtifacts(output_dir): | 76 def _CleanArtifacts(output_dir): |
| 77 if os.path.isdir(output_dir): | 77 if os.path.isdir(output_dir): |
| 78 logging.info('Deleting %s', output_dir) | 78 logging.info('Deleting %s', output_dir) |
| 79 shutil.rmtree(output_dir) | 79 shutil.rmtree(output_dir) |
| 80 | 80 |
| 81 | 81 |
| 82 def BuildWebRTC(output_dir, target_arch, flavor, build_type, | 82 def BuildWebRTC(output_dir, target_arch, flavor, build_type, |
| 83 ios_deployment_target, libvpx_build_vp9, use_bitcode, | 83 ios_deployment_target, libvpx_build_vp9, use_bitcode, |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 'Set :CFBundleVersion ' + version_number, infoplist_path] | 212 'Set :CFBundleVersion ' + version_number, infoplist_path] |
| 213 _RunCommand(cmd) | 213 _RunCommand(cmd) |
| 214 _RunCommand(['plutil', '-convert', 'binary1', infoplist_path]) | 214 _RunCommand(['plutil', '-convert', 'binary1', infoplist_path]) |
| 215 | 215 |
| 216 logging.info('Done.') | 216 logging.info('Done.') |
| 217 return 0 | 217 return 0 |
| 218 | 218 |
| 219 | 219 |
| 220 if __name__ == '__main__': | 220 if __name__ == '__main__': |
| 221 sys.exit(main()) | 221 sys.exit(main()) |
| OLD | NEW |