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 |
(...skipping 16 matching lines...) Expand all Loading... |
27 import argparse | 27 import argparse |
28 import logging | 28 import logging |
29 import os | 29 import os |
30 import shutil | 30 import shutil |
31 import subprocess | 31 import subprocess |
32 import sys | 32 import sys |
33 import tempfile | 33 import tempfile |
34 import zipfile | 34 import zipfile |
35 | 35 |
36 | 36 |
37 DEFAULT_ARCHS = ['armeabi-v7a', 'x86'] | 37 DEFAULT_ARCHS = ['armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'] |
38 NEEDED_SO_FILES = ['libjingle_peerconnection_so.so'] | 38 NEEDED_SO_FILES = ['libjingle_peerconnection_so.so'] |
39 JAR_FILE = 'lib.java/webrtc/sdk/android/libwebrtc.jar' | 39 JAR_FILE = 'lib.java/webrtc/sdk/android/libwebrtc.jar' |
40 MANIFEST_FILE = 'webrtc/sdk/android/AndroidManifest.xml' | 40 MANIFEST_FILE = 'webrtc/sdk/android/AndroidManifest.xml' |
41 TARGETS = [ | 41 TARGETS = [ |
42 'webrtc/sdk/android:libwebrtc', | 42 'webrtc/sdk/android:libwebrtc', |
43 'webrtc/sdk/android:libjingle_peerconnection_so', | 43 'webrtc/sdk/android:libjingle_peerconnection_so', |
44 ] | 44 ] |
45 | 45 |
46 | 46 |
47 def _ParseArgs(): | 47 def _ParseArgs(): |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 def _GetOutputDirectory(tmp_dir, arch): | 86 def _GetOutputDirectory(tmp_dir, arch): |
87 """Returns the GN output directory for the target architecture.""" | 87 """Returns the GN output directory for the target architecture.""" |
88 return os.path.join(tmp_dir, arch) | 88 return os.path.join(tmp_dir, arch) |
89 | 89 |
90 | 90 |
91 def _GetTargetCpu(arch): | 91 def _GetTargetCpu(arch): |
92 """Returns target_cpu for the GN build with the given architecture.""" | 92 """Returns target_cpu for the GN build with the given architecture.""" |
93 if arch in ['armeabi', 'armeabi-v7a']: | 93 if arch in ['armeabi', 'armeabi-v7a']: |
94 return 'arm' | 94 return 'arm' |
| 95 elif arch == 'arm64-v8a': |
| 96 return 'arm64' |
95 elif arch == 'x86': | 97 elif arch == 'x86': |
96 return 'x86' | 98 return 'x86' |
| 99 elif arch == 'x86_64': |
| 100 return 'x64' |
97 else: | 101 else: |
98 raise Exception('Unknown arch: ' + arch) | 102 raise Exception('Unknown arch: ' + arch) |
99 | 103 |
100 | 104 |
101 def _GetArmVersion(arch): | 105 def _GetArmVersion(arch): |
102 """Returns arm_version for the GN build with the given architecture.""" | 106 """Returns arm_version for the GN build with the given architecture.""" |
103 if arch == 'armeabi': | 107 if arch == 'armeabi': |
104 return 6 | 108 return 6 |
105 elif arch == 'armeabi-v7a': | 109 elif arch == 'armeabi-v7a': |
106 return 7 | 110 return 7 |
107 elif arch == 'x86': | 111 elif arch in ['arm64-v8a', 'x86', 'x86_64']: |
108 return None | 112 return None |
109 else: | 113 else: |
110 raise Exception('Unknown arch: ' + arch) | 114 raise Exception('Unknown arch: ' + arch) |
111 | 115 |
112 | 116 |
113 def Build(tmp_dir, arch, use_goma, extra_gn_args): | 117 def Build(tmp_dir, arch, use_goma, extra_gn_args): |
114 """Generates target architecture using GN and builds it using ninja.""" | 118 """Generates target architecture using GN and builds it using ninja.""" |
115 logging.info('Building: %s', arch) | 119 logging.info('Building: %s', arch) |
116 output_directory = _GetOutputDirectory(tmp_dir, arch) | 120 output_directory = _GetOutputDirectory(tmp_dir, arch) |
117 gn_args = { | 121 gn_args = { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 # Architecture doesn't matter here, arbitrarily using the first one. | 171 # Architecture doesn't matter here, arbitrarily using the first one. |
168 CollectCommon(aar_file, tmp_dir, args.arch[0]) | 172 CollectCommon(aar_file, tmp_dir, args.arch[0]) |
169 for arch in args.arch: | 173 for arch in args.arch: |
170 Collect(aar_file, tmp_dir, arch) | 174 Collect(aar_file, tmp_dir, arch) |
171 | 175 |
172 shutil.rmtree(tmp_dir, True) | 176 shutil.rmtree(tmp_dir, True) |
173 | 177 |
174 | 178 |
175 if __name__ == '__main__': | 179 if __name__ == '__main__': |
176 sys.exit(main()) | 180 sys.exit(main()) |
OLD | NEW |