OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright 2011 The Android Open Source Project | 3 # Copyright 2011 The Android Open Source Project |
4 # | 4 # |
5 # Use of this source code is governed by a BSD-style license that can be | 5 # Use of this source code is governed by a BSD-style license that can be |
6 # found in the LICENSE file. | 6 # found in the LICENSE file. |
7 | 7 |
8 # This script is a wrapper which invokes gyp with the correct --depth argument, | 8 # This script is a wrapper which invokes gyp with the correct --depth argument, |
9 # and supports the automatic regeneration of build files if all.gyp is | 9 # and supports the automatic regeneration of build files if all.gyp is |
10 # changed (Linux-only). | 10 # changed (Linux-only). |
11 | 11 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 if os.path.isabs(output_dir): | 71 if os.path.isabs(output_dir): |
72 return output_dir | 72 return output_dir |
73 else: | 73 else: |
74 return os.path.join(os.path.abspath(script_dir), output_dir) | 74 return os.path.join(os.path.abspath(script_dir), output_dir) |
75 | 75 |
76 | 76 |
77 if __name__ == '__main__': | 77 if __name__ == '__main__': |
78 args = sys.argv[1:] | 78 args = sys.argv[1:] |
79 | 79 |
80 if not os.getenv(ENVVAR_GYP_GENERATORS): | 80 if not os.getenv(ENVVAR_GYP_GENERATORS): |
81 print ('%s environment variable not set, using default' % | |
82 ENVVAR_GYP_GENERATORS) | |
83 if sys.platform.startswith('darwin'): | 81 if sys.platform.startswith('darwin'): |
84 default_gyp_generators = 'ninja,xcode' | 82 default_gyp_generators = 'ninja,xcode' |
85 elif sys.platform.startswith('win'): | 83 elif sys.platform.startswith('win'): |
86 default_gyp_generators = 'ninja,msvs-ninja' | 84 default_gyp_generators = 'ninja,msvs-ninja' |
87 elif sys.platform.startswith('cygwin'): | 85 elif sys.platform.startswith('cygwin'): |
88 default_gyp_generators = 'ninja,msvs-ninja' | 86 default_gyp_generators = 'ninja,msvs-ninja' |
89 else: | 87 else: |
90 default_gyp_generators = 'ninja' | 88 default_gyp_generators = 'ninja' |
91 os.environ[ENVVAR_GYP_GENERATORS] = default_gyp_generators | 89 os.environ[ENVVAR_GYP_GENERATORS] = default_gyp_generators |
92 print '%s is "%s"' % (ENVVAR_GYP_GENERATORS, os.getenv(ENVVAR_GYP_GENERATORS)) | 90 print ('%s environment variable not set, using default, %s' % |
| 91 (ENVVAR_GYP_GENERATORS, default_gyp_generators)) |
93 | 92 |
94 vs2013_runtime_dll_dirs = None | 93 vs2013_runtime_dll_dirs = None |
95 if os.getenv('CHROME_HEADLESS', '0') == '1': | 94 if os.getenv('CHROME_HEADLESS', '0') == '1': |
96 if sys.platform.startswith('win') or sys.platform.startswith('cygwin'): | 95 if sys.platform.startswith('win') or sys.platform.startswith('cygwin'): |
97 chrome_path = os.getenv('CHROME_PATH') | 96 chrome_path = os.getenv('CHROME_PATH') |
98 os.chdir(chrome_path) | 97 os.chdir(chrome_path) |
99 sys.path.append(os.path.join(chrome_path, 'build')) | 98 sys.path.append(os.path.join(chrome_path, 'build')) |
100 sys.path.append(os.path.join(chrome_path, 'tools')) | 99 sys.path.append(os.path.join(chrome_path, 'tools')) |
101 import vs_toolchain | 100 import vs_toolchain |
102 vs2013_runtime_dll_dirs = \ | 101 vs2013_runtime_dll_dirs = \ |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 gyp_generator_flags = os.getenv(ENVVAR_GYP_GENERATOR_FLAGS, '') | 140 gyp_generator_flags = os.getenv(ENVVAR_GYP_GENERATOR_FLAGS, '') |
142 if not 'msvs_error_on_missing_sources' in gyp_generator_flags: | 141 if not 'msvs_error_on_missing_sources' in gyp_generator_flags: |
143 os.environ[ENVVAR_GYP_GENERATOR_FLAGS] = ( | 142 os.environ[ENVVAR_GYP_GENERATOR_FLAGS] = ( |
144 gyp_generator_flags + ' msvs_error_on_missing_sources=1') | 143 gyp_generator_flags + ' msvs_error_on_missing_sources=1') |
145 | 144 |
146 # GYP is very conservative about how many concurrent linker calls it allows, | 145 # GYP is very conservative about how many concurrent linker calls it allows, |
147 # to fit in RAM. We don't need to be nearly as conservative as Chrome. We'll | 146 # to fit in RAM. We don't need to be nearly as conservative as Chrome. We'll |
148 # just turn that feature off. | 147 # just turn that feature off. |
149 os.environ['GYP_LINK_CONCURRENCY'] = '9001' | 148 os.environ['GYP_LINK_CONCURRENCY'] = '9001' |
150 | 149 |
151 print 'Updating projects from gyp files...' | |
152 sys.stdout.flush() | |
153 | |
154 if '--dry-run' in args: | 150 if '--dry-run' in args: |
155 args.remove('--dry-run') | 151 args.remove('--dry-run') |
156 print gyp_source_dir, ' '.join(args) | 152 print gyp_source_dir, ' '.join(args) |
157 else: | 153 else: |
158 # Off we go... | 154 # Off we go... |
159 res = gyp.main(args) | 155 res = gyp.main(args) |
160 if res: | 156 if res: |
161 sys.exit(res) | 157 sys.exit(res) |
162 | 158 |
163 # This code is copied from Chrome's build/gyp_chromium. It's not clear why | 159 # This code is copied from Chrome's build/gyp_chromium. It's not clear why |
164 # the *_runtime variables are reversed. | 160 # the *_runtime variables are reversed. |
165 if vs2013_runtime_dll_dirs: | 161 if vs2013_runtime_dll_dirs: |
166 x64_runtime, x86_runtime = vs2013_runtime_dll_dirs | 162 x64_runtime, x86_runtime = vs2013_runtime_dll_dirs |
167 vs_toolchain.CopyVsRuntimeDlls( | 163 vs_toolchain.CopyVsRuntimeDlls( |
168 os.path.join(os.getenv('CHROME_PATH'), get_output_dir()), | 164 os.path.join(os.getenv('CHROME_PATH'), get_output_dir()), |
169 (x86_runtime, x64_runtime)) | 165 (x86_runtime, x64_runtime)) |
OLD | NEW |