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

Side by Side Diff: gears/SConscript.browser

Issue 6576020: Remove Gears from Chrome (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: windows fixes Created 9 years, 9 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 | « gears/SConscript ('k') | gears/SConscript.common » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5 import os
6 import utils
7
8 Import('env')
9
10 env = env.Clone()
11
12 # TODO: move all these builders out to site_scons or somesuch.
13
14 # TODO: all the other ports, including third-party libs
15 # - SAFARI, android, symbian
16 # - breakpad[_osx]
17 # - glint
18 # - growl
19 # - spidermonkey
20 # - libspeex
21 # - libtremor
22 # TODO: other targets
23 # - installer (safari, android, ...)
24
25 # Initialize our BROWSER_* input files.
26 env.InitBrowserInputs()
27
28
29 # Building .stab files, using M4FLAGS.
30
31 env.Replace(
32 STAB = 'python $OPEN_DIR/tools/parse_stab.py',
33 I18N_INPUTS_BASEDIR = '$OPEN_DIR/ui/generated',
34 STABCOM = \
35 '$STAB $M4FLAGS ${_M4INCFLAGS} $TARGET $SOURCE $I18N_INPUTS_BASEDIR',
36 )
37 stab_builder = Builder(action = '$STABCOM', src_suffix = '.stab')
38 env.Append(BUILDERS = {'Stab': stab_builder})
39
40
41 # Building .idl files.
42 # This is a total mess. MIDL needs to be run from $OPEN_DIR because it's too
43 # stupid to apply its include paths to a relative path like "ui/ie/bla.idl"
44 # (it only looks in the current dir). So we have to jump through hoops to fix
45 # up our relative include paths and output files.
46 env.Tool('midl')
47
48 if env['BROWSER'] == 'IE':
49 env.Replace(
50 SCONS_DIR = '..', # the scons dir relative to OPEN_DIR
51 IDLINCPREFIX = '/I$SCONS_DIR/',
52 IDLINCSUFFIX = '',
53 _IDLINCFLAGS = ('${_concat(IDLINCPREFIX, CPPPATH, IDLINCSUFFIX, '
54 '__env__, RDirs, TARGET, SOURCE)}'),
55 IDLDEFPREFIX = '/D',
56 IDLDEFSUFFIX = '',
57 _IDLDEFFLAGS = ('${_defines(IDLDEFPREFIX, CPPDEFINES, '
58 'IDLDEFSUFFIX, __env__)}'),
59 MIDLCOM = (
60 'cd $OPEN_DIR && '
61 '$MIDL ${_IDLDEFFLAGS} ${_IDLINCFLAGS} -env win32 -Oicf '
62 '/tlb $SCONS_DIR/${TARGET.base}.tlb '
63 '/h $SCONS_DIR/${TARGET.base}.h '
64 '/iid $SCONS_DIR/${TARGET.base}_i.c '
65 '/proxy $SCONS_DIR/${TARGET.base}_p.c '
66 '/dlldata $SCONS_DIR/${TARGET.base}_data.c '
67 '$SCONS_DIR/$SOURCE'
68 ),
69 )
70 elif env['BROWSER'] in ['FF2', 'FF3']:
71 env.Replace(
72 GECKO_SDK = '$GECKO_BASE/$OS',
73 GECKO_BIN = '$GECKO_SDK/gecko_sdk/bin',
74 GECKO_LIB = '$GECKO_SDK/gecko_sdk/lib',
75 MIDLCOM = (
76 'xpidl -I $GECKO_SDK/gecko_sdk/idl -I $GECKO_BASE '
77 '-m header -o ${TARGET.base} $SOURCE && '
78 'xpidl -I $GECKO_SDK/gecko_sdk/idl -I $GECKO_BASE '
79 '-m typelib -o ${TARGET.base} $SOURCE'
80 ),
81 )
82 if env['BROWSER'] == 'FF2':
83 env['GECKO_BASE'] = '$THIRD_PARTY_DIR/gecko_1.8'
84 else:
85 env['GECKO_BASE'] = '$THIRD_PARTY_DIR/gecko_1.9'
86
87 env.PrependENVPath('PATH', env.Dir('#/$GECKO_BIN').abspath)
88
89 def MyIdlEmitter(target, source, env):
90 """Produce the list of outputs generated by our IDL compiler. Outputs
91 differ depending on whether we're using xpidl (Firefox) or midl (IE)."""
92 base = os.path.splitext(str(target[0]))[0]
93 if 'xpidl' in env['MIDLCOM']:
94 # Firefox's IDL compiler only generates .h and .xpt files.
95 target = [base + '.h', base + '.xpt']
96 else:
97 # MIDL generates the following. Depending on the IDL, a .tlb is
98 # generated, but since we can't know, we'll just ignore that.
99 target = [base + '.h', base + '_i.c', base + '_p.c', base + '_data.c']
100 return (target, source)
101 # Copy the builder object so we don't overwrite everyone's
102 # emitter with ours.
103 import copy
104 env['BUILDERS']['TypeLibrary'] = copy.copy(env['BUILDERS']['TypeLibrary'])
105 env['BUILDERS']['TypeLibrary'].emitter = MyIdlEmitter
106
107
108 # Building .xpt files.
109
110 if env['BROWSER'] in ['FF2', 'FF3']:
111 env.Replace(
112 XPTLINK = 'xpt_link',
113 XPTLINKCOM = '$XPTLINK $TARGET $SOURCES',
114 )
115 xpt_builder = Builder(action = '$XPTLINKCOM', src_suffix = '.xpt')
116 env.Append(BUILDERS = {'XptLink': xpt_builder})
117
118
119 # C++ defines
120
121 env.Prepend(
122 CPPDEFINES = [
123 'BROWSER_${BROWSER}=1',
124 ],
125 )
126
127 if env['BROWSER'] in ['FF2', 'FF3']:
128
129 if env['OS'] == 'osx':
130 env.Prepend(
131 CPPDEFINES = [
132 'LINUX'
133 ]
134 )
135
136 env.Prepend(
137 CPPDEFINES = [
138 # TODO(cprince): Update source files so we don't need this compatibility define?
139 'BROWSER_FF=1',
140 'MOZILLA_STRICT_API',
141 # SpiderMonkey (the Firefox JS engine)'s JS_GET_CLASS macro in jsapi.h needs
142 # this defined to work with the gecko SDK that we've built.
143 # The definition of JS_THREADSAFE must be kept in sync with MOZJS_CPPFLAGS.
144 'JS_THREADSAFE',
145 ],
146 CPPPATH = [
147 '$GECKO_BASE',
148 '$GECKO_SDK',
149 '$GECKO_SDK/gecko_sdk/include',
150 ],
151 )
152 elif env['BROWSER'] == 'NPAPI' and env['OS'] == 'win32':
153 env.Prepend(
154 CPPDEFINES = [
155 'BROWSER_CHROME=1',
156 ],
157 )
158 elif env['BROWSER'] == 'SF':
159 env.Replace(
160 # Enable breakpad for Safari on MacOSX.
161 USING_BREAKPAD_OSX = '1')
162
163 env.Append(
164 CPPDEFINES = [
165 # Remove these - During development, it was convenient to have these defined in
166 # the Safari port. Before release we want to clean this up, and replace these
167 # with a single BROWSER_SF symbol.
168 # We also want to consolidate the include paths, so we don't have to add these
169 # paths here.
170 'BROWSER_NPAPI',
171 'BROWSER_WEBKIT',
172 'BROWSER_SAFARI'
173 ],
174 CCFLAGS = [
175 # These flags are needed so that instead of exporting all symbols defined in
176 # the code, we just export those specifically marked, this reduces the output
177 # size.
178 '-fvisibility=hidden'
179 ],
180 CPPPATH = ['$THIRD_PARTY/spidermonkey/nspr/pr/include']
181 )
182
183 env.Append(
184 LIBS = [
185 'googleurl-gears',
186 'png-gears',
187 'sqlite-gears',
188 'zlib-gears',
189 ],
190 )
191
192 if env['OS'] == 'osx':
193 env.Append(
194 LIBS = [
195 'mozjs-gears',
196 'curl',
197 'crypto',
198 'leopard_support',
199 'breakpad_osx-gears'
200 ],
201 LIBPATH = [
202 '$OPEN_DIR/tools/osx'
203 ],
204 )
205
206 # Add in libraries for in-development APIs for non-official builds.
207 if not env['OFFICIAL_BUILD']:
208 env.Append(LIBS = [
209 'jpeg-gears',
210 'gd',
211 ])
212
213 # Except on these platforms.
214 if env['OS'] == 'wince':
215 env.FilterOut(LIBS = [
216 'gd',
217 'jpeg-gears',
218 ])
219
220 if env['OS'] == 'android':
221 env.Append(LIBS = [
222 'mozjs-gears',
223 ])
224 env.FilterOut(LIBS = [
225 'googleurl-gears',
226 'sqlite-gears',
227 'png-gears',
228 'zlib-gears',
229 'jpeg-gears',
230 'gd',
231 ])
232
233 if env['BROWSER'] == 'IE':
234 if env['OS'] == 'win32':
235 env.Append(
236 LIBS = [
237 'kernel32.lib',
238 'user32.lib',
239 'gdi32.lib',
240 'uuid.lib',
241 'sensapi.lib',
242 'shlwapi.lib',
243 'shell32.lib',
244 'advapi32.lib',
245 'wininet.lib',
246 'comdlg32.lib',
247 'user32.lib',
248 ],
249 )
250 else: # OS=wince
251 env.Append(
252 LIBS = [
253 'wininet.lib',
254 'ceshell.lib',
255 'coredll.lib',
256 'corelibc.lib',
257 'ole32.lib',
258 'oleaut32.lib',
259 'uuid.lib',
260 'commctrl.lib',
261 'atlosapis.lib',
262 'piedocvw.lib',
263 'cellcore.lib',
264 'htmlview.lib',
265 'imaging.lib',
266 'toolhelp.lib',
267 'aygshell.lib',
268 'iphlpapi.lib',
269 'gpsapi.lib',
270 ],
271 )
272 elif env['BROWSER'] in ['FF2', 'FF3']:
273 env.Append(LIBPATH = '$GECKO_LIB')
274
275 if env['BROWSER'] == 'FF2':
276 env.Append(LIBS = '$FF2_LIBS')
277 else:
278 env.Append(LIBS = '$FF3_LIBS')
279
280 if env['OS'] == 'win32':
281 env.Append(
282 LIBS = [
283 'xpcom',
284 'xpcomglue_s',
285 'nspr4.lib',
286 'js3250.lib',
287 'ole32.lib',
288 'shell32.lib',
289 'shlwapi.lib',
290 'advapi32.lib',
291 'wininet.lib',
292 'comdlg32.lib',
293 'user32.lib',
294 ],
295 )
296 elif env['OS'] == 'linux':
297 env.Append(
298 LIBS = [
299 'xpcom',
300 'xpcomglue_s',
301 ],
302 # Although the 1.9 SDK contains libnspr4, it is better to link against
303 # libxul, which in turn depends on libnspr4. In Ubuntu 8.04, libnspr4 was
304 # not listed in /usr/lib, only libxul was.
305 FF2_LIBS = ['nspr4'],
306 FF3_LIBS = ['xul'],
307 )
308 elif env['OS'] == 'osx':
309 env.Append(
310 LIBS = [
311 'xpcom',
312 'mozjs',
313 'nspr4',
314 'plds4',
315 'plc4',
316 ],
317 FF2_LIBS = ['xpcom_core'],
318 # TODO(mpcomplete): the Makefiles specify many more libs, but we link fine with
319 # just this. Why?
320 FF3_LIBS = ['xpcomglue_s'],
321 )
322 elif env['BROWSER'] == 'NPAPI':
323 if env['OS'] == 'win32':
324 env.Append(
325 LIBS = [
326 'delayimp.lib',
327 'comdlg32.lib',
328 ],
329 SHLINKFLAGS = [
330 '/DELAYLOAD:"comdlg32.dll"',
331 ],
332 )
333
334
335 # Building resources.
336 if env['OS'] in ['win32', 'wince']:
337 env_res = env.Clone()
338 env_res.Replace(
339 CPPDEFINES = [
340 '_UNICODE',
341 'UNICODE',
342 '$EXTRA_DEFINES',
343 ],
344 EXTRA_DEFINES = [
345 'BROWSER_${BROWSER}=1',
346 ],
347 CPPPATH = [
348 '$COMMON_GENFILES_DIR/..',
349 '$GENFILES_DIR/..',
350 '$OPEN_DIR',
351 '$VC80_CPPPATH',
352 ],
353 )
354
355 if env['MODE'] == 'dbg':
356 env_res.Append(CPPDEFINES = 'DEBUG=1')
357 else:
358 env_res.Append(CPPDEFINES = 'NDEBUG=1')
359
360 env_res.Append(RCFLAGS = [('/l', '0x409')])
361 if env['OS'] == 'win32':
362 env_res.Append(
363 CPPPATH = [
364 '$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80/files/include',
365 ],
366 )
367 elif env['OS'] == 'wince':
368 env_res.Append(
369 CPPDEFINES = [
370 'OS_WINCE',
371 '_WIN32',
372 '_WIN32_WCE',
373 'UNDER_CE',
374 ],
375 CPPPATH = [
376 '$OPEN_DIR/..',
377 '$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80ce/files/include',
378 ],
379 RCFLAGS = [
380 '-N',
381 ]
382 )
383 else:
384 env_res = None
385
386 if env['OS'] == 'win32':
387 # TODO: move to breakpad
388 env.Append(CPPFLAGS = ['/wd4018'])
389
390 # TODO(playmobil): Create builder to generate required header files.
391 # browser_specific_objects += \
392 # env.SharedObject('$OPEN_DIR/base/safari/resource_archive.cc')
393
394 #-----------------------------------------------------------------------------
395 # Generate the dependency tree.
396
397 def PatternRule(t, s): return utils.PatternRule(t, s, env)
398 def GetInputs(var): return utils.GetInputs(var, env)
399
400 outputs = {}
401
402 # genfiles/%: %.m4
403 m4s = [env.M4(*PatternRule('$GENFILES_DIR/${SOURCE.filebase}', src))
404 for src in GetInputs('$BROWSER_M4SRCS')]
405 outputs['M4S'] = m4s
406
407 # genfiles/%.html: %.html_m4
408 html_m4s = [env.M4(
409 *PatternRule('$GENFILES_DIR/${SOURCE.filebase}.html', src))
410 for src in GetInputs('$BROWSER_HTML_M4SRCS')]
411
412 # genfiles/i18n/%: %.m4
413 # This magic grabs the last *2* components from the path ("en-US/foo.m4")
414 def PathEnd(path, n):
415 """Returns the last n components of the given path.
416 Example: PathEnd('/foo/bar/baz', 2) == 'bar/baz'"""
417 split_path = os.path.normpath(path).split(os.sep)
418 return os.sep.join(split_path[-n:])
419 env['PathEnd'] = PathEnd
420 tmp_pattern = '$GENFILES_DIR/i18n/${PathEnd(str(SOURCE.base), 2)}'
421 i18n_m4s = [env.M4(*PatternRule(tmp_pattern, src))
422 for src in GetInputs('$BROWSER_I18N_M4SRCS')]
423
424 # genfiles/%.js: %.js.stab
425 stabs = [env.Stab(
426 *PatternRule('$GENFILES_DIR/${SOURCE.filebase}', src))
427 for src in GetInputs('$BROWSER_STABSRCS')]
428
429 # genfiles/%.html: %.js
430 for stab in stabs:
431 env.Depends(*PatternRule('${SOURCE.base}.html', stab))
432
433 # genfiles/%.tlb: %.idl
434 xptsrcs = []
435 for src in GetInputs('$BROWSER_IDLSRCS'):
436 idl = env.TypeLibrary(
437 *PatternRule('$GENFILES_DIR/${SOURCE.filebase}.tlb', src))
438 env.Append(BROWSER_CPPSRCS = [x for x in idl if str(x).endswith('_i.c')])
439 if env['BROWSER'] in ['FF2', 'FF3']:
440 xptsrcs += [x for x in idl if str(x).endswith('.xpt')]
441
442 if env['BROWSER'] in ['FF2', 'FF3']:
443 outputs['MODULE_TYPELIB'] = env.XptLink('gears.xpt', xptsrcs)
444
445 if env_res:
446 # genfiles/%.res: %.rc
447 env.Append(BROWSER_SHLINKSRCS = [
448 [env_res.RES(
449 *PatternRule('$GENFILES_DIR/${SOURCE.filebase}.res', src))
450 for src in GetInputs('$BROWSER_RESSRCS')]
451 ])
452
453 # TODO: figure out why the .rc scanner doesn't notice these dependencies.
454 if env['OS'] in ['win32', 'wince'] and env['BROWSER'] in ['NPAPI', 'IE']:
455 env.Depends('$GENFILES_DIR/ui_resources.rc', html_m4s)
456 env.Depends('$OPEN_DIR/base/npapi/module.rc', m4s)
457
458 # Safari resources
459 if env['BROWSER'] == 'SF':
460 env.Replace(
461 WEBARCHIVER = '$OPEN_DIR/tools/osx/webarchiver/webarchiver',
462 GEN_RESOURCE_LIST = 'python $OPEN_DIR/tools/osx/gen_resource_list.py',
463 GEN_RESOURCES = ['$GENFILES_DIR/resource_list.h'],
464 )
465 def WebArchiver(src):
466 src_basename = os.path.basename(os.path.splitext(src)[0])
467 return ('$WEBARCHIVER "$GENFILES_DIR/%s.webarchive" "%s" '
468 ' $COMMON_RESOURCES' % (src_basename, src))
469 def XXD(src):
470 src_basename = os.path.basename(os.path.splitext(src)[0])
471 env.Append(GEN_RESOURCES = ['$GENFILES_DIR/%s.h' % src_basename])
472 return 'xxd -i "%s" > "$GENFILES_DIR/%s.h"' % (src, src_basename)
473 resource_list_h = env.Command(
474 '$GENFILES_DIR/resource_list.h',
475 GetInputs('$COMMON_RESOURCES') + html_m4s,
476 [WebArchiver('$GENFILES_DIR/permissions_dialog.html'),
477 WebArchiver('$GENFILES_DIR/shortcuts_dialog.html'),
478 WebArchiver('$GENFILES_DIR/settings_dialog.html'),
479 XXD('$GENFILES_DIR/permissions_dialog.webarchive'),
480 XXD('$GENFILES_DIR/shortcuts_dialog.webarchive'),
481 XXD('$GENFILES_DIR/settings_dialog.webarchive'),
482 XXD('$OPEN_DIR/ui/common/location_data.png'),
483 XXD('$OPEN_DIR/ui/common/local_data.png'),
484 '$GEN_RESOURCE_LIST $GEN_RESOURCES'],
485 )
486 resource_obj = env.SharedObject(
487 '$GENFILES_DIR/resources',
488 '$OPEN_DIR/base/safari/resource_archive.cc')
489 env.Depends(resource_obj, resource_list_h)
490 env.Append(BROWSER_LINKSRCS = resource_obj)
491
492
493 # HACK: gears, vista_broker, and wince_setup share some inputs, but the
494 # Chrome* helpers muck with the environment, so SCons complains if we try to
495 # compile those inputs differently. So we try to precompile them before
496 # passing them to those methods first. So far, only *_CPPSRCS inputs
497 # are shared.
498
499 module = env.ChromeSharedLibrary('gears-$OS-$ARCH-$MODE-${BROWSER}',
500 env.SharedObject(GetInputs('$BROWSER_CPPSRCS')) +
501 GetInputs('$BROWSER_LINKSRCS $BROWSER_SHLINKSRCS'))
502 outputs['MODULE'] = env.InstallAs('${SHLIBPREFIX}gears${SHLIBSUFFIX}', module)
503 if env['OS'] in ['win32', 'wince'] and env['MODE'] == 'dbg':
504 outputs['MODULE_PDB'] = env.InstallAs('gears.pdb',
505 'gears-$OS-$ARCH-$MODE-${BROWSER}.pdb')
506
507 if env['GEARS_STATIC_LIB']:
508 if env['OS'] == 'win32' and env['BROWSER'] == 'NPAPI':
509 lib = env.ChromeLibrary('gears-static',
510 env.SharedObject(GetInputs('$BROWSER_CPPSRCS')) +
511 GetInputs('$BROWSER_LINKSRCS'))
512 env.Alias('gears', lib)
513 else:
514 env.Alias('gears', outputs['MODULE'])
515 if 'MODULE_PDB' in outputs:
516 env.Alias('gears', outputs['MODULE_PDB'])
517
518 if env['OS'] == 'wince':
519 env.Append(WINCE_SETUP_LINKSRCS = [
520 [env_res.RES(*PatternRule('$GENFILES_DIR/${SOURCE.filebase}.res', src))
521 for src in GetInputs('$WINCE_SETUP_RESSRCS')]
522 ])
523 outputs['WINCE_SETUP_DLL'] = env.ChromeSharedLibrary('setup',
524 env.SharedObject(GetInputs('$WINCE_SETUP_CPPSRCS')) +
525 GetInputs('$WINCE_SETUP_LINKSRCS'))
526
527 if env['OS'] == 'win32' and env['BROWSER'] == 'IE':
528 # Note: We use IE_OUTDIR so that relative path from gears.dll is same in
529 # development environment as deployment environment.
530 # Note: vista_broker.exe needs to stay in sync with name used in
531 # desktop_win32.cc.
532 # TODO(aa): This can move to common_outdir like crash_sender.exe
533 env.Append(VISTA_BROKER_LINKSRCS = [
534 [env_res.RES('$GENFILES_DIR/vista_broker_${SOURCE.filebase}.res',
535 env_res.File(src), EXTRA_DEFINES = 'VISTA_BROKER=1')
536 for src in GetInputs('$VISTA_BROKER_RESSRCS')]
537 ])
538 outputs['VISTA_BROKER_EXE'] = env.ChromeProgram('vista_broker',
539 env.SharedObject(GetInputs('$VISTA_BROKER_CPPSRCS')) +
540 GetInputs('$VISTA_BROKER_LINKSRCS'))
541 env.Alias('gears', outputs['VISTA_BROKER_EXE'])
542
543 if env['BROWSER'] == 'SF':
544 outputs['PROXY_DLL'] = env.ChromeSharedLibrary('gears_proxy',
545 GetInputs('$SF_PROXY_DLL_CPPSRCS'))
546 outputs['INPUTMANAGER_EXE'] = env.ChromeProgram('GearsEnabler',
547 GetInputs('$SF_INPUTMANAGER_CPPSRCS'),
548 FRAMEWORKS = env['FRAMEWORKS'] + Split('Foundation AppKit'))
549
550 # See main SConscript for how 'outputs' is used.
551 Return('outputs')
OLDNEW
« no previous file with comments | « gears/SConscript ('k') | gears/SConscript.common » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698