| 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 Wheezy sysroots for building chromium. | 6 """Install Debian Wheezy 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. This script can be run manually but | 10 # the oldest supported linux distribution. This script can be run manually but |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 sys.path.append(os.path.dirname(os.path.dirname(SCRIPT_DIR))) | 29 sys.path.append(os.path.dirname(os.path.dirname(SCRIPT_DIR))) |
| 30 import detect_host_arch | 30 import detect_host_arch |
| 31 import gyp_chromium | 31 import gyp_chromium |
| 32 import gyp_environment | 32 import gyp_environment |
| 33 | 33 |
| 34 | 34 |
| 35 URL_PREFIX = 'https://commondatastorage.googleapis.com' | 35 URL_PREFIX = 'https://commondatastorage.googleapis.com' |
| 36 URL_PATH = 'chrome-linux-sysroot/toolchain' | 36 URL_PATH = 'chrome-linux-sysroot/toolchain' |
| 37 REVISION_AMD64 = 'c52471d9dec240c8d0a88fa98aa1eefeee32e22f' | 37 REVISION_AMD64 = 'c52471d9dec240c8d0a88fa98aa1eefeee32e22f' |
| 38 REVISION_ARM = 'c52471d9dec240c8d0a88fa98aa1eefeee32e22f' | 38 REVISION_ARM = 'c52471d9dec240c8d0a88fa98aa1eefeee32e22f' |
| 39 REVISION_ARM64 = 'bd10c315594d2a20e31a94a7a6c7adb9a0961c56' | |
| 40 REVISION_I386 = 'c52471d9dec240c8d0a88fa98aa1eefeee32e22f' | 39 REVISION_I386 = 'c52471d9dec240c8d0a88fa98aa1eefeee32e22f' |
| 41 REVISION_MIPS = 'c52471d9dec240c8d0a88fa98aa1eefeee32e22f' | 40 REVISION_MIPS = 'c52471d9dec240c8d0a88fa98aa1eefeee32e22f' |
| 42 TARBALL_AMD64 = 'debian_wheezy_amd64_sysroot.tgz' | 41 TARBALL_AMD64 = 'debian_wheezy_amd64_sysroot.tgz' |
| 43 TARBALL_ARM = 'debian_wheezy_arm_sysroot.tgz' | 42 TARBALL_ARM = 'debian_wheezy_arm_sysroot.tgz' |
| 44 TARBALL_ARM64 = 'debian_jessie_arm64_sysroot.tgz' | |
| 45 TARBALL_I386 = 'debian_wheezy_i386_sysroot.tgz' | 43 TARBALL_I386 = 'debian_wheezy_i386_sysroot.tgz' |
| 46 TARBALL_MIPS = 'debian_wheezy_mips_sysroot.tgz' | 44 TARBALL_MIPS = 'debian_wheezy_mips_sysroot.tgz' |
| 47 TARBALL_AMD64_SHA1SUM = 'ca4ed6e7c9e333b046be19d38584a11f6785eea6' | 45 TARBALL_AMD64_SHA1SUM = 'ca4ed6e7c9e333b046be19d38584a11f6785eea6' |
| 48 TARBALL_ARM_SHA1SUM = '1fab0c2b1e93a933ddc593df3b43872b0ba5ded2' | 46 TARBALL_ARM_SHA1SUM = '1fab0c2b1e93a933ddc593df3b43872b0ba5ded2' |
| 49 TARBALL_ARM64_SHA1SUM = '0db3be51912e0be46bb1b906fc196c5c1dfc090f' | |
| 50 TARBALL_I386_SHA1SUM = '80c48c303319af2284e4a104c882d888af75ba81' | 47 TARBALL_I386_SHA1SUM = '80c48c303319af2284e4a104c882d888af75ba81' |
| 51 TARBALL_MIPS_SHA1SUM = '01da32a35288627e05cfca193b7f3659531c6f7d' | 48 TARBALL_MIPS_SHA1SUM = '01da32a35288627e05cfca193b7f3659531c6f7d' |
| 52 SYSROOT_DIR_AMD64 = 'debian_wheezy_amd64-sysroot' | 49 SYSROOT_DIR_AMD64 = 'debian_wheezy_amd64-sysroot' |
| 53 SYSROOT_DIR_ARM = 'debian_wheezy_arm-sysroot' | 50 SYSROOT_DIR_ARM = 'debian_wheezy_arm-sysroot' |
| 54 SYSROOT_DIR_ARM64 = 'debian_jessie_arm64-sysroot' | |
| 55 SYSROOT_DIR_I386 = 'debian_wheezy_i386-sysroot' | 51 SYSROOT_DIR_I386 = 'debian_wheezy_i386-sysroot' |
| 56 SYSROOT_DIR_MIPS = 'debian_wheezy_mips-sysroot' | 52 SYSROOT_DIR_MIPS = 'debian_wheezy_mips-sysroot' |
| 57 | 53 |
| 58 valid_archs = ('arm', 'arm64', 'i386', 'amd64', 'mips') | 54 valid_archs = ('arm', 'i386', 'amd64', 'mips') |
| 59 | 55 |
| 60 | 56 |
| 61 class Error(Exception): | 57 class Error(Exception): |
| 62 pass | 58 pass |
| 63 | 59 |
| 64 | 60 |
| 65 def GetSha1(filename): | 61 def GetSha1(filename): |
| 66 sha1 = hashlib.sha1() | 62 sha1 = hashlib.sha1() |
| 67 with open(filename, 'rb') as f: | 63 with open(filename, 'rb') as f: |
| 68 while True: | 64 while True: |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 InstallSysroot(host_arch) | 122 InstallSysroot(host_arch) |
| 127 | 123 |
| 128 if host_arch == 'amd64': | 124 if host_arch == 'amd64': |
| 129 InstallSysroot('i386') | 125 InstallSysroot('i386') |
| 130 | 126 |
| 131 # Finally, if we can detect a non-standard target_arch such as ARM or | 127 # Finally, if we can detect a non-standard target_arch such as ARM or |
| 132 # MIPS, then install the sysroot too. | 128 # MIPS, then install the sysroot too. |
| 133 # Don't attampt to install arm64 since this is currently and android-only | 129 # Don't attampt to install arm64 since this is currently and android-only |
| 134 # architecture. | 130 # architecture. |
| 135 target_arch = DetectTargetArch() | 131 target_arch = DetectTargetArch() |
| 136 if target_arch and target_arch not in (host_arch, 'i386'): | 132 if target_arch and target_arch not in (host_arch, 'i386', 'arm64'): |
| 137 InstallSysroot(target_arch) | 133 InstallSysroot(target_arch) |
| 138 | 134 |
| 139 | 135 |
| 140 def main(args): | 136 def main(args): |
| 141 parser = optparse.OptionParser('usage: %prog [OPTIONS]', description=__doc__) | 137 parser = optparse.OptionParser('usage: %prog [OPTIONS]', description=__doc__) |
| 142 parser.add_option('--running-as-hook', action='store_true', | 138 parser.add_option('--running-as-hook', action='store_true', |
| 143 default=False, help='Used when running from gclient hooks.' | 139 default=False, help='Used when running from gclient hooks.' |
| 144 ' Installs default sysroot images.') | 140 ' Installs default sysroot images.') |
| 145 parser.add_option('--arch', type='choice', choices=valid_archs, | 141 parser.add_option('--arch', type='choice', choices=valid_archs, |
| 146 help='Sysroot architecture: %s' % ', '.join(valid_archs)) | 142 help='Sysroot architecture: %s' % ', '.join(valid_archs)) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 167 if target_arch == 'amd64': | 163 if target_arch == 'amd64': |
| 168 sysroot = os.path.join(linux_dir, SYSROOT_DIR_AMD64) | 164 sysroot = os.path.join(linux_dir, SYSROOT_DIR_AMD64) |
| 169 tarball_filename = TARBALL_AMD64 | 165 tarball_filename = TARBALL_AMD64 |
| 170 tarball_sha1sum = TARBALL_AMD64_SHA1SUM | 166 tarball_sha1sum = TARBALL_AMD64_SHA1SUM |
| 171 revision = REVISION_AMD64 | 167 revision = REVISION_AMD64 |
| 172 elif target_arch == 'arm': | 168 elif target_arch == 'arm': |
| 173 sysroot = os.path.join(linux_dir, SYSROOT_DIR_ARM) | 169 sysroot = os.path.join(linux_dir, SYSROOT_DIR_ARM) |
| 174 tarball_filename = TARBALL_ARM | 170 tarball_filename = TARBALL_ARM |
| 175 tarball_sha1sum = TARBALL_ARM_SHA1SUM | 171 tarball_sha1sum = TARBALL_ARM_SHA1SUM |
| 176 revision = REVISION_ARM | 172 revision = REVISION_ARM |
| 177 elif target_arch == 'arm64': | |
| 178 sysroot = os.path.join(linux_dir, SYSROOT_DIR_ARM64) | |
| 179 tarball_filename = TARBALL_ARM64 | |
| 180 tarball_sha1sum = TARBALL_ARM64_SHA1SUM | |
| 181 revision = REVISION_ARM64 | |
| 182 elif target_arch == 'i386': | 173 elif target_arch == 'i386': |
| 183 sysroot = os.path.join(linux_dir, SYSROOT_DIR_I386) | 174 sysroot = os.path.join(linux_dir, SYSROOT_DIR_I386) |
| 184 tarball_filename = TARBALL_I386 | 175 tarball_filename = TARBALL_I386 |
| 185 tarball_sha1sum = TARBALL_I386_SHA1SUM | 176 tarball_sha1sum = TARBALL_I386_SHA1SUM |
| 186 revision = REVISION_I386 | 177 revision = REVISION_I386 |
| 187 elif target_arch == 'mips': | 178 elif target_arch == 'mips': |
| 188 sysroot = os.path.join(linux_dir, SYSROOT_DIR_MIPS) | 179 sysroot = os.path.join(linux_dir, SYSROOT_DIR_MIPS) |
| 189 tarball_filename = TARBALL_MIPS | 180 tarball_filename = TARBALL_MIPS |
| 190 tarball_sha1sum = TARBALL_MIPS_SHA1SUM | 181 tarball_sha1sum = TARBALL_MIPS_SHA1SUM |
| 191 revision = REVISION_MIPS | 182 revision = REVISION_MIPS |
| (...skipping 30 matching lines...) Expand all Loading... |
| 222 with open(stamp, 'w') as s: | 213 with open(stamp, 'w') as s: |
| 223 s.write(url) | 214 s.write(url) |
| 224 | 215 |
| 225 | 216 |
| 226 if __name__ == '__main__': | 217 if __name__ == '__main__': |
| 227 try: | 218 try: |
| 228 sys.exit(main(sys.argv[1:])) | 219 sys.exit(main(sys.argv[1:])) |
| 229 except Error as e: | 220 except Error as e: |
| 230 sys.stderr.write(str(e) + '\n') | 221 sys.stderr.write(str(e) + '\n') |
| 231 sys.exit(1) | 222 sys.exit(1) |
| OLD | NEW |