OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # This script is wrapper for Chromium that adds some support for how GYP | 7 # This script is wrapper for Chromium that adds some support for how GYP |
8 # is invoked by Chromium beyond what can be done in the gclient hooks. | 8 # is invoked by Chromium beyond what can be done in the gclient hooks. |
9 | 9 |
10 import glob | 10 import glob |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 cmdline_input_items += [sys.argv[i + 1]] | 122 cmdline_input_items += [sys.argv[i + 1]] |
123 cmdline_items = ProcessGypDefinesItems(cmdline_input_items) | 123 cmdline_items = ProcessGypDefinesItems(cmdline_input_items) |
124 | 124 |
125 return dict(supp_items + env_items + cmdline_items) | 125 return dict(supp_items + env_items + cmdline_items) |
126 | 126 |
127 | 127 |
128 def GetArgsStringForGN(supplemental_files): | 128 def GetArgsStringForGN(supplemental_files): |
129 """Returns the args to pass to GN. | 129 """Returns the args to pass to GN. |
130 Based on a subset of the GYP variables that have been rewritten a bit.""" | 130 Based on a subset of the GYP variables that have been rewritten a bit.""" |
131 | 131 |
| 132 # Find the .gyp directory in the user's home directory. |
| 133 home_dot_gyp = os.environ.get('GYP_CONFIG_DIR', None) |
| 134 if home_dot_gyp: |
| 135 home_dot_gyp = os.path.expanduser(home_dot_gyp) |
| 136 if not home_dot_gyp: |
| 137 home_vars = ['HOME'] |
| 138 if sys.platform in ('cygwin', 'win32'): |
| 139 home_vars.append('USERPROFILE') |
| 140 for home_var in home_vars: |
| 141 home = os.getenv(home_var) |
| 142 if home != None: |
| 143 home_dot_gyp = os.path.join(home, '.gyp') |
| 144 if not os.path.exists(home_dot_gyp): |
| 145 home_dot_gyp = None |
| 146 else: |
| 147 break |
| 148 |
| 149 if home_dot_gyp: |
| 150 include_gypi = os.path.join(home_dot_gyp, "include.gypi") |
| 151 if os.path.exists(include_gypi): |
| 152 supplemental_files += [include_gypi] |
| 153 |
132 vars_dict = GetGypVarsForGN(supplemental_files) | 154 vars_dict = GetGypVarsForGN(supplemental_files) |
133 gn_args = '' | 155 gn_args = '' |
134 | 156 |
135 # Note: These are the additional flags passed to various builds by builders | 157 # Note: These are the additional flags passed to various builds by builders |
136 # on the main waterfall. We'll probably need to add these at some point: | 158 # on the main waterfall. We'll probably need to add these at some point: |
137 # mac_strip_release=1 http://crbug.com/330301 | 159 # mac_strip_release=1 http://crbug.com/330301 |
138 # linux_dump_symbols=0 http://crbug.com/330300 | 160 # linux_dump_symbols=0 http://crbug.com/330300 |
139 # host_os=linux Probably can skip, GN knows the host OS. | 161 # host_os=linux Probably can skip, GN knows the host OS. |
140 # order_text_section=<path> http://crbug.com/330299 | 162 # order_text_section=<path> http://crbug.com/330299 |
141 # chromium_win_pch=0 http://crbug.com/297678 | 163 # chromium_win_pch=0 http://crbug.com/297678 |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 if not RunGN(supplemental_includes): | 395 if not RunGN(supplemental_includes): |
374 sys.exit(1) | 396 sys.exit(1) |
375 args.extend( | 397 args.extend( |
376 ['-I' + i for i in additional_include_files(supplemental_includes, args)]) | 398 ['-I' + i for i in additional_include_files(supplemental_includes, args)]) |
377 | 399 |
378 print 'Updating projects from gyp files...' | 400 print 'Updating projects from gyp files...' |
379 sys.stdout.flush() | 401 sys.stdout.flush() |
380 | 402 |
381 # Off we go... | 403 # Off we go... |
382 sys.exit(gyp.main(args)) | 404 sys.exit(gyp.main(args)) |
OLD | NEW |