Revert of Refactor the avatar button/icon class (patchset #14 id:320001 of https...
[chromium-blink-merge.git] / crypto / crypto.gyp
blobe6bff0b098b75bb225bbf5972dde514f292b41d3
1 # Copyright (c) 2012 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.
6   'variables': {
7     'chromium_code': 1,
8   },
9   'includes': [
10     'crypto.gypi',
11   ],
12   'targets': [
13     {
14       'target_name': 'crypto',
15       'type': '<(component)',
16       'product_name': 'crcrypto',  # Avoid colliding with OpenSSL's libcrypto
17       'dependencies': [
18         '../base/base.gyp:base',
19         '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
20       ],
21       'defines': [
22         'CRYPTO_IMPLEMENTATION',
23       ],
24       'conditions': [
25         [ 'os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android"', {
26           'dependencies': [
27             '../build/linux/system.gyp:ssl',
28           ],
29           'export_dependent_settings': [
30             '../build/linux/system.gyp:ssl',
31           ],
32           'conditions': [
33             [ 'chromeos==1', {
34                 'sources/': [ ['include', '_chromeos\\.cc$'] ]
35               },
36             ],
37           ],
38         }, {  # os_posix != 1 or OS == "mac" or OS == "ios" or OS == "android"
39             'sources!': [
40               'hmac_win.cc',
41               'symmetric_key_win.cc',
42             ],
43         }],
44         [ 'OS != "mac" and OS != "ios"', {
45           'sources!': [
46             'apple_keychain.h',
47             'mock_apple_keychain.cc',
48             'mock_apple_keychain.h',
49           ],
50         }],
51         [ 'OS == "android"', {
52           'dependencies': [
53             '../build/android/ndk.gyp:cpu_features',
54           ],
55         }],
56         [ 'os_bsd==1', {
57           'link_settings': {
58             'libraries': [
59               '-L/usr/local/lib -lexecinfo',
60               ],
61             },
62           },
63         ],
64         [ 'OS == "mac"', {
65           'link_settings': {
66             'libraries': [
67               '$(SDKROOT)/System/Library/Frameworks/Security.framework',
68             ],
69           },
70         }, {  # OS != "mac"
71           'sources!': [
72             'cssm_init.cc',
73             'cssm_init.h',
74             'mac_security_services_lock.cc',
75             'mac_security_services_lock.h',
76           ],
77         }],
78         [ 'use_openssl == 0 and (OS == "mac" or OS == "ios" or OS == "win")', {
79           'dependencies': [
80             '../third_party/nss/nss.gyp:nspr',
81             '../third_party/nss/nss.gyp:nss',
82           ],
83           'export_dependent_settings': [
84             '../third_party/nss/nss.gyp:nspr',
85             '../third_party/nss/nss.gyp:nss',
86           ],
87         }],
88         [ 'OS != "win"', {
89           'sources!': [
90             'capi_util.h',
91             'capi_util.cc',
92           ],
93         }],
94         [ 'OS == "win"', {
95           'msvs_disabled_warnings': [
96             4267,  # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
97             4018,
98           ],
99         }],
100         [ 'use_openssl==1', {
101             'dependencies': [
102               '../third_party/boringssl/boringssl.gyp:boringssl',
103             ],
104             # TODO(joth): Use a glob to match exclude patterns once the
105             #             OpenSSL file set is complete.
106             'sources!': [
107               'ec_private_key_nss.cc',
108               'ec_signature_creator_nss.cc',
109               'encryptor_nss.cc',
110               'hmac_nss.cc',
111               'rsa_private_key_nss.cc',
112               'secure_hash_default.cc',
113               'signature_creator_nss.cc',
114               'signature_verifier_nss.cc',
115               'symmetric_key_nss.cc',
116               'third_party/nss/chromium-blapi.h',
117               'third_party/nss/chromium-blapit.h',
118               'third_party/nss/chromium-nss.h',
119               'third_party/nss/chromium-prtypes.h',
120               'third_party/nss/chromium-sha256.h',
121               'third_party/nss/pk11akey.cc',
122               'third_party/nss/rsawrapr.c',
123               'third_party/nss/secsign.cc',
124               'third_party/nss/sha512.cc',
125             ],
126           }, {
127             'sources!': [
128               'aead_openssl.cc',
129               'aead_openssl.h',
130               'ec_private_key_openssl.cc',
131               'ec_signature_creator_openssl.cc',
132               'encryptor_openssl.cc',
133               'hmac_openssl.cc',
134               'openssl_bio_string.cc',
135               'openssl_bio_string.h',
136               'openssl_util.cc',
137               'openssl_util.h',
138               'rsa_private_key_openssl.cc',
139               'secure_hash_openssl.cc',
140               'signature_creator_openssl.cc',
141               'signature_verifier_openssl.cc',
142               'symmetric_key_openssl.cc',
143             ],
144         },],
145         [ 'use_openssl==1 and use_nss_certs==0', {
146             # Some files are built when NSS is used at all, either for the
147             # internal crypto library or the platform certificate library.
148             'sources!': [
149               'nss_key_util.cc',
150               'nss_key_util.h',
151               'nss_util.cc',
152               'nss_util.h',
153               'nss_util_internal.h',
154             ],
155         },],
156       ],
157       'sources': [
158         '<@(crypto_sources)',
159       ],
160     },
161     {
162       'target_name': 'crypto_unittests',
163       'type': 'executable',
164       'sources': [
165         'aead_openssl_unittest.cc',
166         'curve25519_unittest.cc',
167         'ec_private_key_unittest.cc',
168         'ec_signature_creator_unittest.cc',
169         'encryptor_unittest.cc',
170         'ghash_unittest.cc',
171         'hkdf_unittest.cc',
172         'hmac_unittest.cc',
173         'nss_key_util_unittest.cc',
174         'nss_util_unittest.cc',
175         'openssl_bio_string_unittest.cc',
176         'p224_unittest.cc',
177         'p224_spake_unittest.cc',
178         'random_unittest.cc',
179         'rsa_private_key_unittest.cc',
180         'secure_hash_unittest.cc',
181         'sha2_unittest.cc',
182         'signature_creator_unittest.cc',
183         'signature_verifier_unittest.cc',
184         'symmetric_key_unittest.cc',
185       ],
186       'dependencies': [
187         'crypto',
188         'crypto_test_support',
189         '../base/base.gyp:base',
190         '../base/base.gyp:run_all_unittests',
191         '../base/base.gyp:test_support_base',
192         '../testing/gmock.gyp:gmock',
193         '../testing/gtest.gyp:gtest',
194       ],
195       'conditions': [
196         [ 'use_nss_certs == 1', {
197           'conditions': [
198             [ 'use_allocator!="none"', {
199                 'dependencies': [
200                   '../base/allocator/allocator.gyp:allocator',
201                 ],
202               },
203             ],
204           ],
205           'dependencies': [
206             '../build/linux/system.gyp:ssl',
207           ],
208         }],
209         [ 'use_openssl == 1 and use_nss_certs == 0', {
210           # Some files are built when NSS is used at all, either for the
211           # internal crypto library or the platform certificate library.
212           'sources!': [
213             'nss_key_util_unittest.cc',
214             'nss_util_unittest.cc',
215           ],
216         }],
217         [ 'use_openssl == 0 and (OS == "mac" or OS == "ios" or OS == "win")', {
218           'dependencies': [
219             '../third_party/nss/nss.gyp:nspr',
220           ],
221         }],
222         [ 'OS == "win"', {
223           # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
224           'msvs_disabled_warnings': [4267, ],
225         }],
226         [ 'use_openssl==1', {
227           'dependencies': [
228             '../third_party/boringssl/boringssl.gyp:boringssl',
229           ],
230         }, {
231           'sources!': [
232             'openssl_bio_string_unittest.cc',
233           ],
234         }],
235       ],
236     },
237   ],
238   'conditions': [
239     ['OS == "win" and target_arch=="ia32"', {
240       'targets': [
241         {
242           'target_name': 'crypto_nacl_win64',
243           # We do not want nacl_helper to depend on NSS because this would
244           # require including a 64-bit copy of NSS. Thus, use the native APIs
245           # for the helper.
246           'type': '<(component)',
247           'dependencies': [
248             '../base/base.gyp:base_win64',
249             '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations_win64',
250           ],
251           'sources': [
252             '<@(nacl_win64_sources)',
253           ],
254           'defines': [
255            'CRYPTO_IMPLEMENTATION',
256            '<@(nacl_win64_defines)',
257           ],
258           'msvs_disabled_warnings': [
259             4018,
260           ],
261           'configurations': {
262             'Common_Base': {
263               'msvs_target_platform': 'x64',
264             },
265           },
266         },
267       ],
268     }],
269     ['use_nss_certs==1', {
270       'targets': [
271         {
272           'target_name': 'crypto_test_support',
273           'type': 'static_library',
274           'dependencies': [
275             '../base/base.gyp:base',
276             'crypto',
277           ],
278           'sources': [
279             'scoped_test_nss_db.cc',
280             'scoped_test_nss_db.h',
281             'scoped_test_nss_chromeos_user.cc',
282             'scoped_test_nss_chromeos_user.h',
283             'scoped_test_system_nss_key_slot.cc',
284             'scoped_test_system_nss_key_slot.h',
285           ],
286           'conditions': [
287             ['use_nss_certs==0', {
288               'sources!': [
289                 'scoped_test_nss_db.cc',
290                 'scoped_test_nss_db.h',
291               ],
292             }],
293             [ 'chromeos==0', {
294               'sources!': [
295                 'scoped_test_nss_chromeos_user.cc',
296                 'scoped_test_nss_chromeos_user.h',
297                 'scoped_test_system_nss_key_slot.cc',
298                 'scoped_test_system_nss_key_slot.h',
299               ],
300             }],
301           ],
302         }
303       ]}, {  # use_nss_certs==0
304       'targets': [
305         {
306           'target_name': 'crypto_test_support',
307           'type': 'none',
308           'sources': [],
309         }
310     ]}],
311     ['test_isolation_mode != "noop"', {
312       'targets': [
313         {
314           'target_name': 'crypto_unittests_run',
315           'type': 'none',
316           'dependencies': [
317             'crypto_unittests',
318           ],
319           'includes': [
320             '../build/isolate.gypi',
321                       ],
322           'sources': [
323             'crypto_unittests.isolate',
324           ],
325         },
326       ],
327     }],
328   ],