Make chrome compile with the win8 sdk
[chromium-blink-merge.git] / crypto / crypto.gyp
blob287b53cfb65d6b555f24c1585ead87412eccaa4a
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     # Put all transitive dependencies for Windows HMAC here.
9     # This is required so that we can build them for nacl win64.
10     'hmac_win64_related_sources': [
11       'hmac.cc',
12       'hmac.h',
13       'hmac_win.cc',
14       'secure_util.cc',
15       'secure_util.h',
16       'symmetric_key.h',
17       'symmetric_key_win.cc',
18       'third_party/nss/chromium-sha256.h',
19       'third_party/nss/sha512.cc',
20     ],
21   },
22   'targets': [
23     {
24       'target_name': 'crypto',
25       'type': '<(component)',
26       'product_name': 'crcrypto',  # Avoid colliding with OpenSSL's libcrypto
27       'dependencies': [
28         '../base/base.gyp:base',
29         '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
30       ],
31       'defines': [
32         'CRYPTO_IMPLEMENTATION',
33       ],
34       'msvs_disabled_warnings': [
35         4018,
36       ],
37       'conditions': [
38         [ 'os_posix == 1 and OS != "mac" and OS != "android"', {
39           'dependencies': [
40             '../build/linux/system.gyp:ssl',
41           ],
42           'export_dependent_settings': [
43             '../build/linux/system.gyp:ssl',
44           ],
45           'conditions': [
46             [ 'chromeos==1', {
47                 'sources/': [ ['include', '_chromeos\\.cc$'] ]
48               },
49             ],
50           ],
51         }, {  # os_posix != 1 or OS == "mac" or OS == "android"
52             'sources/': [
53               ['exclude', '_nss\.cc$'],
54               ['include', 'ec_private_key_nss\.cc$'],
55               ['include', 'ec_signature_creator_nss\.cc$'],
56               ['include', 'encryptor_nss\.cc$'],
57               ['include', 'hmac_nss\.cc$'],
58               ['include', 'signature_verifier_nss\.cc$'],
59               ['include', 'symmetric_key_nss\.cc$'],
60             ],
61             'sources!': [
62               'hmac_win.cc',
63               'openpgp_symmetric_encryption.cc',
64               'openpgp_symmetric_encryption.h',
65               'symmetric_key_win.cc',
66             ],
67         }],
68         [ 'OS == "android"', {
69             'dependencies': [
70               '../third_party/openssl/openssl.gyp:openssl',
71             ],
72             'sources/': [
73               ['exclude', 'ec_private_key_nss\.cc$'],
74               ['exclude', 'ec_signature_creator_nss\.cc$'],
75               ['exclude', 'encryptor_nss\.cc$'],
76               ['exclude', 'hmac_nss\.cc$'],
77               ['exclude', 'signature_verifier_nss\.cc$'],
78               ['exclude', 'symmetric_key_nss\.cc$'],
79             ],
80         }],
81         [ 'os_bsd==1', {
82           'link_settings': {
83             'libraries': [
84               '-L/usr/local/lib -lexecinfo',
85               ],
86             },
87           },
88         ],
89         [ 'OS == "mac"', {
90           'link_settings': {
91             'libraries': [
92               '$(SDKROOT)/System/Library/Frameworks/Security.framework',
93             ],
94           },
95         }, {  # OS != "mac"
96           'sources!': [
97             'cssm_init.cc',
98             'cssm_init.h',
99             'mac_security_services_lock.cc',
100             'mac_security_services_lock.h',
101           ],
102         }],
103         [ 'OS == "mac" or OS == "win"', {
104           'dependencies': [
105             '../third_party/nss/nss.gyp:nspr',
106             '../third_party/nss/nss.gyp:nss',
107           ],
108           'export_dependent_settings': [
109             '../third_party/nss/nss.gyp:nspr',
110             '../third_party/nss/nss.gyp:nss',
111           ],
112         }],
113         [ 'OS != "win"', {
114           'sources!': [
115             'capi_util.h',
116             'capi_util.cc',
117           ],
118         }],
119         [ 'use_openssl==1', {
120             # TODO(joth): Use a glob to match exclude patterns once the
121             #             OpenSSL file set is complete.
122             'sources!': [
123               'ec_private_key_nss.cc',
124               'ec_signature_creator_nss.cc',
125               'encryptor_nss.cc',
126               'hmac_nss.cc',
127               'nss_util.cc',
128               'nss_util.h',
129               'openpgp_symmetric_encryption.cc',
130               'rsa_private_key_nss.cc',
131               'secure_hash_default.cc',
132               'signature_creator_nss.cc',
133               'signature_verifier_nss.cc',
134               'symmetric_key_nss.cc',
135               'third_party/nss/chromium-blapi.h',
136               'third_party/nss/chromium-blapit.h',
137               'third_party/nss/chromium-nss.h',
138               'third_party/nss/chromium-sha256.h',
139               'third_party/nss/pk11akey.cc',
140               'third_party/nss/secsign.cc',
141               'third_party/nss/sha512.cc',
142             ],
143           }, {
144             'sources!': [
145               'ec_private_key_openssl.cc',
146               'ec_signature_creator_openssl.cc',
147               'encryptor_openssl.cc',
148               'hmac_openssl.cc',
149               'openssl_util.cc',
150               'openssl_util.h',
151               'rsa_private_key_openssl.cc',
152               'secure_hash_openssl.cc',
153               'signature_creator_openssl.cc',
154               'signature_verifier_openssl.cc',
155               'symmetric_key_openssl.cc',
156             ],
157         },],
158       ],
159       'sources': [
160         # NOTE: all transitive dependencies of HMAC on windows need
161         #     to be placed in the source list above.
162         '<@(hmac_win64_related_sources)',
163         'capi_util.cc',
164         'capi_util.h',
165         'crypto_export.h',
166         'crypto_module_blocking_password_delegate.h',
167         'cssm_init.cc',
168         'cssm_init.h',
169         'ec_private_key.h',
170         'ec_private_key_nss.cc',
171         'ec_private_key_openssl.cc',
172         'ec_signature_creator.cc',
173         'ec_signature_creator.h',
174         'ec_signature_creator_impl.h',
175         'ec_signature_creator_nss.cc',
176         'ec_signature_creator_openssl.cc',
177         'encryptor.cc',
178         'encryptor.h',
179         'encryptor_nss.cc',
180         'encryptor_openssl.cc',
181         'hmac_nss.cc',
182         'hmac_openssl.cc',
183         'keychain_mac.cc',
184         'keychain_mac.h',
185         'mac_security_services_lock.cc',
186         'mac_security_services_lock.h',
187         'mock_keychain_mac.cc',
188         'mock_keychain_mac.h',
189         'p224_spake.cc',
190         'p224_spake.h',
191         'nss_util.cc',
192         'nss_util.h',
193         'nss_util_internal.h',
194         'openpgp_symmetric_encryption.cc',
195         'openpgp_symmetric_encryption.h',
196         'openssl_util.cc',
197         'openssl_util.h',
198         'p224.cc',
199         'p224.h',
200         'rsa_private_key.cc',
201         'rsa_private_key.h',
202         'rsa_private_key_mac.cc',
203         'rsa_private_key_nss.cc',
204         'rsa_private_key_openssl.cc',
205         'rsa_private_key_win.cc',
206         'scoped_capi_types.h',
207         'scoped_nss_types.h',
208         'secure_hash.h',
209         'secure_hash_default.cc',
210         'secure_hash_openssl.cc',
211         'sha2.cc',
212         'sha2.h',
213         'signature_creator.h',
214         'signature_creator_mac.cc',
215         'signature_creator_nss.cc',
216         'signature_creator_openssl.cc',
217         'signature_creator_win.cc',
218         'signature_verifier.h',
219         'signature_verifier_nss.cc',
220         'signature_verifier_openssl.cc',
221         'symmetric_key_nss.cc',
222         'symmetric_key_openssl.cc',
223         'third_party/nss/chromium-blapi.h',
224         'third_party/nss/chromium-blapit.h',
225         'third_party/nss/chromium-nss.h',
226         'third_party/nss/pk11akey.cc',
227         'third_party/nss/secsign.cc',
228       ],
229     },
230     {
231       'target_name': 'crypto_unittests',
232       'type': 'executable',
233       'sources': [
234         # Infrastructure files.
235         'run_all_unittests.cc',
237         # Tests.
238         'ec_private_key_unittest.cc',
239         'ec_signature_creator_unittest.cc',
240         'encryptor_unittest.cc',
241         'hmac_unittest.cc',
242         'nss_util_unittest.cc',
243         'p224_unittest.cc',
244         'p224_spake_unittest.cc',
245         'rsa_private_key_unittest.cc',
246         'rsa_private_key_nss_unittest.cc',
247         'secure_hash_unittest.cc',
248         'sha2_unittest.cc',
249         'signature_creator_unittest.cc',
250         'signature_verifier_unittest.cc',
251         'symmetric_key_unittest.cc',
252         'openpgp_symmetric_encryption_unittest.cc',
253       ],
254       'dependencies': [
255         'crypto',
256         '../base/base.gyp:base',
257         '../base/base.gyp:test_support_base',
258         '../testing/gmock.gyp:gmock',
259         '../testing/gtest.gyp:gtest',
260       ],
261       'conditions': [
262         [ 'os_posix == 1 and OS != "mac" and OS != "android"', {
263           'conditions': [
264             [ 'linux_use_tcmalloc==1', {
265                 'dependencies': [
266                   '../base/allocator/allocator.gyp:allocator',
267                 ],
268               },
269             ],
270           ],
271           'dependencies': [
272             '../build/linux/system.gyp:ssl',
273           ],
274         }, {  # os_posix != 1 or OS == "mac" or OS == "android"
275           'sources!': [
276             'rsa_private_key_nss_unittest.cc',
277             'openpgp_symmetric_encryption_unittest.cc',
278           ]
279         }],
280         [ 'OS == "mac" or OS == "win"', {
281           'dependencies': [
282             '../third_party/nss/nss.gyp:nss',
283           ],
284         }],
285         [ 'OS == "mac"', {
286           'dependencies': [
287             '../third_party/nss/nss.gyp:nspr',
288           ],
289         }],
290         [ 'use_openssl==1', {
291           'sources!': [
292             'nss_util_unittest.cc',
293             'openpgp_symmetric_encryption_unittest.cc',
294             'rsa_private_key_nss_unittest.cc',
295           ],
296         }],
297       ],
298     },
299   ],
300   'conditions': [
301     [ 'OS == "win"', {
302       'targets': [
303         {
304           'target_name': 'crypto_nacl_win64',
305           # We do not want nacl_helper to depend on NSS because this would
306           # require including a 64-bit copy of NSS. Thus, use the native APIs
307           # for the helper.
308           'type': '<(component)',
309           'dependencies': [
310             '../base/base.gyp:base_nacl_win64',
311             '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations_win64',
312           ],
313           'sources': [
314             '<@(hmac_win64_related_sources)',
315           ],
316           'defines': [
317            'CRYPTO_IMPLEMENTATION',
318            '<@(nacl_win64_defines)',
319           ],
320           'msvs_disabled_warnings': [
321             4018,
322           ],
323           'configurations': {
324             'Common_Base': {
325               'msvs_target_platform': 'x64',
326             },
327           },
328         },
329       ],
330     }],
331   ],