OLD | NEW |
1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2009 The Chromium OS 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 | 6 |
7 # Protobuffer compilation | 7 # Protobuffer compilation |
8 """ Inputs: | 8 """ Inputs: |
9 target: list of targets to compile to | 9 target: list of targets to compile to |
10 source: list of sources to compile | 10 source: list of sources to compile |
(...skipping 21 matching lines...) Expand all Loading... |
32 commands = [ | 32 commands = [ |
33 '/usr/bin/protoc ' | 33 '/usr/bin/protoc ' |
34 ' --proto_path . ${SOURCES} --cpp_out .'] | 34 ' --proto_path . ${SOURCES} --cpp_out .'] |
35 return commands | 35 return commands |
36 | 36 |
37 proto_builder = Builder(generator = ProtocolBufferGenerator, | 37 proto_builder = Builder(generator = ProtocolBufferGenerator, |
38 emitter = ProtocolBufferEmitter, | 38 emitter = ProtocolBufferEmitter, |
39 single_source = 1, | 39 single_source = 1, |
40 suffix = '.pb.cc') | 40 suffix = '.pb.cc') |
41 | 41 |
| 42 """ Inputs: |
| 43 target: unused |
| 44 source: list containing the source .xml file |
| 45 env: the scons environment in which we are compiling |
| 46 Outputs: |
| 47 target: the list of targets we'll emit |
| 48 source: the list of sources we'll process""" |
| 49 def DbusBindingsEmitter(target, source, env): |
| 50 output = str(source[0]) |
| 51 output = output[0:output.rfind('.xml')] |
| 52 target = [ |
| 53 output + '.dbusserver.h', |
| 54 output + '.dbusclient.h' |
| 55 ] |
| 56 return target, source |
| 57 |
| 58 """ Inputs: |
| 59 source: list of sources to process |
| 60 target: list of targets to generate |
| 61 env: scons environment in which we are working |
| 62 for_signature: unused |
| 63 Outputs: a list of commands to execute to generate the targets from |
| 64 the sources.""" |
| 65 def DbusBindingsGenerator(source, target, env, for_signature): |
| 66 commands = [] |
| 67 for target_file in target: |
| 68 if str(target_file).endswith('.dbusserver.h'): |
| 69 mode_flag = '--mode=glib-server ' |
| 70 else: |
| 71 mode_flag = '--mode=glib-client ' |
| 72 cmd = '/usr/bin/dbus-binding-tool %s --prefix=update_engine_service ' \ |
| 73 '%s > %s' % (mode_flag, str(source[0]), str(target_file)) |
| 74 commands.append(cmd) |
| 75 return commands |
| 76 |
| 77 dbus_bindings_builder = Builder(generator = DbusBindingsGenerator, |
| 78 emitter = DbusBindingsEmitter, |
| 79 single_source = 1, |
| 80 suffix = 'dbusclient.h') |
| 81 |
42 env = Environment() | 82 env = Environment() |
43 for key in Split('CC CXX AR RANLIB LD NM'): | 83 for key in Split('CC CXX AR RANLIB LD NM'): |
44 value = os.environ.get(key) | 84 value = os.environ.get(key) |
45 if value != None: | 85 if value != None: |
46 env[key] = value | 86 env[key] = value |
47 for key in Split('CFLAGS CCFLAGS CPPPATH LIBPATH'): | 87 for key in Split('CFLAGS CCFLAGS CPPPATH LIBPATH'): |
48 value = os.environ.get(key) | 88 value = os.environ.get(key) |
49 if value != None: | 89 if value != None: |
50 env[key] = Split(value) | 90 env[key] = Split(value) |
51 | 91 |
52 for key in Split('PKG_CONFIG_LIBDIR PKG_CONFIG_PATH SYSROOT'): | 92 for key in Split('PKG_CONFIG_LIBDIR PKG_CONFIG_PATH SYSROOT'): |
53 if os.environ.has_key(key): | 93 if os.environ.has_key(key): |
54 env['ENV'][key] = os.environ[key] | 94 env['ENV'][key] = os.environ[key] |
55 | 95 |
56 | 96 |
| 97 # -Wclobbered |
| 98 # -Wempty-body |
| 99 # -Wignored-qualifiers |
| 100 # -Wtype-limits |
57 env['CCFLAGS'] = ' '.join("""-g | 101 env['CCFLAGS'] = ' '.join("""-g |
58 -fno-exceptions | 102 -fno-exceptions |
59 -fno-strict-aliasing | 103 -fno-strict-aliasing |
60 -Wall | 104 -Wall |
61 -Werror | |
62 -Wclobbered | 105 -Wclobbered |
63 -Wempty-body | 106 -Wempty-body |
| 107 -Werror |
64 -Wignored-qualifiers | 108 -Wignored-qualifiers |
65 -Wmissing-field-initializers | 109 -Wmissing-field-initializers |
66 -Wsign-compare | 110 -Wsign-compare |
67 -Wtype-limits | 111 -Wtype-limits |
68 -Wuninitialized | 112 -Wuninitialized |
69 -D__STDC_FORMAT_MACROS=1 | 113 -D__STDC_FORMAT_MACROS=1 |
70 -D_FILE_OFFSET_BITS=64 | 114 -D_FILE_OFFSET_BITS=64 |
71 -I/usr/include/libxml2""".split()); | 115 -I/usr/include/libxml2""".split()); |
72 env['CCFLAGS'] += (' ' + ' '.join(env['CFLAGS'])) | 116 env['CCFLAGS'] += (' ' + ' '.join(env['CFLAGS'])) |
73 | 117 |
74 env['LIBS'] = Split("""base | 118 env['LIBS'] = Split("""base |
75 bz2 | 119 bz2 |
76 curl | 120 curl |
77 gflags | 121 gflags |
78 glib-2.0 | 122 glib-2.0 |
79 gtest | 123 gtest |
80 gthread-2.0 | 124 gthread-2.0 |
81 libpcrecpp | 125 libpcrecpp |
82 protobuf | 126 protobuf |
83 pthread | 127 pthread |
84 ssl | 128 ssl |
85 xml2 | 129 xml2 |
86 z""") | 130 z""") |
87 env['CPPPATH'] = ['..', '../../third_party/chrome/files', '../../common'] | 131 env['CPPPATH'] = ['..', '../../third_party/chrome/files', '../../common'] |
88 env['LIBPATH'] = ['../../third_party/chrome'] | 132 env['LIBPATH'] = ['../../third_party/chrome'] |
89 env['BUILDERS']['ProtocolBuffer'] = proto_builder | 133 env['BUILDERS']['ProtocolBuffer'] = proto_builder |
| 134 env['BUILDERS']['DbusBindings'] = dbus_bindings_builder |
90 | 135 |
91 # Fix issue with scons not passing pkg-config vars through the environment. | 136 # Fix issue with scons not passing pkg-config vars through the environment. |
92 for key in Split('PKG_CONFIG_LIBDIR PKG_CONFIG_PATH'): | 137 for key in Split('PKG_CONFIG_LIBDIR PKG_CONFIG_PATH'): |
93 if os.environ.has_key(key): | 138 if os.environ.has_key(key): |
94 env['ENV'][key] = os.environ[key] | 139 env['ENV'][key] = os.environ[key] |
95 | 140 |
96 env.ParseConfig('pkg-config --cflags --libs glib-2.0') | 141 env.ParseConfig('pkg-config --cflags --libs glib-2.0 dbus-1 dbus-glib-1') |
97 env.ProtocolBuffer('update_metadata.pb.cc', 'update_metadata.proto') | 142 env.ProtocolBuffer('update_metadata.pb.cc', 'update_metadata.proto') |
98 | 143 |
| 144 env.DbusBindings('update_engine.dbusclient.h', 'update_engine.xml') |
| 145 |
99 if ARGUMENTS.get('debug', 0): | 146 if ARGUMENTS.get('debug', 0): |
100 env['CCFLAGS'] += ' -fprofile-arcs -ftest-coverage' | 147 env['CCFLAGS'] += ' -fprofile-arcs -ftest-coverage' |
101 env['LIBS'] += ['bz2', 'gcov'] | 148 env['LIBS'] += ['bz2', 'gcov'] |
102 | 149 |
103 | |
104 | |
105 sources = Split("""action_processor.cc | 150 sources = Split("""action_processor.cc |
106 bzip.cc | 151 bzip.cc |
107 bzip_extent_writer.cc | 152 bzip_extent_writer.cc |
108 cycle_breaker.cc | 153 cycle_breaker.cc |
| 154 dbus_service.cc |
109 decompressing_file_writer.cc | 155 decompressing_file_writer.cc |
110 delta_diff_generator.cc | 156 delta_diff_generator.cc |
111 delta_performer.cc | 157 delta_performer.cc |
112 download_action.cc | 158 download_action.cc |
113 extent_mapper.cc | 159 extent_mapper.cc |
114 extent_writer.cc | 160 extent_writer.cc |
115 filesystem_copier_action.cc | 161 filesystem_copier_action.cc |
116 filesystem_iterator.cc | 162 filesystem_iterator.cc |
117 file_writer.cc | 163 file_writer.cc |
118 graph_utils.cc | 164 graph_utils.cc |
119 gzip.cc | 165 gzip.cc |
120 libcurl_http_fetcher.cc | 166 libcurl_http_fetcher.cc |
121 omaha_hash_calculator.cc | 167 omaha_hash_calculator.cc |
122 omaha_request_prep_action.cc | 168 omaha_request_prep_action.cc |
123 omaha_response_handler_action.cc | 169 omaha_response_handler_action.cc |
124 postinstall_runner_action.cc | 170 postinstall_runner_action.cc |
125 set_bootable_flag_action.cc | 171 set_bootable_flag_action.cc |
126 subprocess.cc | 172 subprocess.cc |
127 tarjan.cc | 173 tarjan.cc |
128 topological_sort.cc | 174 topological_sort.cc |
| 175 update_attempter.cc |
129 update_check_action.cc | 176 update_check_action.cc |
130 update_metadata.pb.cc | 177 update_metadata.pb.cc |
131 utils.cc""") | 178 utils.cc""") |
132 main = ['main.cc'] | 179 main = ['main.cc'] |
133 | 180 |
134 unittest_sources = Split("""action_unittest.cc | 181 unittest_sources = Split("""action_unittest.cc |
135 action_pipe_unittest.cc | 182 action_pipe_unittest.cc |
136 action_processor_unittest.cc | 183 action_processor_unittest.cc |
137 bzip_extent_writer_unittest.cc | 184 bzip_extent_writer_unittest.cc |
138 cycle_breaker_unittest.cc | 185 cycle_breaker_unittest.cc |
(...skipping 15 matching lines...) Expand all Loading... |
154 set_bootable_flag_action_unittest.cc | 201 set_bootable_flag_action_unittest.cc |
155 subprocess_unittest.cc | 202 subprocess_unittest.cc |
156 tarjan_unittest.cc | 203 tarjan_unittest.cc |
157 test_utils.cc | 204 test_utils.cc |
158 topological_sort_unittest.cc | 205 topological_sort_unittest.cc |
159 update_check_action_unittest.cc | 206 update_check_action_unittest.cc |
160 utils_unittest.cc | 207 utils_unittest.cc |
161 zip_unittest.cc""") | 208 zip_unittest.cc""") |
162 unittest_main = ['testrunner.cc'] | 209 unittest_main = ['testrunner.cc'] |
163 | 210 |
| 211 client_main = ['update_engine_client.cc'] |
| 212 |
164 delta_generator_main = ['generate_delta_main.cc'] | 213 delta_generator_main = ['generate_delta_main.cc'] |
165 | 214 |
166 env.Program('update_engine', sources + main) | 215 env.Program('update_engine', sources + main) |
167 unittest_cmd = env.Program('update_engine_unittests', | 216 unittest_cmd = env.Program('update_engine_unittests', |
168 sources + unittest_sources + unittest_main) | 217 sources + unittest_sources + unittest_main) |
169 | 218 |
| 219 client_cmd = env.Program('update_engine_client', sources + client_main); |
| 220 |
170 Clean(unittest_cmd, Glob('*.gcda') + Glob('*.gcno') + Glob('*.gcov') + | 221 Clean(unittest_cmd, Glob('*.gcda') + Glob('*.gcno') + Glob('*.gcov') + |
171 Split('html app.info')) | 222 Split('html app.info')) |
172 | 223 |
173 delta_generator_cmd = env.Program('delta_generator', | 224 delta_generator_cmd = env.Program('delta_generator', |
174 sources + delta_generator_main) | 225 sources + delta_generator_main) |
175 | 226 |
176 http_server_cmd = env.Program('test_http_server', 'test_http_server.cc') | 227 http_server_cmd = env.Program('test_http_server', 'test_http_server.cc') |
OLD | NEW |