OLD | NEW |
1 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import os | 5 import os |
6 import shutil | 6 import shutil |
7 import sys | 7 import sys |
8 | 8 |
9 | 9 |
10 p = ARGUMENTS.get('PROGRESS') | 10 p = ARGUMENTS.get('PROGRESS') |
11 if p == 'spinner': | 11 if p == 'spinner': |
12 Progress(['/\r', '|\r', '\\\r', '-\r'], interval=5, file=open('con', 'w')) | 12 Progress(['/\r', '|\r', '\\\r', '-\r'], interval=5, file=open('con', 'w')) |
13 elif p == 'name': | 13 elif p == 'name': |
14 Progress('$TARGET\r', overwrite=True, file=open('con', 'w')) | 14 Progress('$TARGET\r', overwrite=True, file=open('con', 'w')) |
15 | 15 |
16 | 16 |
17 default_warnings = ['no-missing-sconscript', 'no-no-parallel-support'] | 17 default_warnings = ['no-missing-sconscript', 'no-no-parallel-support'] |
18 default_warnings = ['no-no-parallel-support'] | 18 default_warnings = ['no-no-parallel-support'] |
19 SetOption('warn', default_warnings + GetOption('warn')) | 19 SetOption('warn', default_warnings + GetOption('warn')) |
20 | 20 |
21 | 21 |
22 load = ARGUMENTS.get('LOAD') | |
23 if load: | |
24 load = load.split(',') | |
25 else: | |
26 load = [] | |
27 | |
28 | |
29 root_env = Environment( | 22 root_env = Environment( |
30 tools = ['component_setup'], | 23 tools = ['component_setup', |
| 24 'chromium_builders', |
| 25 'chromium_load_component'], |
31 | 26 |
32 # Requested list of system (shared) libraries, from the comma separated | 27 # Requested list of system (shared) libraries, from the comma separated |
33 # SYSTEM_LIBS command-line argument | 28 # SYSTEM_LIBS command-line argument |
34 req_system_libs = [], | 29 req_system_libs = [], |
35 # All supported system libraries, for the help message | 30 # All supported system libraries, for the help message |
36 all_system_libs = [], | 31 all_system_libs = [], |
37 | 32 |
38 CHROME_BUILD_TYPE = os.environ.get('CHROME_BUILD_TYPE', ''), | 33 CHROME_BUILD_TYPE = os.environ.get('CHROME_BUILD_TYPE', ''), |
39 CHROMIUM_BUILD = os.environ.get('CHROMIUM_BUILD', ''), | 34 CHROMIUM_BUILD = os.environ.get('CHROMIUM_BUILD', ''), |
40 | 35 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 103 |
109 def WantSystemLib(env, lib): | 104 def WantSystemLib(env, lib): |
110 """ | 105 """ |
111 Return true if lib has been requested as a system library in SYSTEM_LIBS. | 106 Return true if lib has been requested as a system library in SYSTEM_LIBS. |
112 """ | 107 """ |
113 if lib not in env['all_system_libs']: | 108 if lib not in env['all_system_libs']: |
114 env['all_system_libs'].append(lib) | 109 env['all_system_libs'].append(lib) |
115 return (lib in env['req_system_libs']) | 110 return (lib in env['req_system_libs']) |
116 root_env.AddMethod(WantSystemLib, "WantSystemLib") | 111 root_env.AddMethod(WantSystemLib, "WantSystemLib") |
117 | 112 |
118 def ChromeProgram(env, *args, **kw): | |
119 return env.ComponentProgram(*args, **kw) | |
120 root_env.AddMethod(ChromeProgram) | |
121 | |
122 def ChromeTestProgram(env, *args, **kw): | |
123 return env.ComponentTestProgram(*args, **kw) | |
124 root_env.AddMethod(ChromeTestProgram) | |
125 | |
126 def ChromeStaticLibrary(env, *args, **kw): | |
127 kw['COMPONENT_STATIC'] = True | |
128 return env.ComponentLibrary(*args, **kw) | |
129 root_env.AddMethod(ChromeStaticLibrary) | |
130 | |
131 def ChromeSharedLibrary(env, *args, **kw): | |
132 kw['COMPONENT_STATIC'] = False | |
133 return [env.ComponentLibrary(*args, **kw)[0]] | |
134 root_env.AddMethod(ChromeSharedLibrary, "ChromeSharedLibrary") | |
135 | |
136 def ChromeObject(env, *args, **kw): | |
137 return env.ComponentObject(*args, **kw) | |
138 root_env.AddMethod(ChromeObject) | |
139 | |
140 | 113 |
141 # TODO(bradnelson): pull this functionality into hammer. | 114 # TODO(bradnelson): pull this functionality into hammer. |
142 # Auto select the number of processors | 115 # Auto select the number of processors |
143 if root_env['PLATFORM'] in ['win32', 'cygwin']: | 116 if root_env['PLATFORM'] in ['win32', 'cygwin']: |
144 cpus = int(os.environ.get('NUMBER_OF_PROCESSORS', 1)) | 117 cpus = int(os.environ.get('NUMBER_OF_PROCESSORS', 1)) |
145 elif root_env['PLATFORM'] in ['linux', 'linux2', 'posix']: | 118 elif root_env['PLATFORM'] in ['linux', 'linux2', 'posix']: |
146 # TODO(evanm): this is Linux-specific, not posix. | 119 # TODO(evanm): this is Linux-specific, not posix. |
147 # Parse /proc/cpuinfo for processor count. | 120 # Parse /proc/cpuinfo for processor count. |
148 cpus = len([l for l in open('/proc/cpuinfo') if l.startswith('processor\t')]) | 121 cpus = len([l for l in open('/proc/cpuinfo') if l.startswith('processor\t')]) |
149 else: | 122 else: |
(...skipping 12 matching lines...) Expand all Loading... |
162 | 135 |
163 # Use timestamps change, followed by MD5 for speed | 136 # Use timestamps change, followed by MD5 for speed |
164 root_env.Decider('MD5-timestamp') | 137 root_env.Decider('MD5-timestamp') |
165 | 138 |
166 # Incorporate settings that should apply globally (primarily to provide | 139 # Incorporate settings that should apply globally (primarily to provide |
167 # an obvious place for developmental experimentation). | 140 # an obvious place for developmental experimentation). |
168 root_env.ApplySConscript(['$CHROME_SRC_DIR/build/common.scons']) | 141 root_env.ApplySConscript(['$CHROME_SRC_DIR/build/common.scons']) |
169 | 142 |
170 # The list of all leaf (fully described) environments. | 143 # The list of all leaf (fully described) environments. |
171 environment_list = [] | 144 environment_list = [] |
| 145 components = [] |
172 | 146 |
173 | 147 # Figure out what SConscript files to load based on the user's request. |
174 # -------------------------------------------------------------------------- | 148 # Default is to load all SConscript files for a full-tree build. |
175 # Decide which things to load. | 149 # The keyword arguments in the call below (base, breakpad, etc.) can be |
176 # Don't put anything platform depended here, this is just to gate things | 150 # specified in the LOAD= argument to cut down on the build. |
177 # in or out for speed. | 151 sconscripts = root_env.ChromiumLoadComponentSConscripts( |
178 | 152 base = '$BASE_DIR/base.scons', |
179 included = [c for c in load if not c.startswith('-')] | 153 breakpad = '$BREAKPAD_DIR/SConscript', |
180 excluded = [c[1:] for c in load if c.startswith('-')] | 154 chrome = '$CHROME_DIR/chrome.scons', |
181 if not included: | 155 gears = '$GEARS_DIR/SConscript', |
182 included = ['all'] | 156 google_update = '$GOOGLE_UPDATE_DIR/SConscript', |
183 | 157 googleurl = '$GOOGLEURL_DIR/googleurl.scons', |
184 components = ['all'] | 158 media = '$MEDIA_DIR/media.scons', |
185 | 159 net = '$NET_DIR/net.scons', |
186 def LoadComponent(c): | 160 rlz = '$RLZ_DIR/SConscript', |
187 components.append(c) | 161 sandbox = '$SANDBOX_DIR/sandbox.scons', |
188 return (not GetOption('help') and | 162 sdch = '$SDCH_DIR/SConscript', |
189 c in included or | 163 skia = '$SKIA_DIR/SConscript', |
190 ('all' in included and not c in excluded)) | 164 testing = '$TESTING_DIR/SConscript.gtest', |
191 | 165 third_party = [ |
192 sconscripts = [] | 166 '$BSDIFF_DIR/bsdiff.scons', |
193 | 167 '$BSPATCH_DIR/bspatch.scons', |
194 if LoadComponent('base'): | 168 '$BZIP2_DIR/bzip2.scons', |
195 sconscripts.append('$BASE_DIR/base.scons') | 169 '$ICU38_DIR/icu38.scons', |
196 | 170 '$LIBJPEG_DIR/libjpeg.scons', |
197 if LoadComponent('breakpad'): | 171 '$LIBPNG_DIR/libpng.scons', |
198 sconscripts.append('$BREAKPAD_DIR/SConscript') | 172 '$LIBXML_DIR/libxml.scons', |
199 | 173 '$LIBXSLT_DIR/libxslt.scons', |
200 if LoadComponent('chrome'): | 174 '$LZMA_SDK_DIR/lzma_sdk.scons', |
201 sconscripts.append('$CHROME_DIR/chrome.scons') | 175 '$MODP_B64_DIR/modp_b64.scons', |
202 | 176 '$ZLIB_DIR/zlib.scons', |
203 if LoadComponent('gears'): | 177 ], |
204 sconscripts.append('$GEARS_DIR/SConscript') | 178 v8 = '$OBJ_ROOT/build/SConscript.v8', |
205 | 179 webkit = '$WEBKIT_DIR/webkit.scons', |
206 if LoadComponent('google_update'): | 180 ) |
207 sconscripts.append('$GOOGLE_UPDATE_DIR/SConscript') | |
208 | |
209 if LoadComponent('googleurl'): | |
210 # googleurl comes from a different repository so we provide the SConscript | |
211 # file. | |
212 sconscripts.append('$GOOGLEURL_DIR/googleurl.scons') | |
213 | |
214 if LoadComponent('media'): | |
215 sconscripts.append('$MEDIA_DIR/media.scons') | |
216 | |
217 if LoadComponent('net'): | |
218 sconscripts.append('$NET_DIR/net.scons') | |
219 | |
220 if LoadComponent('rlz'): | |
221 sconscripts.append('$RLZ_DIR/SConscript') | |
222 | |
223 if LoadComponent('sandbox'): | |
224 sconscripts.append('$SANDBOX_DIR/sandbox.scons') | |
225 | |
226 if LoadComponent('sdch'): | |
227 sconscripts.append('$SDCH_DIR/SConscript') | |
228 | |
229 if LoadComponent('skia'): | |
230 sconscripts.append('$SKIA_DIR/SConscript') | |
231 | |
232 if LoadComponent('testing'): | |
233 sconscripts.append('$TESTING_DIR/SConscript.gtest') | |
234 | |
235 if LoadComponent('third_party'): | |
236 if not root_env.WantSystemLib('bzip2'): | |
237 sconscripts.append('$BZIP2_DIR/bzip2.scons') | |
238 root_env.Append(BZIP2_LIB = ['bzip2']) | |
239 else: | |
240 root_env.Append(BZIP2_LIB = ['bz2']) | |
241 if not root_env.WantSystemLib('libpng'): | |
242 sconscripts.append('$LIBPNG_DIR/libpng.scons') | |
243 if not root_env.WantSystemLib('libjpeg'): | |
244 sconscripts.append('$LIBJPEG_DIR/SConscript') | |
245 if not root_env.WantSystemLib('libxml'): | |
246 sconscripts.append('$LIBXML_DIR/SConscript') | |
247 root_env.Append(XML_LIB = ['libxml']) | |
248 else: | |
249 root_env.Append(XML_LIB = ['xml2']) | |
250 if not root_env.WantSystemLib('libxslt'): | |
251 sconscripts.append('$LIBXSLT_DIR/SConscript') | |
252 if not root_env.WantSystemLib('lzma_sdk'): | |
253 sconscripts.append('$LZMA_SDK_DIR/lzma_sdk.scons') | |
254 if not root_env.WantSystemLib('zlib'): | |
255 sconscripts.append('$ZLIB_DIR/zlib.scons') | |
256 root_env.Append(ZLIB_LIB = ['zlib']) | |
257 else: | |
258 root_env.Append(ZLIB_LIB = ['z']) | |
259 sconscripts.extend([ | |
260 '$BSDIFF_DIR/bsdiff.scons', | |
261 '$BSPATCH_DIR/bspatch.scons', | |
262 '$ICU38_DIR/icu38.scons', | |
263 '$MODP_B64_DIR/modp_b64.scons', | |
264 ]) | |
265 | |
266 if LoadComponent('v8') and root_env.Dir('$CHROME_SRC_DIR/v8').exists(): | |
267 sconscripts.append('$OBJ_ROOT/build/SConscript.v8') | |
268 | |
269 if LoadComponent('webkit'): | |
270 sconscripts.append('$WEBKIT_DIR/webkit.scons') | |
271 | |
272 | 181 |
273 # Add the final list into the root environment to be build in BuildComponents. | 182 # Add the final list into the root environment to be build in BuildComponents. |
274 root_env.Append(BUILD_SCONSCRIPTS = sconscripts) | 183 root_env.Append(BUILD_SCONSCRIPTS = sconscripts) |
275 | 184 |
276 | 185 |
277 | 186 |
278 # -------------------------------------------------------------------------- | 187 # -------------------------------------------------------------------------- |
279 # Windows specific | 188 # Windows specific |
280 | 189 |
281 windows_env = root_env.Clone() | 190 windows_env = root_env.Clone() |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 'all_libraries', | 676 'all_libraries', |
768 'all_languages', | 677 'all_languages', |
769 'all_programs', | 678 'all_programs', |
770 'all_test_programs', | 679 'all_test_programs', |
771 ], projects = [p], | 680 ], projects = [p], |
772 COMPONENT_VS_PROJECT_SCRIPT_PATH=( | 681 COMPONENT_VS_PROJECT_SCRIPT_PATH=( |
773 'cd $$(ProjectDir)/$VS_PROJECT_TO_MAIN_DIR && hammer.bat'), | 682 'cd $$(ProjectDir)/$VS_PROJECT_TO_MAIN_DIR && hammer.bat'), |
774 ) | 683 ) |
775 | 684 |
776 # ------------------------------------------------------------------------- | 685 # ------------------------------------------------------------------------- |
OLD | NEW |