blob: 64406e49290e4c9895d7023c124cdfae01352129 [file] [log] [blame]
rspangler@google.com49fdf182009-10-10 00:57:34 +00001# 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
3# found in the LICENSE file.
4
adlr@google.comc98a7ed2009-12-04 18:54:03 +00005# Protobuffer compilation
6""" Inputs:
7 target: list of targets to compile to
8 source: list of sources to compile
9 env: the scons environment in which we are compiling
10 Outputs:
11 target: the list of targets we'll emit
12 source: the list of sources we'll compile"""
13def ProtocolBufferEmitter(target, source, env):
14 output = str(source[0])
15 output = output[0:output.rfind('.proto')]
16 target = [
17 output + '.pb.cc',
18 output + '.pb.h',
19 ]
20 return target, source
21
22""" Inputs:
23 source: list of sources to process
24 target: list of targets to generate
25 env: scons environment in which we are working
26 for_signature: unused
27 Outputs: a list of commands to execute to generate the targets from
28 the sources."""
29def ProtocolBufferGenerator(source, target, env, for_signature):
30 commands = [
31 '/usr/bin/protoc '
32 ' --proto_path . ${SOURCES} --cpp_out .']
33 return commands
34
35proto_builder = Builder(generator = ProtocolBufferGenerator,
36 emitter = ProtocolBufferEmitter,
37 single_source = 1,
38 suffix = '.pb.cc')
39
rspangler@google.com49fdf182009-10-10 00:57:34 +000040env = Environment()
adlr@google.comc98a7ed2009-12-04 18:54:03 +000041env['CCFLAGS'] = ' '.join("""-g
42 -fno-exceptions
43 -Wall
44 -Werror
45 -Wclobbered
46 -Wempty-body
47 -Wignored-qualifiers
48 -Wmissing-field-initializers
49 -Wsign-compare
50 -Wtype-limits
51 -Wuninitialized
52 -D_FILE_OFFSET_BITS=64
53 -I/usr/include/libxml2""".split());
54
55env['LIBS'] = Split("""base
56 curl
57 gflags
58 glib-2.0
59 gtest
60 gthread-2.0
61 libpcrecpp
62 protobuf
63 pthread
64 ssl
65 xml2
66 z""")
67env['CPPPATH'] = ['..', '../../third_party/chrome/files', '../../common']
68env['LIBPATH'] = ['../../third_party/chrome']
69env['BUILDERS']['ProtocolBuffer'] = proto_builder
rspangler@google.com49fdf182009-10-10 00:57:34 +000070env.ParseConfig('pkg-config --cflags --libs glib-2.0')
adlr@google.comc98a7ed2009-12-04 18:54:03 +000071env.ProtocolBuffer('update_metadata.pb.cc', 'update_metadata.proto')
rspangler@google.com49fdf182009-10-10 00:57:34 +000072
73if ARGUMENTS.get('debug', 0):
74 env['CCFLAGS'] += ' -fprofile-arcs -ftest-coverage'
75 env['LIBS'] += ['gcov']
76
adlr@google.comc98a7ed2009-12-04 18:54:03 +000077
78
rspangler@google.com49fdf182009-10-10 00:57:34 +000079sources = Split("""action_processor.cc
80 decompressing_file_writer.cc
adlr@google.comc98a7ed2009-12-04 18:54:03 +000081 delta_diff_parser.cc
rspangler@google.com49fdf182009-10-10 00:57:34 +000082 download_action.cc
adlr@google.comc98a7ed2009-12-04 18:54:03 +000083 filesystem_copier_action.cc
84 filesystem_iterator.cc
85 file_writer.cc
86 gzip.cc
87 install_action.cc
rspangler@google.com49fdf182009-10-10 00:57:34 +000088 libcurl_http_fetcher.cc
89 omaha_hash_calculator.cc
adlr@google.comc98a7ed2009-12-04 18:54:03 +000090 omaha_request_prep_action.cc
91 omaha_response_handler_action.cc
92 postinstall_runner_action.cc
93 set_bootable_flag_action.cc
94 subprocess.cc
95 update_check_action.cc
96 update_metadata.pb.cc
97 utils.cc""")
rspangler@google.com49fdf182009-10-10 00:57:34 +000098main = ['main.cc']
99
100unittest_sources = Split("""action_unittest.cc
101 action_pipe_unittest.cc
102 action_processor_unittest.cc
103 decompressing_file_writer_unittest.cc
adlr@google.comc98a7ed2009-12-04 18:54:03 +0000104 delta_diff_generator_unittest.cc
rspangler@google.com49fdf182009-10-10 00:57:34 +0000105 download_action_unittest.cc
106 file_writer_unittest.cc
adlr@google.comc98a7ed2009-12-04 18:54:03 +0000107 filesystem_copier_action_unittest.cc
108 filesystem_iterator_unittest.cc
109 gzip_unittest.cc
rspangler@google.com49fdf182009-10-10 00:57:34 +0000110 http_fetcher_unittest.cc
adlr@google.comc98a7ed2009-12-04 18:54:03 +0000111 install_action_unittest.cc
112 integration_unittest.cc
rspangler@google.com49fdf182009-10-10 00:57:34 +0000113 mock_http_fetcher.cc
114 omaha_hash_calculator_unittest.cc
adlr@google.comc98a7ed2009-12-04 18:54:03 +0000115 omaha_request_prep_action_unittest.cc
116 omaha_response_handler_action_unittest.cc
117 postinstall_runner_action_unittest.cc
118 set_bootable_flag_action_unittest.cc
119 subprocess_unittest.cc
rspangler@google.com49fdf182009-10-10 00:57:34 +0000120 test_utils.cc
adlr@google.comc98a7ed2009-12-04 18:54:03 +0000121 update_check_action_unittest.cc
122 utils_unittest.cc""")
rspangler@google.com49fdf182009-10-10 00:57:34 +0000123unittest_main = ['testrunner.cc']
124
adlr@google.comc98a7ed2009-12-04 18:54:03 +0000125delta_generator_sources = Split("""delta_diff_generator.cc""")
126
rspangler@google.com49fdf182009-10-10 00:57:34 +0000127env.Program('update_engine', sources + main)
128unittest_cmd = env.Program('update_engine_unittests',
adlr@google.comc98a7ed2009-12-04 18:54:03 +0000129 sources + delta_generator_sources +
130 unittest_sources + unittest_main)
rspangler@google.com49fdf182009-10-10 00:57:34 +0000131
132Clean(unittest_cmd, Glob('*.gcda') + Glob('*.gcno') + Glob('*.gcov') +
133 Split('html app.info'))
adlr@google.comc98a7ed2009-12-04 18:54:03 +0000134
135delta_generator_cmd = env.Program('delta_generator',
136 sources + delta_generator_sources + main)
137
138http_server_cmd = env.Program('test_http_server', 'test_http_server.cc')