OLD | NEW |
1 # Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 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 re | 6 import re |
7 | 7 |
8 Import('env') | 8 Import('env') |
9 | 9 |
10 env = env.Clone( | 10 env = env.Clone() |
11 OPEN_DIR = "$GEARS_DIR/googleclient/gears/opensource/gears", | |
12 THIRD_PARTY_DIR = "$GEARS_DIR/googleclient/gears/opensource/third_party", | |
13 GENFILES_DIR = "$GEARS_DIR/genfiles", | |
14 PRIVATE_THIRD_PARTY_DIR = "$GEARS_DIR/googleclient/third_party", | |
15 ) | |
16 | 11 |
17 # Notes: | 12 # Notes: |
18 # This assumes you have a working gears checkout from p4 in the current dir. | 13 # This assumes you have a working gears checkout from p4 in the current dir. |
19 # Steps for this: | 14 # Steps for this: |
20 # > echo %USER%-chromegears > p4config | 15 # > echo %USER%-chromegears > p4config |
21 # > g4 client -p //depot/googleclient/gears/p4_depot_paths | 16 # > g4 client -p //depot/googleclient/gears/p4_depot_paths |
22 # > g4 sync | 17 # > g4 sync |
23 # | 18 # |
24 # This is a work-in-progress conversion of the current Gears set of Makefiles. | 19 # This is a work-in-progress conversion of the current Gears set of Makefiles. |
25 # A lot of the stuff doesn't translate to SCons-land well, and I'm not sure | 20 # A lot of the stuff doesn't translate to SCons-land well, and I'm not sure |
26 # how faithful we want to be to the original. | 21 # how faithful we want to be to the original. |
27 # | 22 # |
28 # Questions: | 23 # Questions: |
29 # Should we flatten the output directory into | 24 # Should we flatten the output directory into |
30 # Hammer/gears/platform/browser/*.obj like Gears does now? If so, how? | 25 # Hammer/gears/platform/browser/*.obj like Gears does now? If so, how? |
31 # | |
32 # TODO: split into env_common, env_browser, etc? | |
33 # common_* stuff will be built once, and object reused for all browser builds. | |
34 # browser_* stuff will be rebuilt for each different type of BROWSER define. | |
35 # - How do we do this? We want browser_ stuff under a different dir so | |
36 # BROWSER=NPAPI doesn't overwrite BROWSER=FF3's object files. | |
37 # Maybe put all the browser stuff in a separate .lib, and use variant_dir | |
38 # on a SConscript.browser? | |
39 | 26 |
40 # Argument switches | 27 # TODO: move all these builders out to site_scons or somesuch. |
41 vars = Variables(None, ARGUMENTS) | |
42 vars.AddVariables( | |
43 EnumVariable('BROWSER', | |
44 'Which browser we want to build the plugin for', | |
45 'NPAPI', ['IE', 'FF2', 'FF3', 'SF', 'NPAPI']), | |
46 EnumVariable('MODE', | |
47 'Type of binary to generate', | |
48 'dbg', ['dbg', 'opt']), | |
49 BoolVariable('OFFICIAL_BUILD', | |
50 'Create a binary suitable for public release', 0) | |
51 ) | |
52 vars.Update(env) | |
53 | |
54 env.Prepend( | |
55 USING_CCTESTS = (env['MODE'] == 'dbg' or not env['OFFICIAL_BUILD']) | |
56 ) | |
57 | |
58 # Version | |
59 env.Prepend( | |
60 MAJOR = '0', | |
61 MINOR = '4', | |
62 BUILD = '17', | |
63 PATCH = '0', | |
64 VERSION = '${MAJOR}.${MINOR}.${BUILD}.${PATCH}', | |
65 | |
66 FRIENDLY_NAME = 'Gears', | |
67 SHORT_NAME = 'gears', | |
68 ) | |
69 | |
70 # Platform | |
71 env.Prepend( | |
72 OS = '$PLATFORM', | |
73 ARCH = 'i386', | |
74 ) | |
75 | |
76 | |
77 # Building M4 files | 28 # Building M4 files |
78 | 29 |
79 env.Tool('m4') | 30 env.Tool('m4') |
80 | 31 |
81 # Add GNU tools to the PATH. | 32 # Add GNU tools to the PATH. |
82 # TODO: Figure out the right way to do this. On first invocation, PATH | 33 # TODO: Figure out the right way to do this. On first invocation, PATH |
83 # is relative to '.'. On repeated invocations (when Hammer/gears exists), | 34 # is relative to '.'. On repeated invocations (when Hammer/gears exists), |
84 # PATH is relative to './Hammer/gears'. | 35 # PATH is relative to './Hammer/gears'. |
85 # TODO: Also it would be nice to use $THIRD_PARTY_DIR instead of hardcoding | 36 # TODO: Also it would be nice to use $THIRD_PARTY_DIR instead of hardcoding |
86 # it here. | 37 # it here. |
87 env.PrependENVPath('PATH', os.path.abspath( | 38 env.PrependENVPath('PATH', os.path.abspath( |
88 'googleclient/third_party/gnu/files')) | 39 'googleclient/third_party/gnu/files')) |
89 env.PrependENVPath('PATH', os.path.abspath( | 40 env.PrependENVPath('PATH', os.path.abspath( |
90 '../../googleclient/third_party/gnu/files')) | 41 '../../../../googleclient/third_party/gnu/files')) |
91 env.PrependENVPath('PATH', os.path.abspath( | 42 env.PrependENVPath('PATH', os.path.abspath( |
92 'googleclient/third_party/python_24')) | 43 'googleclient/third_party/python_24')) |
93 env.PrependENVPath('PATH', os.path.abspath( | 44 env.PrependENVPath('PATH', os.path.abspath( |
94 '../../googleclient/third_party/python_24')) | 45 '../../../../googleclient/third_party/python_24')) |
| 46 |
| 47 print 'path=', env['ENV']['PATH'] |
95 | 48 |
96 i18n_langs = [ | 49 i18n_langs = [ |
97 'en-US', | 50 'en-US', |
98 'ar', | 51 'ar', |
99 'bg', | 52 'bg', |
100 'ca', | 53 'ca', |
101 'cs', | 54 'cs', |
102 'da', | 55 'da', |
103 'de', | 56 'de', |
104 'el', | 57 'el', |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 'ml', | 95 'ml', |
143 'te', | 96 'te', |
144 'gu', | 97 'gu', |
145 'kn', | 98 'kn', |
146 'or', | 99 'or', |
147 'bn', | 100 'bn', |
148 'ta', | 101 'ta', |
149 'mr', | 102 'mr', |
150 ] | 103 ] |
151 | 104 |
152 # TODO: switch over to Chrome's SDK. | |
153 env.Replace( | |
154 CPPPATH = [ | |
155 '$PRIVATE_THIRD_PARTY_DIR/platformsdk_vc80/files/include', | |
156 '$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80/files/include', | |
157 ], | |
158 ) | |
159 | |
160 # TODO: DEBUG, OFFICIAL_BUILD, CCTESTS, I18N_LANGUAGES | 105 # TODO: DEBUG, OFFICIAL_BUILD, CCTESTS, I18N_LANGUAGES |
161 env.Prepend( | 106 env.Prepend( |
162 M4FLAGS = [ | 107 M4FLAGS = [ |
163 '--prefix-builtins', | 108 '--prefix-builtins', |
164 '-DDEBUG=1', | 109 '-DDEBUG=1', |
165 '-DPRODUCT_VERSION=$VERSION', | 110 '-DPRODUCT_VERSION=$VERSION', |
166 '-DPRODUCT_VERSION_MAJOR=$MAJOR', | 111 '-DPRODUCT_VERSION_MAJOR=$MAJOR', |
167 '-DPRODUCT_VERSION_MINOR=$MINOR', | 112 '-DPRODUCT_VERSION_MINOR=$MINOR', |
168 '-DPRODUCT_VERSION_BUILD=$BUILD', | 113 '-DPRODUCT_VERSION_BUILD=$BUILD', |
169 '-DPRODUCT_VERSION_PATCH=$PATCH', | 114 '-DPRODUCT_VERSION_PATCH=$PATCH', |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 # Install()). | 210 # Install()). |
266 t = [os.path.join(str(env.Dir('$IDLOUTPUTDIR')), os.path.basename(x)) | 211 t = [os.path.join(str(env.Dir('$IDLOUTPUTDIR')), os.path.basename(x)) |
267 for x in t] | 212 for x in t] |
268 return (t, source) | 213 return (t, source) |
269 b = env['BUILDERS']['TypeLibrary'] | 214 b = env['BUILDERS']['TypeLibrary'] |
270 emitter_list = [b.emitter, MyIdlEmitter] | 215 emitter_list = [b.emitter, MyIdlEmitter] |
271 b.emitter = SCons.Builder.ListEmitter(emitter_list) | 216 b.emitter = SCons.Builder.ListEmitter(emitter_list) |
272 | 217 |
273 # C++ defines | 218 # C++ defines |
274 | 219 |
275 # TODO: fix Gears to not require this removal. | |
276 env['CPPDEFINES'].remove('WIN32_LEAN_AND_MEAN') | |
277 | |
278 env.Prepend( | |
279 CPPPATH = [ | |
280 '$OPEN_DIR', | |
281 '$OPEN_DIR/..', | |
282 '$THIRD_PARTY_DIR', | |
283 '$THIRD_PARTY_DIR/breakpad/src', | |
284 '$THIRD_PARTY_DIR/googleurl', | |
285 '$THIRD_PARTY_DIR/npapi', | |
286 '$THIRD_PARTY_DIR/zlib', | |
287 '$THIRD_PARTY_DIR/v8/bindings_local', | |
288 '$GEARS_DIR', | |
289 ], | |
290 ) | |
291 | |
292 env.Append( | |
293 CPPDEFINES = [ | |
294 'DEBUG=1', | |
295 '_DEBUG=1', | |
296 'USING_CCTESTS=1', | |
297 ], | |
298 | |
299 ) | |
300 | |
301 # TODO: if USING_PNG | |
302 env.Append( | |
303 CPPDEFINES = [ | |
304 'PNG_USER_CONFIG', | |
305 ], | |
306 ) | |
307 | |
308 # TODO: is this needed? | |
309 if env['PLATFORM'] == 'win32': | |
310 # We require APPVER=5.0 for things like HWND_MESSAGE. | |
311 # When APPVER=5.0, win32.mak in the Platform SDK sets: | |
312 # C defines: WINVER=0x0500 | |
313 # _WIN32_WINNT=0x0500 | |
314 # _WIN32_IE=0x0500 | |
315 # _RICHEDIT_VER=0x0010 | |
316 # RC defines: WINVER=0x0500 | |
317 # MIDL flags: /target NT50 | |
318 # Note: _WIN32_WINDOWS was replaced by _WIN32_WINNT for post-Win95 builds. | |
319 # Note: XP_WIN is only used by Firefox headers | |
320 env.Append( | |
321 CPPDEFINES = [ | |
322 'STRICT', | |
323 '_USRDLL', | |
324 '_WINDLL', | |
325 # 'WINVER=0x0500', | |
326 # '_WIN32_WINNT=0x0500', | |
327 '_WIN32_IE=0x0500', | |
328 '_RICHEDIT_VER=0x0010', | |
329 '_MERGE_PROXYSTUB', | |
330 'BREAKPAD_AVOID_STREAMS', # TODO: move to breakpad env | |
331 'XP_WIN', | |
332 ], | |
333 LINKFLAGS = [ | |
334 # Set the preferred base address. This value was chosen because (a) it's near | |
335 # the top of the valid address range, and (b) it doesn't conflict with other | |
336 # DLLs loaded by Chrome in either the browser or plugin process. | |
337 '/BASE:0x65000000', | |
338 ], | |
339 ) | |
340 | |
341 env.Append( | |
342 CPPFLAGS = [ | |
343 '/wd4018' | |
344 ] | |
345 ) | |
346 | |
347 env_common = env.Clone() | 220 env_common = env.Clone() |
348 env_common.Prepend( | 221 env_common.Prepend( |
349 ) | 222 ) |
350 | 223 |
351 env_browser = env.Clone() | 224 env_browser = env.Clone() |
352 env_browser.Prepend( | 225 env_browser.Prepend( |
353 CPPDEFINES = [ | 226 CPPDEFINES = [ |
354 'BROWSER_${BROWSER}=1', | 227 'BROWSER_${BROWSER}=1', |
355 ], | 228 ], |
356 ) | 229 ) |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 ], | 280 ], |
408 ) | 281 ) |
409 | 282 |
410 if env['PLATFORM'] == 'win32': | 283 if env['PLATFORM'] == 'win32': |
411 env.Append( | 284 env.Append( |
412 RCFLAGS = [ | 285 RCFLAGS = [ |
413 ['/l', '0x409'], | 286 ['/l', '0x409'], |
414 ], | 287 ], |
415 ) | 288 ) |
416 | 289 |
| 290 if env['PLATFORM'] == 'win32': |
| 291 env.Append( |
| 292 CPPFLAGS = [ |
| 293 '/wd4018' # TODO: move to breakpad |
| 294 ] |
| 295 ) |
417 | 296 |
418 # Input file lists | 297 # Input file lists |
419 | 298 |
420 def NewInputs(): | 299 def NewInputs(): |
421 """Returns a new dictionary of input file lists. | 300 """Returns a new dictionary of input file lists. |
422 | 301 |
423 Browser-specific inputs are referenced by the browser name. All browsers | 302 Browser-specific inputs are referenced by the browser name. All browsers |
424 include inputs from the 'all' list. 'common' inputs are built using | 303 include inputs from the 'all' list. 'common' inputs are built using |
425 env_common.""" | 304 env_common.""" |
426 | 305 |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 '$THIRD_PARTY_DIR/v8/bin-dbg/no_snapshotv8.lib', | 970 '$THIRD_PARTY_DIR/v8/bin-dbg/no_snapshotv8.lib', |
1092 '$THIRD_PARTY_DIR/v8/bin-dbg/libjscre.lib', | 971 '$THIRD_PARTY_DIR/v8/bin-dbg/libjscre.lib', |
1093 '$THIRD_PARTY_DIR/skia/skia-dbg-win32-i386.lib', | 972 '$THIRD_PARTY_DIR/skia/skia-dbg-win32-i386.lib', |
1094 ] | 973 ] |
1095 | 974 |
1096 if env['BROWSER'] == 'NPAPI': | 975 if env['BROWSER'] == 'NPAPI': |
1097 libs += ['$OPEN_DIR/base/chrome/module.def',] | 976 libs += ['$OPEN_DIR/base/chrome/module.def',] |
1098 elif env['BROWSER'] == 'IE': | 977 elif env['BROWSER'] == 'IE': |
1099 libs += ['$OPEN_DIR/tools/mscom.def',] | 978 libs += ['$OPEN_DIR/tools/mscom.def',] |
1100 | 979 |
1101 sconscripts = [ | |
1102 'SConscript.libgd', | |
1103 'SConscript.libjpeg', | |
1104 'SConscript.libpng', | |
1105 'SConscript.portaudio', | |
1106 'SConscript.sqlite', | |
1107 'SConscript.zlib', | |
1108 ] | |
1109 | |
1110 # TODO: all the other ports, including third-party libs | 980 # TODO: all the other ports, including third-party libs |
1111 # - IE, FF[23], SAFARI, android, symbian | 981 # - IE, FF[23], SAFARI, android, symbian |
1112 # - breakpad[_osx] | 982 # - breakpad[_osx] |
1113 # - glint | 983 # - glint |
1114 # - growl | 984 # - growl |
1115 # - spidermonkey | 985 # - spidermonkey |
1116 # - libspeex | 986 # - libspeex |
1117 # - libtremor | 987 # - libtremor |
1118 # - vista broker | 988 # - vista broker |
1119 # TODO: other targets | 989 # TODO: other targets |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 env_browser.Depends(html_m4, stab) | 1028 env_browser.Depends(html_m4, stab) |
1159 | 1029 |
1160 # genfiles/%.from_bin.cc: % | 1030 # genfiles/%.from_bin.cc: % |
1161 bins = [env_common.Bin2cpp(src + '.from_bin.cc', src) | 1031 bins = [env_common.Bin2cpp(src + '.from_bin.cc', src) |
1162 for src in binsrcs['common']] | 1032 for src in binsrcs['common']] |
1163 installed_bins = env_common.Install('$GENFILES_DIR', bins) | 1033 installed_bins = env_common.Install('$GENFILES_DIR', bins) |
1164 srcs['all'] += installed_bins | 1034 srcs['all'] += installed_bins |
1165 | 1035 |
1166 # genfiles/%.h: %.idl | 1036 # genfiles/%.h: %.idl |
1167 # Note: the emitter fixes the targets to be put in genfiles. | 1037 # Note: the emitter fixes the targets to be put in genfiles. |
1168 idls = [env_browser.TypeLibrary(src) | 1038 if idlsrcs['all']: |
1169 for src in idlsrcs['all']] | 1039 idls = [env_browser.TypeLibrary(src) |
1170 installed_idls = idls | 1040 for src in idlsrcs['all']] |
1171 srcs['all'] += [x for x in installed_idls[0] if str(x).endswith('_i.c')] | 1041 installed_idls = idls |
| 1042 srcs['all'] += [x for x in installed_idls[0] if str(x).endswith('_i.c')] |
1172 | 1043 |
1173 # TODO: figure out why the .rc scanner doesn't notice these dependencies. | 1044 # TODO: figure out why the .rc scanner doesn't notice these dependencies. |
1174 env_browser.Depends(dll_resources[0], installed_html_m4s) | 1045 env_browser.Depends(dll_resources[0], installed_html_m4s) |
1175 env_browser.Depends(dll_resources[1], installed_m4s) | 1046 env_browser.Depends(dll_resources[1], installed_m4s) |
1176 | 1047 |
1177 env_browser.SConscript(sconscripts, exports=['env']) | |
1178 | |
1179 lib = env_browser.ChromeSharedLibrary('gears', | 1048 lib = env_browser.ChromeSharedLibrary('gears', |
1180 srcs['all'] + libs + dll_resources) | 1049 srcs['all'] + libs + dll_resources) |
1181 env_browser.Alias('gears', lib) | 1050 env_browser.Alias('gears', lib) |
OLD | NEW |