OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Install Debian sysroots for building chromium. | 6 """Install Debian sysroots for building chromium. |
7 """ | 7 """ |
8 | 8 |
9 # The sysroot is needed to ensure that binaries will run on Debian Wheezy, | 9 # The sysroot is needed to ensure that binaries will run on Debian Wheezy, |
10 # the oldest supported linux distribution. For ARM64 linux, we have Debian | 10 # the oldest supported linux distribution. For ARM64 linux, we have Debian |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 if detected_host_arch == 'x64': | 101 if detected_host_arch == 'x64': |
102 return 'amd64' | 102 return 'amd64' |
103 elif detected_host_arch == 'ia32': | 103 elif detected_host_arch == 'ia32': |
104 return 'i386' | 104 return 'i386' |
105 elif detected_host_arch == 'arm': | 105 elif detected_host_arch == 'arm': |
106 return 'arm' | 106 return 'arm' |
107 elif detected_host_arch == 'arm64': | 107 elif detected_host_arch == 'arm64': |
108 return 'arm64' | 108 return 'arm64' |
109 elif detected_host_arch == 'mips': | 109 elif detected_host_arch == 'mips': |
110 return 'mips' | 110 return 'mips' |
111 elif detected_host_arch == 'ppc': | |
112 return 'ppc' | |
113 elif detected_host_arch == 's390': | |
114 return 's390' | |
111 | 115 |
112 raise Error('Unrecognized host arch: %s' % detected_host_arch) | 116 raise Error('Unrecognized host arch: %s' % detected_host_arch) |
113 | 117 |
114 | 118 |
115 def DetectTargetArch(): | 119 def DetectTargetArch(): |
116 """Attempt for determine target architecture. | 120 """Attempt for determine target architecture. |
117 | 121 |
118 This works by looking for target_arch in GYP_DEFINES. | 122 This works by looking for target_arch in GYP_DEFINES. |
119 """ | 123 """ |
120 # TODO(agrieve): Make this script not depend on GYP_DEFINES so that it works | 124 # TODO(agrieve): Make this script not depend on GYP_DEFINES so that it works |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 parser.add_option('--running-as-hook', action='store_true', | 179 parser.add_option('--running-as-hook', action='store_true', |
176 default=False, help='Used when running from gclient hooks.' | 180 default=False, help='Used when running from gclient hooks.' |
177 ' Installs default sysroot images.') | 181 ' Installs default sysroot images.') |
178 parser.add_option('--arch', type='choice', choices=valid_archs, | 182 parser.add_option('--arch', type='choice', choices=valid_archs, |
179 help='Sysroot architecture: %s' % ', '.join(valid_archs)) | 183 help='Sysroot architecture: %s' % ', '.join(valid_archs)) |
180 options, _ = parser.parse_args(args) | 184 options, _ = parser.parse_args(args) |
181 if options.running_as_hook and not sys.platform.startswith('linux'): | 185 if options.running_as_hook and not sys.platform.startswith('linux'): |
182 return 0 | 186 return 0 |
183 | 187 |
184 if options.running_as_hook: | 188 if options.running_as_hook: |
189 # PPC/s390 don't use sysroot, see http://crbug.com/646169 | |
190 if DetectHostArch() in ['ppc','s390']: | |
191 return 0 | |
185 InstallDefaultSysroots() | 192 InstallDefaultSysroots() |
agrieve
2016/09/29 23:59:43
nit: can you change this so that it takes the host
| |
186 else: | 193 else: |
187 if not options.arch: | 194 if not options.arch: |
188 print 'You much specify either --arch or --running-as-hook' | 195 print 'You much specify either --arch or --running-as-hook' |
189 return 1 | 196 return 1 |
190 InstallDefaultSysrootForArch(options.arch) | 197 InstallDefaultSysrootForArch(options.arch) |
191 | 198 |
192 return 0 | 199 return 0 |
193 | 200 |
194 def InstallDefaultSysrootForArch(target_arch): | 201 def InstallDefaultSysrootForArch(target_arch): |
195 if target_arch == 'amd64': | 202 if target_arch == 'amd64': |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
250 with open(stamp, 'w') as s: | 257 with open(stamp, 'w') as s: |
251 s.write(url) | 258 s.write(url) |
252 | 259 |
253 | 260 |
254 if __name__ == '__main__': | 261 if __name__ == '__main__': |
255 try: | 262 try: |
256 sys.exit(main(sys.argv[1:])) | 263 sys.exit(main(sys.argv[1:])) |
257 except Error as e: | 264 except Error as e: |
258 sys.stderr.write(str(e) + '\n') | 265 sys.stderr.write(str(e) + '\n') |
259 sys.exit(1) | 266 sys.exit(1) |
OLD | NEW |