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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 175 |
172 | 176 |
173 def main(args): | 177 def main(args): |
174 parser = optparse.OptionParser('usage: %prog [OPTIONS]', description=__doc__) | 178 parser = optparse.OptionParser('usage: %prog [OPTIONS]', description=__doc__) |
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) |
| 185 host_arch = DetectHostArch() |
181 if options.running_as_hook and not sys.platform.startswith('linux'): | 186 if options.running_as_hook and not sys.platform.startswith('linux'): |
182 return 0 | 187 return 0 |
183 | 188 |
| 189 # PPC/s390 don't use sysroot, see http://crbug.com/646169 |
| 190 if host_arch in ('ppc','s390'): |
| 191 return 0 |
| 192 |
184 if options.running_as_hook: | 193 if options.running_as_hook: |
185 InstallDefaultSysroots() | 194 InstallDefaultSysroots() |
186 else: | 195 else: |
187 if not options.arch: | 196 if not options.arch: |
188 print 'You much specify either --arch or --running-as-hook' | 197 print 'You much specify either --arch or --running-as-hook' |
189 return 1 | 198 return 1 |
190 InstallDefaultSysrootForArch(options.arch) | 199 InstallDefaultSysrootForArch(options.arch) |
191 | 200 |
192 return 0 | 201 return 0 |
193 | 202 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 with open(stamp, 'w') as s: | 259 with open(stamp, 'w') as s: |
251 s.write(url) | 260 s.write(url) |
252 | 261 |
253 | 262 |
254 if __name__ == '__main__': | 263 if __name__ == '__main__': |
255 try: | 264 try: |
256 sys.exit(main(sys.argv[1:])) | 265 sys.exit(main(sys.argv[1:])) |
257 except Error as e: | 266 except Error as e: |
258 sys.stderr.write(str(e) + '\n') | 267 sys.stderr.write(str(e) + '\n') |
259 sys.exit(1) | 268 sys.exit(1) |
OLD | NEW |