Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: build/gyp_v8

Issue 122183004: Don't modify the PWD in gyp_v8 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2012 the V8 project authors. All rights reserved. 3 # Copyright 2012 the V8 project authors. All rights reserved.
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 18 matching lines...) Expand all
29 29
30 # This script is wrapper for V8 that adds some support for how GYP 30 # This script is wrapper for V8 that adds some support for how GYP
31 # is invoked by V8 beyond what can be done in the gclient hooks. 31 # is invoked by V8 beyond what can be done in the gclient hooks.
32 32
33 import glob 33 import glob
34 import os 34 import os
35 import platform 35 import platform
36 import shlex 36 import shlex
37 import sys 37 import sys
38 38
39 script_dir = os.path.dirname(__file__) 39 script_dir = os.path.dirname(os.path.realpath(__file__))
40 v8_root = os.path.normpath(os.path.join(script_dir, os.pardir)) 40 v8_root = os.path.abspath(os.path.join(script_dir, os.pardir))
41
42 if __name__ == '__main__':
43 os.chdir(v8_root)
44 script_dir = os.path.dirname(__file__)
45 v8_root = '.'
46 41
47 sys.path.insert(0, os.path.join(v8_root, 'build', 'gyp', 'pylib')) 42 sys.path.insert(0, os.path.join(v8_root, 'build', 'gyp', 'pylib'))
48 import gyp 43 import gyp
49 44
50 # Add paths so that pymod_do_main(...) can import files. 45 # Add paths so that pymod_do_main(...) can import files.
51 sys.path.insert( 46 sys.path.insert(
52 1, os.path.abspath(os.path.join(v8_root, 'tools', 'generate_shim_headers'))) 47 1, os.path.abspath(os.path.join(v8_root, 'tools', 'generate_shim_headers')))
53 48
54 49
55 def apply_gyp_environment(file_path=None): 50 def apply_gyp_environment(file_path=None):
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 130
136 # If we didn't get a file, check an env var, and then fall back to 131 # If we didn't get a file, check an env var, and then fall back to
137 # assuming 'all.gyp' from the same directory as the script. 132 # assuming 'all.gyp' from the same directory as the script.
138 if not gyp_file_specified: 133 if not gyp_file_specified:
139 gyp_file = os.environ.get('V8_GYP_FILE') 134 gyp_file = os.environ.get('V8_GYP_FILE')
140 if gyp_file: 135 if gyp_file:
141 # Note that V8_GYP_FILE values can't have backslashes as 136 # Note that V8_GYP_FILE values can't have backslashes as
142 # path separators even on Windows due to the use of shlex.split(). 137 # path separators even on Windows due to the use of shlex.split().
143 args.extend(shlex.split(gyp_file)) 138 args.extend(shlex.split(gyp_file))
144 else: 139 else:
145 # Note that this must not start with "./" or things break. 140 args.append(os.path.join(script_dir, 'all.gyp'))
146 # So we rely on having done os.chdir(v8_root) above and use the
147 # relative path.
148 args.append(os.path.join('build', 'all.gyp'))
149 141
150 args.extend(['-I' + i for i in additional_include_files(args)]) 142 args.extend(['-I' + i for i in additional_include_files(args)])
151 143
152 # There shouldn't be a circular dependency relationship between .gyp files 144 # There shouldn't be a circular dependency relationship between .gyp files
153 args.append('--no-circular-check') 145 args.append('--no-circular-check')
154 146
155 # Set the GYP DEPTH variable to the root of the V8 project. 147 # Set the GYP DEPTH variable to the root of the V8 project.
156 args.append('--depth=' + v8_root) 148 args.append('--depth=' + v8_root)
157 149
158 # If V8_GYP_SYNTAX_CHECK is set to 1, it will invoke gyp with --check 150 # If V8_GYP_SYNTAX_CHECK is set to 1, it will invoke gyp with --check
159 # to enfore syntax checking. 151 # to enfore syntax checking.
160 syntax_check = os.environ.get('V8_GYP_SYNTAX_CHECK') 152 syntax_check = os.environ.get('V8_GYP_SYNTAX_CHECK')
161 if syntax_check and int(syntax_check): 153 if syntax_check and int(syntax_check):
162 args.append('--check') 154 args.append('--check')
163 155
164 print 'Updating projects from gyp files...' 156 print 'Updating projects from gyp files...'
165 sys.stdout.flush() 157 sys.stdout.flush()
166 158
167 # Generate for the architectures supported on the given platform. 159 # Generate for the architectures supported on the given platform.
168 gyp_args = list(args) 160 gyp_args = list(args)
169 if platform.system() == 'Linux': 161 if platform.system() == 'Linux':
170 # --generator-output defines where the Makefile goes. 162 # --generator-output defines where the Makefile goes.
171 gyp_args.append('--generator-output=out') 163 gyp_args.append('--generator-output=out')
172 # -Goutput_dir defines where the build output goes, relative to the 164 # -Goutput_dir defines where the build output goes, relative to the
173 # Makefile. Set it to . so that the build output doesn't end up in out/out. 165 # Makefile. Set it to . so that the build output doesn't end up in out/out.
174 gyp_args.append('-Goutput_dir=.') 166 gyp_args.append('-Goutput_dir=.')
175 run_gyp(gyp_args) 167 run_gyp(gyp_args)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698