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' | |
115 | 111 |
116 raise Error('Unrecognized host arch: %s' % detected_host_arch) | 112 raise Error('Unrecognized host arch: %s' % detected_host_arch) |
117 | 113 |
118 | 114 |
119 def DetectTargetArch(): | 115 def DetectTargetArch(): |
120 """Attempt for determine target architecture. | 116 """Attempt for determine target architecture. |
121 | 117 |
122 This works by looking for target_arch in GYP_DEFINES. | 118 This works by looking for target_arch in GYP_DEFINES. |
123 """ | 119 """ |
124 # TODO(agrieve): Make this script not depend on GYP_DEFINES so that it works | 120 # 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... |
175 | 171 |
176 | 172 |
177 def main(args): | 173 def main(args): |
178 parser = optparse.OptionParser('usage: %prog [OPTIONS]', description=__doc__) | 174 parser = optparse.OptionParser('usage: %prog [OPTIONS]', description=__doc__) |
179 parser.add_option('--running-as-hook', action='store_true', | 175 parser.add_option('--running-as-hook', action='store_true', |
180 default=False, help='Used when running from gclient hooks.' | 176 default=False, help='Used when running from gclient hooks.' |
181 ' Installs default sysroot images.') | 177 ' Installs default sysroot images.') |
182 parser.add_option('--arch', type='choice', choices=valid_archs, | 178 parser.add_option('--arch', type='choice', choices=valid_archs, |
183 help='Sysroot architecture: %s' % ', '.join(valid_archs)) | 179 help='Sysroot architecture: %s' % ', '.join(valid_archs)) |
184 options, _ = parser.parse_args(args) | 180 options, _ = parser.parse_args(args) |
185 host_arch = DetectHostArch() | |
186 if options.running_as_hook and not sys.platform.startswith('linux'): | 181 if options.running_as_hook and not sys.platform.startswith('linux'): |
187 return 0 | 182 return 0 |
188 | 183 |
189 # PPC/s390 don't use sysroot, see http://crbug.com/646169 | |
190 if host_arch in ('ppc','s390'): | |
191 return 0 | |
192 | |
193 if options.running_as_hook: | 184 if options.running_as_hook: |
194 InstallDefaultSysroots() | 185 InstallDefaultSysroots() |
195 else: | 186 else: |
196 if not options.arch: | 187 if not options.arch: |
197 print 'You much specify either --arch or --running-as-hook' | 188 print 'You much specify either --arch or --running-as-hook' |
198 return 1 | 189 return 1 |
199 InstallDefaultSysrootForArch(options.arch) | 190 InstallDefaultSysrootForArch(options.arch) |
200 | 191 |
201 return 0 | 192 return 0 |
202 | 193 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 with open(stamp, 'w') as s: | 250 with open(stamp, 'w') as s: |
260 s.write(url) | 251 s.write(url) |
261 | 252 |
262 | 253 |
263 if __name__ == '__main__': | 254 if __name__ == '__main__': |
264 try: | 255 try: |
265 sys.exit(main(sys.argv[1:])) | 256 sys.exit(main(sys.argv[1:])) |
266 except Error as e: | 257 except Error as e: |
267 sys.stderr.write(str(e) + '\n') | 258 sys.stderr.write(str(e) + '\n') |
268 sys.exit(1) | 259 sys.exit(1) |
OLD | NEW |