1{
2  'target_defaults': {
3    'variables': {
4      'deps': [
5        'libbrillo-<(libbase_ver)',
6        'libchrome-<(libbase_ver)',
7      ],
8    },
9    'include_dirs': ['.'],
10  },
11  'targets': [
12    {
13      'target_name': 'libwebserv_common',
14      'type': 'static_library',
15      'variables': {
16        # Not using dbus_service_config here deliberately in order not to
17        # get tied to some constant service name, since it will be
18        # provided by the consumer of libwebserv library.
19        'dbus_service_config': '',
20        'dbus_adaptors_out_dir': 'include/dbus_bindings',
21        'dbus_xml_extension': 'dbus-xml',
22      },
23      # This static library is used in libwebserv shared library, which means
24      # we must generate position-independent code for the files comprising
25      # this library. Since this option is disabled by default for targets
26      # other than 'shared_library', turn it on explicitly for this lib.
27      # Turn off the default -fPIE flag (which is set for static_library
28      # in ../common-mk/common.gypi) and replace it with -fPIC.
29      'cflags!': ['-fPIE'],
30      'cflags': ['-fPIC'],
31      'includes': [
32        '../common-mk/generate-dbus-adaptors.gypi'
33      ],
34      'sources': [
35        'libwebserv/dbus_protocol_handler.cc',
36        'libwebserv/dbus_server.cc',
37        'libwebserv/protocol_handler.cc',
38        'libwebserv/request.cc',
39        'libwebserv/request_handler_callback.cc',
40        'libwebserv/request_utils.cc',
41        'libwebserv/response.cc',
42        'libwebserv/server.cc',
43        'libwebserv/dbus_bindings/org.chromium.WebServer.RequestHandler.dbus-xml',
44      ],
45      'actions': [
46        {
47          'action_name': 'generate-webservd-proxies',
48          'variables': {
49            'dbus_service_config': 'webservd/dbus_bindings/dbus-service-config.json',
50            'mock_output_file': 'include/webservd/dbus-mocks.h',
51            'proxy_output_file': 'include/webservd/dbus-proxies.h',
52            'dbus_adaptors_out_dir': '',
53          },
54          'sources': [
55            'webservd/dbus_bindings/org.chromium.WebServer.ProtocolHandler.dbus-xml',
56            'webservd/dbus_bindings/org.chromium.WebServer.Server.dbus-xml',
57          ],
58          'includes': ['../common-mk/generate-dbus-proxies.gypi'],
59        },
60        {
61          'action_name': 'generate-permission_broker-proxies',
62          'variables': {
63            'dbus_service_config': '<(platform2_root)/permission_broker/dbus_bindings/dbus-service-config.json',
64            'mock_output_file': 'include/permission_broker/dbus-mocks.h',
65            'proxy_output_file': 'include/permission_broker/dbus-proxies.h',
66            'dbus_adaptors_out_dir': '',
67          },
68          'sources': [
69            '<(platform2_root)/permission_broker/dbus_bindings/org.chromium.PermissionBroker.xml',
70          ],
71          'includes': ['../common-mk/generate-dbus-proxies.gypi'],
72        },
73      ],
74    },
75    {
76      'target_name': 'webservd_common',
77      'type': 'static_library',
78      'variables': {
79        'exported_deps': [
80          'libmicrohttpd',
81          'openssl',
82        ],
83        'deps': ['<@(exported_deps)'],
84        'dbus_adaptors_out_dir': 'include/dbus_bindings',
85        'dbus_service_config': 'webservd/dbus_bindings/dbus-service-config.json',
86        'dbus_xml_extension': 'dbus-xml',
87      },
88      'all_dependent_settings': {
89        'variables': {
90          'deps': [
91            '<@(exported_deps)',
92          ],
93        },
94      },
95      'sources': [
96        'webservd/config.cc',
97        'webservd/dbus_bindings/org.chromium.WebServer.ProtocolHandler.dbus-xml',
98        'webservd/dbus_bindings/org.chromium.WebServer.Server.dbus-xml',
99        'webservd/dbus_protocol_handler.cc',
100        'webservd/dbus_request_handler.cc',
101        'webservd/error_codes.cc',
102        'webservd/fake_encryptor.cc',
103        'webservd/log_manager.cc',
104        'webservd/permission_broker_firewall.cc',
105        'webservd/protocol_handler.cc',
106        'webservd/request.cc',
107        'webservd/server.cc',
108        'webservd/temp_file_manager.cc',
109        'webservd/utils.cc',
110      ],
111      'includes': ['../common-mk/generate-dbus-adaptors.gypi'],
112      'actions': [
113        {
114          'action_name': 'generate-libwebserv-proxies',
115          'variables': {
116            # Not using dbus_service_config here deliberately in order not to
117            # get tied to some constant service name, since it will be
118            # provided by the consumer of libwebserv library.
119            'dbus_service_config': '',
120            'mock_output_file': 'include/libwebserv/dbus-mocks.h',
121            'proxy_output_file': 'include/libwebserv/dbus-proxies.h',
122          },
123          'sources': [
124            'libwebserv/dbus_bindings/org.chromium.WebServer.RequestHandler.dbus-xml',
125          ],
126          'includes': ['../common-mk/generate-dbus-proxies.gypi'],
127        },
128      ],
129    },
130    {
131      'target_name': 'libwebserv-<(libbase_ver)',
132      'type': 'shared_library',
133      'includes': [
134        '../common-mk/deps.gypi',
135      ],
136      'dependencies': [
137        'libwebserv_common',
138      ],
139      'sources': [
140        'libwebserv/_empty.cc',
141      ],
142    },
143    {
144      'target_name': 'webservd',
145      'type': 'executable',
146      'dependencies': [
147        'webservd_common',
148      ],
149      'variables': {
150        'deps': [
151          'libminijail',
152        ],
153      },
154      'sources': [
155        'webservd/main.cc',
156      ],
157    },
158  ],
159  'conditions': [
160    ['USE_test == 1', {
161      'targets': [
162        {
163          'target_name': 'libwebserv_testrunner',
164          'type': 'executable',
165          'dependencies': [
166            'libwebserv_common',
167          ],
168          'includes': ['../common-mk/common_test.gypi'],
169          'sources': [
170            'libwebserv/libwebserv_testrunner.cc',
171          ],
172        },
173        {
174          'target_name': 'webservd_testrunner',
175          'type': 'executable',
176          'dependencies': [
177            'webservd_common',
178          ],
179          'includes': ['../common-mk/common_test.gypi'],
180          'sources': [
181            'webservd/config_unittest.cc',
182            'webservd/log_manager_unittest.cc',
183            'webservd/webservd_testrunner.cc',
184          ],
185        },
186      ],
187    }],
188  ],
189}
190