Chromium Code Reviews| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 | 120 |
| 121 if host_arch == 'amd64': | 121 if host_arch == 'amd64': |
| 122 InstallDefaultSysrootForArch('i386') | 122 InstallDefaultSysrootForArch('i386') |
| 123 | 123 |
| 124 # Desktop Chromium OS builds require the precise sysroot. | 124 # Desktop Chromium OS builds require the precise sysroot. |
| 125 # TODO(thomasanderson): only download this when the GN arg target_os | 125 # TODO(thomasanderson): only download this when the GN arg target_os |
| 126 # == 'chromeos', when the functionality to perform the check becomes | 126 # == 'chromeos', when the functionality to perform the check becomes |
| 127 # available. | 127 # available. |
| 128 InstallSysroot('Precise', 'amd64') | 128 InstallSysroot('Precise', 'amd64') |
| 129 | 129 |
| 130 # Finally, if we can detect a non-standard target_arch such as ARM or | 130 # If we can detect a non-standard target_arch such as ARM or MIPS, |
| 131 # MIPS, then install the sysroot too. | 131 # then install the sysroot too. Don't attampt to install arm64 |
|
Dirk Pranke
2017/01/23 22:39:53
Nit: s/attampt/attempt
Tom (Use chromium acct)
2017/01/24 01:30:00
Done.
| |
| 132 # Don't attampt to install arm64 since this is currently and android-only | 132 # since this is currently and android-only architecture. |
| 133 # architecture. | |
| 134 target_arch = DetectTargetArch() | 133 target_arch = DetectTargetArch() |
| 135 if target_arch and target_arch not in (host_arch, 'i386'): | 134 if target_arch and target_arch not in (host_arch, 'i386'): |
| 136 InstallDefaultSysrootForArch(target_arch) | 135 InstallDefaultSysrootForArch(target_arch) |
| 137 | 136 |
| 137 # Desktop Linux ozone builds require libxkbcommon* which is not | |
| 138 # available in Wheezy. | |
| 139 # TODO(thomasanderson): Remove this once the Jessie sysroot is used | |
| 140 # by default. | |
| 141 gyp_defines = gyp_chromium.GetGypVars(gyp_chromium.GetSupplementalFiles()) | |
| 142 if 'use_ozone' in gyp_defines and gyp_defines['use_ozone'] == '1': | |
|
Dirk Pranke
2017/01/23 22:39:53
Nit:
if gyp_defines.get('use_ozone') == '1':
Tom (Use chromium acct)
2017/01/24 01:30:00
Done.
| |
| 143 InstallSysroot('Jessie', 'amd64') | |
| 144 | |
| 138 | 145 |
| 139 def main(args): | 146 def main(args): |
| 140 parser = optparse.OptionParser('usage: %prog [OPTIONS]', description=__doc__) | 147 parser = optparse.OptionParser('usage: %prog [OPTIONS]', description=__doc__) |
| 141 parser.add_option('--running-as-hook', action='store_true', | 148 parser.add_option('--running-as-hook', action='store_true', |
| 142 default=False, help='Used when running from gclient hooks.' | 149 default=False, help='Used when running from gclient hooks.' |
| 143 ' Installs default sysroot images.') | 150 ' Installs default sysroot images.') |
| 144 parser.add_option('--arch', type='choice', choices=VALID_ARCHS, | 151 parser.add_option('--arch', type='choice', choices=VALID_ARCHS, |
| 145 help='Sysroot architecture: %s' % ', '.join(VALID_ARCHS)) | 152 help='Sysroot architecture: %s' % ', '.join(VALID_ARCHS)) |
| 146 options, _ = parser.parse_args(args) | 153 options, _ = parser.parse_args(args) |
| 147 if options.running_as_hook and not sys.platform.startswith('linux'): | 154 if options.running_as_hook and not sys.platform.startswith('linux'): |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 tarball_filename = sysroot_dict['Tarball'] | 198 tarball_filename = sysroot_dict['Tarball'] |
| 192 tarball_sha1sum = sysroot_dict['Sha1Sum'] | 199 tarball_sha1sum = sysroot_dict['Sha1Sum'] |
| 193 sysroot = os.path.join(linux_dir, sysroot_dict['SysrootDir']) | 200 sysroot = os.path.join(linux_dir, sysroot_dict['SysrootDir']) |
| 194 | 201 |
| 195 url = '%s/%s/%s/%s' % (URL_PREFIX, URL_PATH, revision, tarball_filename) | 202 url = '%s/%s/%s/%s' % (URL_PREFIX, URL_PATH, revision, tarball_filename) |
| 196 | 203 |
| 197 stamp = os.path.join(sysroot, '.stamp') | 204 stamp = os.path.join(sysroot, '.stamp') |
| 198 if os.path.exists(stamp): | 205 if os.path.exists(stamp): |
| 199 with open(stamp) as s: | 206 with open(stamp) as s: |
| 200 if s.read() == url: | 207 if s.read() == url: |
| 201 print 'Debian %s %s root image already up to date: %s' % \ | 208 print '%s %s sysroot image already up to date: %s' % \ |
| 202 (target_platform, target_arch, sysroot) | 209 (target_platform, target_arch, sysroot) |
| 203 return | 210 return |
| 204 | 211 |
| 205 print 'Installing Debian %s %s root image: %s' % \ | 212 print 'Installing Debian %s %s root image: %s' % \ |
| 206 (target_platform, target_arch, sysroot) | 213 (target_platform, target_arch, sysroot) |
| 207 if os.path.isdir(sysroot): | 214 if os.path.isdir(sysroot): |
| 208 shutil.rmtree(sysroot) | 215 shutil.rmtree(sysroot) |
| 209 os.mkdir(sysroot) | 216 os.mkdir(sysroot) |
| 210 tarball = os.path.join(sysroot, tarball_filename) | 217 tarball = os.path.join(sysroot, tarball_filename) |
| 211 print 'Downloading %s' % url | 218 print 'Downloading %s' % url |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 231 with open(stamp, 'w') as s: | 238 with open(stamp, 'w') as s: |
| 232 s.write(url) | 239 s.write(url) |
| 233 | 240 |
| 234 | 241 |
| 235 if __name__ == '__main__': | 242 if __name__ == '__main__': |
| 236 try: | 243 try: |
| 237 sys.exit(main(sys.argv[1:])) | 244 sys.exit(main(sys.argv[1:])) |
| 238 except Error as e: | 245 except Error as e: |
| 239 sys.stderr.write(str(e) + '\n') | 246 sys.stderr.write(str(e) + '\n') |
| 240 sys.exit(1) | 247 sys.exit(1) |
| OLD | NEW |