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