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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 gyp_defines = os.environ.get('GYP_DEFINES', '') | 101 gyp_defines = os.environ.get('GYP_DEFINES', '') |
102 | 102 |
103 if options.arch: | 103 if options.arch: |
104 target_arch = options.arch | 104 target_arch = options.arch |
105 else: | 105 else: |
106 target_arch = DetectArch(gyp_defines) | 106 target_arch = DetectArch(gyp_defines) |
107 if not target_arch: | 107 if not target_arch: |
108 print 'Unable to detect host architecture' | 108 print 'Unable to detect host architecture' |
109 return 1 | 109 return 1 |
110 | 110 |
111 if options.running_as_hook and target_arch != 'arm' and target_arch != 'mips': | |
112 # When run from runhooks, only install the sysroot for an Official Chrome | |
113 # Linux build, except on ARM where we always use a sysroot. | |
114 skip_if_defined = ['branding=Chrome', 'buildtype=Official'] | |
115 skip_if_undefined = ['chromeos=1'] | |
116 for option in skip_if_defined: | |
117 if option not in gyp_defines: | |
118 return 0 | |
119 for option in skip_if_undefined: | |
120 if option in gyp_defines: | |
121 return 0 | |
122 | |
123 # The sysroot directory should match the one specified in build/common.gypi. | 111 # The sysroot directory should match the one specified in build/common.gypi. |
124 # TODO(thestig) Consider putting this else where to avoid having to recreate | 112 # TODO(thestig) Consider putting this else where to avoid having to recreate |
125 # it on every build. | 113 # it on every build. |
126 linux_dir = os.path.dirname(SCRIPT_DIR) | 114 linux_dir = os.path.dirname(SCRIPT_DIR) |
127 if target_arch == 'amd64': | 115 if target_arch == 'amd64': |
128 sysroot = os.path.join(linux_dir, SYSROOT_DIR_AMD64) | 116 sysroot = os.path.join(linux_dir, SYSROOT_DIR_AMD64) |
129 tarball_filename = TARBALL_AMD64 | 117 tarball_filename = TARBALL_AMD64 |
130 tarball_sha1sum = TARBALL_AMD64_SHA1SUM | 118 tarball_sha1sum = TARBALL_AMD64_SHA1SUM |
131 revision = REVISION_AMD64 | 119 revision = REVISION_AMD64 |
132 elif target_arch == 'arm': | 120 elif target_arch == 'arm': |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 parser = optparse.OptionParser('usage: %prog [OPTIONS]') | 172 parser = optparse.OptionParser('usage: %prog [OPTIONS]') |
185 parser.add_option('--running-as-hook', action='store_true', | 173 parser.add_option('--running-as-hook', action='store_true', |
186 default=False, help='Used when running from gclient hooks.' | 174 default=False, help='Used when running from gclient hooks.' |
187 ' In this mode the sysroot will only ' | 175 ' In this mode the sysroot will only ' |
188 'be installed for official Linux ' | 176 'be installed for official Linux ' |
189 'builds or ARM Linux builds') | 177 'builds or ARM Linux builds') |
190 parser.add_option('--arch', type='choice', choices=valid_archs, | 178 parser.add_option('--arch', type='choice', choices=valid_archs, |
191 help='Sysroot architecture: %s' % ', '.join(valid_archs)) | 179 help='Sysroot architecture: %s' % ', '.join(valid_archs)) |
192 options, _ = parser.parse_args() | 180 options, _ = parser.parse_args() |
193 sys.exit(main()) | 181 sys.exit(main()) |
OLD | NEW |