OLD | NEW |
| (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 | |
7 import utils | |
8 | |
9 Import('env') | |
10 | |
11 env = env.Clone() | |
12 | |
13 | |
14 # Building .from_bin.cc files. | |
15 | |
16 # Must be run from within the gears dir. More hoops to jump through to fix up | |
17 # path names and arguments. | |
18 env.Replace( | |
19 # len() + 1 to include trailing '/' | |
20 # TODO: is there a better way to strip off $OPEN_DIR from $SOURCE? | |
21 LEN_OPEN_DIR = len(os.path.normpath(env.subst('$OPEN_DIR'))) + 1, | |
22 BIN2CPP = 'cd $OPEN_DIR && python tools/bin2cpp.py', | |
23 BIN2CPPCOM = '$BIN2CPP ${str(SOURCE)[LEN_OPEN_DIR:]} > ${TARGET.abspath}', | |
24 ) | |
25 bin2cpp_builder = Builder(action = '$BIN2CPPCOM') | |
26 env.Append(BUILDERS = {'Bin2cpp': bin2cpp_builder}) | |
27 | |
28 | |
29 # C++ flags. | |
30 | |
31 env.Prepend( | |
32 CPPDEFINES = [ | |
33 # Common items, like notifier, are not related to any browser. | |
34 'BROWSER_NONE=1', | |
35 ] | |
36 ) | |
37 | |
38 # OS X needs to be 'LINUX' in common sources. | |
39 # TODO(nigeltao): Should we instead have a UNIX flag, rather than calling | |
40 # Mac OS X a "flavor of Linux"?? | |
41 if env['OS'] == 'osx': | |
42 env.Append(CPPDEFINES = ['LINUX']) | |
43 | |
44 | |
45 #----------------------------------------------------------------------------- | |
46 # Generate the dependency tree. | |
47 | |
48 def PatternRule(t, s): return utils.PatternRule(t, s, env) | |
49 def GetInputs(var): return utils.GetInputs(var, env) | |
50 | |
51 outputs = {} | |
52 | |
53 # genfiles/%: %.m4 | |
54 outputs['COMMON_M4S'] = \ | |
55 [env.M4(*PatternRule('$COMMON_GENFILES_DIR/${SOURCE.filebase}', src)) | |
56 for src in GetInputs('$COMMON_M4SRCS')] | |
57 | |
58 # genfiles/%.from_bin.cc: % | |
59 if GetInputs('$COMMON_BINSRCS'): | |
60 bins = [env.Bin2cpp(*PatternRule( | |
61 '$COMMON_GENFILES_DIR/${SOURCE.file}.from_bin.cc', src)) | |
62 for src in GetInputs('$COMMON_BINSRCS')] | |
63 outputs['BROWSER_LINKSRCS'] = [env.SharedObject(bin) for bin in bins] | |
64 | |
65 outputs['IPC_TEST_EXE'] = env.ChromeProgram('ipc_test', | |
66 GetInputs('$IPC_TEST_CPPSRCS')) | |
67 | |
68 # Note: crash_sender.exe name needs to stay in sync with name used in | |
69 # exception_handler_win32.cc and exception_handler_osx/google_breakpad.mm. | |
70 outputs['CRASH_SENDER_EXE'] = None | |
71 if env['OS'] == 'win32': | |
72 outputs['CRASH_SENDER_EXE'] = env.ChromeProgram('crash_sender', | |
73 GetInputs('$CRASH_SENDER_CPPSRCS'), | |
74 LIBS = Split('advapi32.lib shell32.lib wininet.lib')) | |
75 elif env['OS'] == 'osx': | |
76 outputs['CRASH_SENDER_EXE'] = env.ChromeProgram('crash_sender', | |
77 GetInputs('$CRASH_SENDER_CPPSRCS'), | |
78 FRAMEWORKS = env['FRAMEWORKS'] + | |
79 Split('Carbon Cocoa Foundation IOKit SystemConfiguration'), | |
80 LIBS = env['LIBS'] + ['crypto', 'stdc++']) | |
81 env.Alias('gears', outputs['CRASH_SENDER_EXE']) | |
82 | |
83 if env['OS'] == 'osx': | |
84 # Crash inspector is launched by the crashed process from it's exception | |
85 # handler and is what actually communicates with the crashed process to | |
86 # extract the minidump. It then launches crash_sender in order to actually | |
87 # send the minidump over the wire. | |
88 outputs['OSX_CRASH_INSPECTOR_EXE'] = env.ChromeProgram('crash_inspector', | |
89 GetInputs('$OSX_CRASH_INSPECTOR_CPPSRCS'), | |
90 FRAMEWORKS = env['FRAMEWORKS'] + ['Carbon'], | |
91 LIBS = env['LIBS'] + ['breakpad_osx-gears']) | |
92 | |
93 outputs['OSX_LAUNCHURL_EXE'] = env.ChromeProgram('launch_url_with_browser', | |
94 GetInputs('$OSX_LAUNCHURL_CPPSRCS'), | |
95 FRAMEWORKS = env['FRAMEWORKS'] + | |
96 Split('CoreFoundation ApplicationServices'), | |
97 LIBS = env['LIBS'] + ['stdc++']) | |
98 | |
99 outputs['SF_INSTALLER_PLUGIN_EXE'] = env.ChromeSharedLibrary('stats_pane', | |
100 GetInputs('$SF_INSTALLER_PLUGIN_CPPSRCS'), | |
101 FRAMEWORKS = env['FRAMEWORKS'] + Split('Cocoa InstallerPlugins')) | |
102 | |
103 # See main SConscript for how 'outputs' is used. | |
104 Return('outputs') | |
OLD | NEW |