1{
2  'target_defaults': {
3    'variables': {
4      'deps': [
5        'libchrome-<(libbase_ver)'
6      ],
7      'USE_dbus%': '1',
8    },
9    'include_dirs': [
10      '../libbrillo',
11    ],
12    'defines': [
13      'USE_DBUS=<(USE_dbus)',
14      'USE_RTTI_FOR_TYPE_TAGS',
15    ],
16  },
17  'targets': [
18    {
19      'target_name': 'libbrillo-<(libbase_ver)',
20      'type': 'none',
21      'dependencies': [
22        'libbrillo-core-<(libbase_ver)',
23        'libbrillo-cryptohome-<(libbase_ver)',
24        'libbrillo-http-<(libbase_ver)',
25        'libbrillo-minijail-<(libbase_ver)',
26        'libbrillo-streams-<(libbase_ver)',
27        'libpolicy-<(libbase_ver)',
28      ],
29      'direct_dependent_settings': {
30        'include_dirs': [
31          '../libbrillo',
32        ],
33      },
34      'includes': ['../common-mk/deps.gypi'],
35    },
36    {
37      'target_name': 'libbrillo-core-<(libbase_ver)',
38      'type': 'shared_library',
39      'variables': {
40        'exported_deps': [
41          'dbus-1',
42        ],
43        'deps': ['<@(exported_deps)'],
44      },
45      'all_dependent_settings': {
46        'variables': {
47          'deps': [
48            '<@(exported_deps)',
49          ],
50        },
51      },
52      'libraries': ['-lmodp_b64'],
53      #TODO(deymo): Split DBus code from libbrillo-core the same way is split in
54      # the Android.mk, based on the <(USE_dbus) variable.
55      'sources': [
56        'brillo/any.cc',
57        'brillo/asynchronous_signal_handler.cc',
58        'brillo/backoff_entry.cc',
59        'brillo/daemons/dbus_daemon.cc',
60        'brillo/daemons/daemon.cc',
61        'brillo/data_encoding.cc',
62        'brillo/dbus/async_event_sequencer.cc',
63        'brillo/dbus/data_serialization.cc',
64        'brillo/dbus/dbus_connection.cc',
65        'brillo/dbus/dbus_method_invoker.cc',
66        'brillo/dbus/dbus_method_response.cc',
67        'brillo/dbus/dbus_object.cc',
68        'brillo/dbus/dbus_service_watcher.cc',
69        'brillo/dbus/dbus_signal.cc',
70        'brillo/dbus/exported_object_manager.cc',
71        'brillo/dbus/exported_property_set.cc',
72        'brillo/dbus/utils.cc',
73        'brillo/errors/error.cc',
74        'brillo/errors/error_codes.cc',
75        'brillo/file_utils.cc',
76        'brillo/flag_helper.cc',
77        'brillo/key_value_store.cc',
78        'brillo/message_loops/base_message_loop.cc',
79        'brillo/message_loops/message_loop.cc',
80        'brillo/message_loops/message_loop_utils.cc',
81        'brillo/mime_utils.cc',
82        'brillo/osrelease_reader.cc',
83        'brillo/process.cc',
84        'brillo/process_reaper.cc',
85        'brillo/process_information.cc',
86        'brillo/secure_blob.cc',
87        'brillo/strings/string_utils.cc',
88        'brillo/syslog_logging.cc',
89        'brillo/type_name_undecorate.cc',
90        'brillo/url_utils.cc',
91        'brillo/userdb_utils.cc',
92        'brillo/value_conversion.cc',
93      ],
94    },
95    {
96      'target_name': 'libbrillo-http-<(libbase_ver)',
97      'type': 'shared_library',
98      'dependencies': [
99        'libbrillo-core-<(libbase_ver)',
100        'libbrillo-streams-<(libbase_ver)',
101      ],
102      'variables': {
103        'exported_deps': [
104          'libcurl',
105        ],
106        'deps': ['<@(exported_deps)'],
107      },
108      'all_dependent_settings': {
109        'variables': {
110          'deps': [
111            '<@(exported_deps)',
112          ],
113        },
114      },
115      'sources': [
116        'brillo/http/curl_api.cc',
117        'brillo/http/http_connection_curl.cc',
118        'brillo/http/http_form_data.cc',
119        'brillo/http/http_request.cc',
120        'brillo/http/http_transport.cc',
121        'brillo/http/http_transport_curl.cc',
122        'brillo/http/http_utils.cc',
123      ],
124    },
125    {
126      'target_name': 'libbrillo-streams-<(libbase_ver)',
127      'type': 'shared_library',
128      'dependencies': [
129        'libbrillo-core-<(libbase_ver)',
130      ],
131      'variables': {
132        'exported_deps': [
133          'openssl',
134        ],
135        'deps': ['<@(exported_deps)'],
136      },
137      'all_dependent_settings': {
138        'variables': {
139          'deps': [
140            '<@(exported_deps)',
141          ],
142        },
143      },
144      'sources': [
145        'brillo/streams/file_stream.cc',
146        'brillo/streams/input_stream_set.cc',
147        'brillo/streams/memory_containers.cc',
148        'brillo/streams/memory_stream.cc',
149        'brillo/streams/openssl_stream_bio.cc',
150        'brillo/streams/stream.cc',
151        'brillo/streams/stream_errors.cc',
152        'brillo/streams/stream_utils.cc',
153        'brillo/streams/tls_stream.cc',
154      ],
155    },
156    {
157      'target_name': 'libbrillo-test-<(libbase_ver)',
158      'type': 'static_library',
159      'standalone_static_library': 1,
160      'dependencies': [
161        'libbrillo-http-<(libbase_ver)',
162      ],
163      'sources': [
164        'brillo/http/http_connection_fake.cc',
165        'brillo/http/http_transport_fake.cc',
166        'brillo/message_loops/fake_message_loop.cc',
167        'brillo/streams/fake_stream.cc',
168      ],
169      'includes': ['../common-mk/deps.gypi'],
170    },
171    {
172      'target_name': 'libbrillo-cryptohome-<(libbase_ver)',
173      'type': 'shared_library',
174      'variables': {
175        'exported_deps': [
176          'openssl',
177        ],
178        'deps': ['<@(exported_deps)'],
179      },
180      'all_dependent_settings': {
181        'variables': {
182          'deps': [
183            '<@(exported_deps)',
184          ],
185        },
186      },
187      'sources': [
188        'brillo/cryptohome.cc',
189      ],
190    },
191    {
192      'target_name': 'libbrillo-minijail-<(libbase_ver)',
193      'type': 'shared_library',
194      'variables': {
195        'exported_deps': [
196          'libminijail',
197        ],
198        'deps': ['<@(exported_deps)'],
199      },
200      'all_dependent_settings': {
201        'variables': {
202          'deps': [
203            '<@(exported_deps)',
204          ],
205        },
206      },
207      'cflags': [
208        '-fvisibility=default',
209      ],
210      'sources': [
211        'brillo/minijail/minijail.cc',
212      ],
213    },
214    {
215      'target_name': 'libpolicy-<(libbase_ver)',
216      'type': 'shared_library',
217      'dependencies': [
218        'libpolicy-includes',
219        '../common-mk/external_dependencies.gyp:policy-protos',
220      ],
221      'variables': {
222        'exported_deps': [
223          'openssl',
224          'protobuf-lite',
225        ],
226        'deps': ['<@(exported_deps)'],
227      },
228      'all_dependent_settings': {
229        'variables': {
230          'deps': [
231            '<@(exported_deps)',
232          ],
233        },
234      },
235      'ldflags': [
236        '-Wl,--version-script,<(platform2_root)/libbrillo/libpolicy.ver',
237      ],
238      'sources': [
239        'policy/device_policy.cc',
240        'policy/device_policy_impl.cc',
241        'policy/libpolicy.cc',
242      ],
243    },
244    {
245      'target_name': 'libbrillo-glib-<(libbase_ver)',
246      'type': 'shared_library',
247      'dependencies': [
248          'libbrillo-<(libbase_ver)',
249      ],
250      'variables': {
251        'exported_deps': [
252          'dbus-1',
253          'dbus-glib-1',
254          'glib-2.0',
255          'gobject-2.0',
256        ],
257        'deps': ['<@(exported_deps)'],
258      },
259      'cflags': [
260        # glib uses the deprecated "register" attribute in some header files.
261        '-Wno-deprecated-register',
262      ],
263      'all_dependent_settings': {
264        'variables': {
265          'deps': [
266            '<@(exported_deps)',
267          ],
268        },
269      },
270      'sources': [
271        'brillo/glib/abstract_dbus_service.cc',
272        'brillo/glib/dbus.cc',
273        'brillo/message_loops/glib_message_loop.cc',
274      ],
275      'includes': ['../common-mk/deps.gypi'],
276    },
277  ],
278  'conditions': [
279    ['USE_test == 1', {
280      'targets': [
281        {
282          'target_name': 'libbrillo-<(libbase_ver)_unittests',
283          'type': 'executable',
284          'dependencies': [
285            'libbrillo-<(libbase_ver)',
286            'libbrillo-test-<(libbase_ver)',
287            'libbrillo-glib-<(libbase_ver)',
288          ],
289          'variables': {
290            'deps': [
291              'libchrome-test-<(libbase_ver)',
292            ],
293            'proto_in_dir': 'brillo/dbus',
294            'proto_out_dir': 'include/brillo/dbus',
295          },
296          'includes': [
297            '../common-mk/common_test.gypi',
298            '../common-mk/protoc.gypi',
299          ],
300          'cflags': [
301            '-Wno-format-zero-length',
302          ],
303          'conditions': [
304            ['debug == 1', {
305              'cflags': [
306                '-fprofile-arcs',
307                '-ftest-coverage',
308                '-fno-inline',
309              ],
310              'libraries': [
311                '-lgcov',
312              ],
313            }],
314          ],
315          'sources': [
316            'brillo/any_unittest.cc',
317            'brillo/any_internal_impl_unittest.cc',
318            'brillo/asynchronous_signal_handler_unittest.cc',
319            'brillo/backoff_entry_unittest.cc',
320            'brillo/data_encoding_unittest.cc',
321            'brillo/dbus/async_event_sequencer_unittest.cc',
322            'brillo/dbus/data_serialization_unittest.cc',
323            'brillo/dbus/dbus_method_invoker_unittest.cc',
324            'brillo/dbus/dbus_object_unittest.cc',
325            'brillo/dbus/dbus_param_reader_unittest.cc',
326            'brillo/dbus/dbus_param_writer_unittest.cc',
327            'brillo/dbus/dbus_signal_handler_unittest.cc',
328            'brillo/dbus/exported_object_manager_unittest.cc',
329            'brillo/dbus/exported_property_set_unittest.cc',
330            'brillo/errors/error_codes_unittest.cc',
331            'brillo/errors/error_unittest.cc',
332            'brillo/file_utils_unittest.cc',
333            'brillo/flag_helper_unittest.cc',
334            'brillo/glib/object_unittest.cc',
335            'brillo/http/http_connection_curl_unittest.cc',
336            'brillo/http/http_form_data_unittest.cc',
337            'brillo/http/http_request_unittest.cc',
338            'brillo/http/http_transport_curl_unittest.cc',
339            'brillo/http/http_utils_unittest.cc',
340            'brillo/key_value_store_unittest.cc',
341            'brillo/map_utils_unittest.cc',
342            'brillo/message_loops/base_message_loop_unittest.cc',
343            'brillo/message_loops/fake_message_loop_unittest.cc',
344            'brillo/message_loops/glib_message_loop_unittest.cc',
345            'brillo/message_loops/message_loop_unittest.cc',
346            'brillo/mime_utils_unittest.cc',
347            'brillo/osrelease_reader_unittest.cc',
348            'brillo/process_reaper_unittest.cc',
349            'brillo/process_unittest.cc',
350            'brillo/secure_blob_unittest.cc',
351            'brillo/streams/fake_stream_unittest.cc',
352            'brillo/streams/file_stream_unittest.cc',
353            'brillo/streams/input_stream_set_unittest.cc',
354            'brillo/streams/memory_containers_unittest.cc',
355            'brillo/streams/memory_stream_unittest.cc',
356            'brillo/streams/openssl_stream_bio_unittests.cc',
357            'brillo/streams/stream_unittest.cc',
358            'brillo/streams/stream_utils_unittest.cc',
359            'brillo/strings/string_utils_unittest.cc',
360            'brillo/type_name_undecorate_unittest.cc',
361            'brillo/unittest_utils.cc',
362            'brillo/url_utils_unittest.cc',
363            'brillo/variant_dictionary_unittest.cc',
364            'brillo/value_conversion_unittest.cc',
365            'testrunner.cc',
366            '<(proto_in_dir)/test.proto',
367          ]
368        },
369        {
370          'target_name': 'libpolicy-<(libbase_ver)_unittests',
371          'type': 'executable',
372          'dependencies': ['libpolicy-<(libbase_ver)'],
373          'includes': ['../common-mk/common_test.gypi'],
374          'sources': [
375            'policy/tests/libpolicy_unittest.cc',
376          ]
377        },
378      ],
379    }],
380  ],
381}
382