| 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 # Script to install a Debian Wheezy sysroot for making official Google Chrome | 6 # Script to install a Debian Wheezy sysroot for making official Google Chrome |
| 7 # Linux builds. | 7 # Linux builds. |
| 8 # The sysroot is needed to make Chrome work for Debian Wheezy. | 8 # The sysroot is needed to make Chrome work for Debian Wheezy. |
| 9 # This script can be run manually but is more often run as part of gclient | 9 # This script can be run manually but is more often run as part of gclient |
| 10 # hooks. When run from hooks this script should be a no-op on non-linux | 10 # hooks. When run from hooks this script should be a no-op on non-linux |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 # Check for optional target_arch and only install for that architecture. | 74 # Check for optional target_arch and only install for that architecture. |
| 75 # If target_arch is not specified, then only install for the host | 75 # If target_arch is not specified, then only install for the host |
| 76 # architecture. | 76 # architecture. |
| 77 host_arch = '' | 77 host_arch = '' |
| 78 if 'target_arch=x64' in gyp_defines: | 78 if 'target_arch=x64' in gyp_defines: |
| 79 host_arch = 'amd64' | 79 host_arch = 'amd64' |
| 80 elif 'target_arch=ia32' in gyp_defines: | 80 elif 'target_arch=ia32' in gyp_defines: |
| 81 host_arch = 'i386' | 81 host_arch = 'i386' |
| 82 else: | 82 else: |
| 83 # Figure out host arch, like the host_arch variable in build/common.gypi. | 83 # Figure out host arch using build/detect_host_arch.py. |
| 84 machine_type = platform.machine() | 84 SRC_DIR = os.path.abspath( |
| 85 if machine_type in ['amd64', 'x86_64']: | 85 os.path.join(SCRIPT_DIR, '..', '..', '..', '..')) |
| 86 sys.path.append(os.path.join(SRC_DIR, 'build')) |
| 87 import detect_host_arch |
| 88 |
| 89 detected_host_arch = detect_host_arch.HostArch() |
| 90 if detected_host_arch == 'x64': |
| 86 host_arch = 'amd64' | 91 host_arch = 'amd64' |
| 87 elif re.match('(i[3-6]86|i86pc)$', machine_type): | 92 elif detected_host_arch == 'ia32': |
| 88 host_arch = 'i386' | 93 host_arch = 'i386' |
| 89 if host_arch != options.arch: | 94 if host_arch != options.arch: |
| 90 return 0 | 95 return 0 |
| 91 | 96 |
| 92 # The sysroot directory should match the one specified in build/common.gypi. | 97 # The sysroot directory should match the one specified in build/common.gypi. |
| 93 # TODO(thestig) Consider putting this else where to avoid having to recreate | 98 # TODO(thestig) Consider putting this else where to avoid having to recreate |
| 94 # it on every build. | 99 # it on every build. |
| 95 linux_dir = os.path.dirname(SCRIPT_DIR) | 100 linux_dir = os.path.dirname(SCRIPT_DIR) |
| 96 if options.arch == 'amd64': | 101 if options.arch == 'amd64': |
| 97 sysroot = os.path.join(linux_dir, SYSROOT_DIR_AMD64) | 102 sysroot = os.path.join(linux_dir, SYSROOT_DIR_AMD64) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 137 |
| 133 if __name__ == '__main__': | 138 if __name__ == '__main__': |
| 134 parser = optparse.OptionParser('usage: %prog [OPTIONS]') | 139 parser = optparse.OptionParser('usage: %prog [OPTIONS]') |
| 135 parser.add_option('', '--linux-only', dest='linux_only', action='store_true', | 140 parser.add_option('', '--linux-only', dest='linux_only', action='store_true', |
| 136 default=False, help='Only install sysroot for official ' | 141 default=False, help='Only install sysroot for official ' |
| 137 'Linux builds') | 142 'Linux builds') |
| 138 parser.add_option('', '--arch', dest='arch', | 143 parser.add_option('', '--arch', dest='arch', |
| 139 help='Sysroot architecture, i386 or amd64') | 144 help='Sysroot architecture, i386 or amd64') |
| 140 options, args = parser.parse_args() | 145 options, args = parser.parse_args() |
| 141 sys.exit(main(options)) | 146 sys.exit(main(options)) |
| OLD | NEW |