Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / net / third_party / nss / ssl / BUILD.gn
1 # Copyright (c) 2013 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.
4
5 config("ssl_config") {
6   include_dirs = [ "." ]
7
8   if (is_mac || is_win) {
9     defines = [ "NSS_PLATFORM_CLIENT_AUTH" ]
10   }
11 }
12
13 component("libssl") {
14   output_name = "crssl"
15
16   sources = [
17     "authcert.c",
18     "cmpcert.c",
19     "derive.c",
20     "dtlscon.c",
21     "preenc.h",
22     "prelib.c",
23     "ssl.h",
24     "ssl3con.c",
25     "ssl3ecc.c",
26     "ssl3ext.c",
27     "ssl3gthr.c",
28     "ssl3prot.h",
29     "sslauth.c",
30     "sslcon.c",
31     "ssldef.c",
32     "sslenum.c",
33     "sslerr.c",
34     "sslerr.h",
35     "SSLerrs.h",
36     "sslerrstrs.c",
37     "sslgathr.c",
38     "sslimpl.h",
39     "sslinfo.c",
40     "sslinit.c",
41     "sslmutex.c",
42     "sslmutex.h",
43     "sslnonce.c",
44     "sslplatf.c",
45     "sslproto.h",
46     "sslreveal.c",
47     "sslsecur.c",
48     "sslsnce.c",
49     "sslsock.c",
50     "sslt.h",
51     "ssltrace.c",
52     "sslver.c",
53     "unix_err.c",
54     "unix_err.h",
55     "win32err.c",
56     "win32err.h",
57     "bodge/secitem_array.c",
58   ]
59
60   direct_dependent_configs = [ ":ssl_config" ]
61
62   cflags = []
63   defines = [
64     "NO_PKCS11_BYPASS",
65     "NSS_ENABLE_ECC",
66     "USE_UTIL_DIRECTLY",
67   ]
68
69   configs -= [ "//build/config/compiler:chromium_code" ]
70   configs += [ "//build/config/compiler:no_chromium_code" ]
71
72   if (is_win) {
73     cflags += [ "/wd4267" ]  # Disable warning: Conversion from size_t to 'type'.
74
75     sources -= [
76       "unix_err.c",
77       "unix_err.h",
78     ]
79     sources += [ "exports_win.def" ]
80   } else if (is_linux) {
81     configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
82     libs = [ "dl" ]
83
84     include_dirs = [ "bodge" ]
85
86     # Must be after ssl_config since we want our SSL headers to take
87     # precedence.
88     direct_dependent_configs += [
89       "//third_party/nss:system_nss_no_ssl_config"
90     ]
91   } else if (is_mac) {
92     libs = [ "Security.framework" ]
93   }
94
95   if (is_posix) {
96     sources -= [
97       "win32err.c",
98       "win32err.h",
99     ]
100   }
101
102   if (is_mac || is_ios) {
103     defines += [
104       "XP_UNIX",
105       "DARWIN",
106       "XP_MACOSX",
107     ]
108   }
109
110   if (is_mac || is_ios || is_win) {
111     sources -= [
112       "bodge/secitem_array.c",
113     ]
114     deps = [
115       "//third_party/nss:nspr",
116       "//third_party/nss:nss",
117     ]
118     forward_dependent_configs_from = deps
119   }
120
121   if (!is_win && component_mode == "shared_library") {
122     configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
123   }
124
125   if (is_clang) {
126     cflags += [
127       # See http://crbug.com/138571#c8. In short, sslsecur.c picks up the
128       # system's cert.h because cert.h isn't in chromium's repo.
129       "-Wno-incompatible-pointer-types",
130
131       # There is a broken header guard in /usr/include/nss/secmod.h:
132       # https://bugzilla.mozilla.org/show_bug.cgi?id=884072
133       "-Wno-header-guard",
134     ]
135   }
136
137   if (is_debug) {
138     defines += [ "DEBUG" ]
139   }
140 }