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

Side by Side Diff: build/gyp_v8

Issue 7104083: GYP: Generate makefiles for all architectures on Linux (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 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 | « build/README.txt ('k') | 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/python 1 #!/usr/bin/python
2 # 2 #
3 # Copyright 2010 the V8 project authors. All rights reserved. 3 # Copyright 2010 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 20 matching lines...) Expand all
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 shlex 35 import shlex
36 import sys 36 import sys
37 37
38 script_dir = os.path.dirname(__file__) 38 script_dir = os.path.dirname(__file__)
39 v8_root = os.path.normpath(os.path.join(script_dir, os.pardir)) 39 v8_root = os.path.normpath(os.path.join(script_dir, os.pardir))
40 40
41 sys.path.insert(0, os.path.join(v8_root, 'tools'))
42 import utils
43
41 sys.path.insert(0, os.path.join(v8_root, 'build', 'gyp', 'pylib')) 44 sys.path.insert(0, os.path.join(v8_root, 'build', 'gyp', 'pylib'))
42 import gyp 45 import gyp
43 46
47
44 def apply_gyp_environment(file_path=None): 48 def apply_gyp_environment(file_path=None):
45 """ 49 """
46 Reads in a *.gyp_env file and applies the valid keys to os.environ. 50 Reads in a *.gyp_env file and applies the valid keys to os.environ.
47 """ 51 """
48 if not file_path or not os.path.exists(file_path): 52 if not file_path or not os.path.exists(file_path):
49 return 53 return
50 file_contents = open(file_path).read() 54 file_contents = open(file_path).read()
51 try: 55 try:
52 file_data = eval(file_contents, {'__builtins__': None}, None) 56 file_data = eval(file_contents, {'__builtins__': None}, None)
53 except SyntaxError, e: 57 except SyntaxError, e:
54 e.filename = os.path.abspath(file_path) 58 e.filename = os.path.abspath(file_path)
55 raise 59 raise
56 supported_vars = ( 'V8_GYP_FILE', 60 supported_vars = ( 'V8_GYP_FILE',
57 'V8_GYP_SYNTAX_CHECK', 61 'V8_GYP_SYNTAX_CHECK',
58 'GYP_DEFINES', 62 'GYP_DEFINES',
59 'GYP_GENERATOR_FLAGS', 63 'GYP_GENERATOR_FLAGS',
60 'GYP_GENERATOR_OUTPUT', ) 64 'GYP_GENERATOR_OUTPUT', )
61 for var in supported_vars: 65 for var in supported_vars:
62 val = file_data.get(var) 66 val = file_data.get(var)
63 if val: 67 if val:
64 if var in os.environ: 68 if var in os.environ:
65 print 'INFO: Environment value for "%s" overrides value in %s.' % ( 69 print 'INFO: Environment value for "%s" overrides value in %s.' % (
66 var, os.path.abspath(file_path) 70 var, os.path.abspath(file_path)
67 ) 71 )
68 else: 72 else:
69 os.environ[var] = val 73 os.environ[var] = val
70 74
75
71 def additional_include_files(args=[]): 76 def additional_include_files(args=[]):
72 """ 77 """
73 Returns a list of additional (.gypi) files to include, without 78 Returns a list of additional (.gypi) files to include, without
74 duplicating ones that are already specified on the command line. 79 duplicating ones that are already specified on the command line.
75 """ 80 """
76 # Determine the include files specified on the command line. 81 # Determine the include files specified on the command line.
77 # This doesn't cover all the different option formats you can use, 82 # This doesn't cover all the different option formats you can use,
78 # but it's mainly intended to avoid duplicating flags on the automatic 83 # but it's mainly intended to avoid duplicating flags on the automatic
79 # makefile regeneration which only uses this format. 84 # makefile regeneration which only uses this format.
80 specified_includes = set() 85 specified_includes = set()
81 for arg in args: 86 for arg in args:
82 if arg.startswith('-I') and len(arg) > 2: 87 if arg.startswith('-I') and len(arg) > 2:
83 specified_includes.add(os.path.realpath(arg[2:])) 88 specified_includes.add(os.path.realpath(arg[2:]))
84 89
85 result = [] 90 result = []
86 def AddInclude(path): 91 def AddInclude(path):
87 if os.path.realpath(path) not in specified_includes: 92 if os.path.realpath(path) not in specified_includes:
88 result.append(path) 93 result.append(path)
89 94
90 # Always include common.gypi & features_override.gypi 95 # Always include common.gypi & features_override.gypi
91 AddInclude(os.path.join(script_dir, 'common.gypi')) 96 AddInclude(os.path.join(script_dir, 'common.gypi'))
92 97
93 # Optionally add supplemental .gypi files if present. 98 # Optionally add supplemental .gypi files if present.
94 supplements = glob.glob(os.path.join(v8_root, '*', 'supplement.gypi')) 99 supplements = glob.glob(os.path.join(v8_root, '*', 'supplement.gypi'))
95 for supplement in supplements: 100 for supplement in supplements:
96 AddInclude(supplement) 101 AddInclude(supplement)
97 102
98 return result 103 return result
99 104
105
106 def run_gyp(args):
107 rc = gyp.main(args)
108 if rc != 0:
109 print 'Error running GYP'
110 sys.exit(rc)
111
112
100 if __name__ == '__main__': 113 if __name__ == '__main__':
101 args = sys.argv[1:] 114 args = sys.argv[1:]
102 115
103 if 'SKIP_V8_GYP_ENV' not in os.environ: 116 if 'SKIP_V8_GYP_ENV' not in os.environ:
104 # Update the environment based on v8.gyp_env 117 # Update the environment based on v8.gyp_env
105 gyp_env_path = os.path.join(os.path.dirname(v8_root), 'v8.gyp_env') 118 gyp_env_path = os.path.join(os.path.dirname(v8_root), 'v8.gyp_env')
106 apply_gyp_environment(gyp_env_path) 119 apply_gyp_environment(gyp_env_path)
107 120
108 # This could give false positives since it doesn't actually do real option 121 # This could give false positives since it doesn't actually do real option
109 # parsing. Oh well. 122 # parsing. Oh well.
(...skipping 14 matching lines...) Expand all
124 else: 137 else:
125 args.append(os.path.join(script_dir, 'all.gyp')) 138 args.append(os.path.join(script_dir, 'all.gyp'))
126 139
127 args.extend(['-I' + i for i in additional_include_files(args)]) 140 args.extend(['-I' + i for i in additional_include_files(args)])
128 141
129 # There shouldn't be a circular dependency relationship between .gyp files 142 # There shouldn't be a circular dependency relationship between .gyp files
130 args.append('--no-circular-check') 143 args.append('--no-circular-check')
131 144
132 # Set the GYP DEPTH variable to the root of the V8 project. 145 # Set the GYP DEPTH variable to the root of the V8 project.
133 args.append('--depth=' + v8_root) 146 args.append('--depth=' + v8_root)
147 #args.append('--depth=/usr/local/google/home/sgjesse/v8/xxx')
Jakob Kummerow 2011/06/09 14:58:05 is this change intentional?
Søren Thygesen Gjesse 2011/06/09 15:11:42 Nope - removed.
134 148
135 # If V8_GYP_SYNTAX_CHECK is set to 1, it will invoke gyp with --check 149 # If V8_GYP_SYNTAX_CHECK is set to 1, it will invoke gyp with --check
136 # to enfore syntax checking. 150 # to enfore syntax checking.
137 syntax_check = os.environ.get('V8_GYP_SYNTAX_CHECK') 151 syntax_check = os.environ.get('V8_GYP_SYNTAX_CHECK')
138 if syntax_check and int(syntax_check): 152 if syntax_check and int(syntax_check):
139 args.append('--check') 153 args.append('--check')
140 154
141 print 'Updating projects from gyp files...' 155 print 'Updating projects from gyp files...'
142 sys.stdout.flush() 156 sys.stdout.flush()
143 157
144 # Off we go... 158 # Generate for the architectures supported on the given platform.
145 sys.exit(gyp.main(args)) 159 gyp_args = list(args)
160 gyp_args.append('-Dtarget_arch=ia32')
161 if utils.GuessOS() == 'linux':
162 gyp_args.append('-S-ia32')
163 run_gyp(gyp_args)
164
165 if utils.GuessOS() == 'linux':
166 gyp_args = list(args)
167 gyp_args.append('-Dtarget_arch=x64')
168 gyp_args.append('-S-x64')
169 run_gyp(gyp_args)
170
171 gyp_args = list(args)
172 gyp_args.append('-I' + v8_root + '/build/armu.gypi')
173 gyp_args.append('-S-armu')
174 run_gyp(gyp_args)
OLDNEW
« no previous file with comments | « build/README.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698