blob: 0203bccf4d26a0259c1c55a3a80fa5fac692fe5b [file] [log] [blame]
Dan Willemsen21986fb2016-07-14 15:23:56 -07001// Note that some host libraries have the same module name as the target
2// libraries. This is currently needed to build, for example, adb. But it's
3// probably something that should be changed.
4
5// Pull in the autogenerated sources modules
6build = ["sources.bp"]
7
8// Used by libcrypto, libssl, bssl tool, and native tests
9cc_defaults {
10 name: "boringssl_flags",
11
12 cflags: [
13 "-fvisibility=hidden",
14 "-DBORINGSSL_SHARED_LIBRARY",
15 "-DBORINGSSL_IMPLEMENTATION",
16 "-DOPENSSL_SMALL",
17 "-D_XOPEN_SOURCE=700",
18 "-Wno-unused-parameter",
19 ],
20
21 cppflags: [
22 "-Wall",
23 "-Werror",
24 ],
25
26 conlyflags: ["-std=c99"],
27}
28
29// Used by libcrypto + libssl
30cc_defaults {
31 name: "boringssl_defaults",
32
33 local_include_dirs: ["src/include"],
34 export_include_dirs: ["src/include"],
David Benjaminf31229b2017-01-25 14:08:15 -050035 stl: "libc++_static",
Dan Willemsen21986fb2016-07-14 15:23:56 -070036 sdk_version: "9",
37
38 cflags: ["-DBORINGSSL_ANDROID_SYSTEM"],
39}
40
41//// libcrypto
42
Kenny Root30c14792016-07-21 14:33:54 -070043// This should be removed when clang can compile everything.
44libcrypto_sources_no_clang = [
45 "linux-arm/crypto/aes/aes-armv4.S",
46 "linux-arm/crypto/aes/bsaes-armv7.S",
Kenny Root30c14792016-07-21 14:33:54 -070047]
48
Dan Willemsen21986fb2016-07-14 15:23:56 -070049cc_defaults {
50 name: "libcrypto_defaults",
51 host_supported: true,
52
53 // Windows and Macs both have problems with assembly files
54 target: {
55 windows: {
56 enabled: true,
57 cflags: ["-DOPENSSL_NO_ASM"],
58 host_ldlibs: ["-lws2_32"],
59 },
60 darwin: {
61 cflags: ["-DOPENSSL_NO_ASM"],
62 },
Kenny Root7b550be2016-09-20 15:25:24 -070063 host: {
Dan Willemsen21986fb2016-07-14 15:23:56 -070064 host_ldlibs: ["-lpthread"],
65 },
66 },
67
68 local_include_dirs: ["src/crypto"],
69
Dan Willemsen21986fb2016-07-14 15:23:56 -070070 arch: {
Dan Willemsen21986fb2016-07-14 15:23:56 -070071 arm64: {
72 clang_asflags: ["-march=armv8-a+crypto"],
73 },
74 },
Kenny Root30c14792016-07-21 14:33:54 -070075
76 // This should be removed when clang can compile everything.
77 exclude_srcs: libcrypto_sources_no_clang,
78 whole_static_libs: ["libcrypto_no_clang"],
Dan Willemsen21986fb2016-07-14 15:23:56 -070079}
80
81// Target and host library
82cc_library {
83 name: "libcrypto",
84 defaults: ["libcrypto_sources", "libcrypto_defaults", "boringssl_defaults", "boringssl_flags"],
Dan Willemsen2b2c24b2016-07-21 11:03:36 -070085 unique_host_soname: true,
Dan Willemsen21986fb2016-07-14 15:23:56 -070086}
87
Kenny Root30c14792016-07-21 14:33:54 -070088// Target and host library: files that don't compile with clang. This should
89// go away when clang can compile everything with integrated assembler.
90cc_library_static {
91 name: "libcrypto_no_clang",
92 defaults: ["boringssl_defaults", "boringssl_flags"],
93 host_supported: true,
94
95 target: {
96 windows: {
97 enabled: true,
98 },
99 },
100
101 local_include_dirs: ["src/crypto"],
102
103 arch: {
104 arm: {
105 clang_asflags: ["-no-integrated-as"],
106 srcs: libcrypto_sources_no_clang,
107 },
108 },
109}
110
Dan Willemsen21986fb2016-07-14 15:23:56 -0700111// Static library
112// This should only be used for host modules that will be in a JVM, all other
113// modules should use the static variant of libcrypto.
114cc_library_static {
115 name: "libcrypto_static",
116 defaults: ["libcrypto_sources", "libcrypto_defaults", "boringssl_defaults", "boringssl_flags"],
117
118 target: {
119 host: {
David Benjaminc0dedc02017-01-24 17:54:24 -0500120 // TODO: b/26160319. ASAN breaks use of this library in JVM.
Dan Willemsen21986fb2016-07-14 15:23:56 -0700121 // Re-enable sanitization when the issue with making clients of this library
122 // preload ASAN runtime is resolved. Without that, clients are getting runtime
David Benjaminc0dedc02017-01-24 17:54:24 -0500123 // errors due to unresolved ASAN symbols, such as
Dan Willemsen21986fb2016-07-14 15:23:56 -0700124 // __asan_option_detect_stack_use_after_return.
125 sanitize: {
126 never: true,
127 },
128 },
129 },
130}
131
Dan Willemsen21986fb2016-07-14 15:23:56 -0700132//// libssl
133
134// Target static library
135// Deprecated: all users should move to libssl
136cc_library_static {
137 name: "libssl_static",
138 defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"],
139}
140
141// Static and Shared library
142cc_library {
143 name: "libssl",
144 host_supported: true,
145 defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"],
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700146 unique_host_soname: true,
Dan Willemsen21986fb2016-07-14 15:23:56 -0700147
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700148 shared_libs: ["libcrypto"],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700149}
150
151// Host static library
152cc_library_host_static {
153 name: "libssl_static-host",
154 defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"],
155
David Benjaminc0dedc02017-01-24 17:54:24 -0500156 // TODO: b/26160319. ASAN breaks use of this library in JVM.
Dan Willemsen21986fb2016-07-14 15:23:56 -0700157 // Re-enable sanitization when the issue with making clients of this library
158 // preload ASAN runtime is resolved. Without that, clients are getting runtime
David Benjaminc0dedc02017-01-24 17:54:24 -0500159 // errors due to unresolved ASAN symbols, such as
Dan Willemsen21986fb2016-07-14 15:23:56 -0700160 // __asan_option_detect_stack_use_after_return.
161 sanitize: {
162 never: true,
163 },
164}
165
Dan Willemsen21986fb2016-07-14 15:23:56 -0700166// Tool
167cc_binary {
168 name: "bssl",
169 host_supported: true,
170 defaults: ["bssl_sources", "boringssl_flags"],
171
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700172 shared_libs: [
173 "libcrypto",
174 "libssl",
175 ],
Dan Willemsen21986fb2016-07-14 15:23:56 -0700176 target: {
Dan Willemsen21986fb2016-07-14 15:23:56 -0700177 host: {
Dan Willemsen21986fb2016-07-14 15:23:56 -0700178 // Needed for clock_gettime.
179 host_ldlibs: ["-lrt"],
180 },
181 darwin: {
182 enabled: false,
183 },
184 },
185}
Dan Willemsen2458a412016-07-15 09:28:31 -0700186
187// Test support library
188cc_library_static {
189 name: "boringssl_test_support",
190 host_supported: true,
191 defaults: ["boringssl_test_support_sources", "boringssl_flags"],
192
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700193 shared_libs: [
194 "libcrypto",
195 "libssl",
196 ],
Dan Willemsen2458a412016-07-15 09:28:31 -0700197}
198
199// Tests
200cc_test {
201 name: "boringssl_tests",
202 host_supported: true,
203 test_per_src: true,
204 defaults: ["boringssl_tests_sources", "boringssl_flags"],
205 whole_static_libs: ["boringssl_test_support"],
206
Dan Willemsen2b2c24b2016-07-21 11:03:36 -0700207 shared_libs: [
208 "libcrypto",
209 "libssl",
210 ],
Dan Willemsen2458a412016-07-15 09:28:31 -0700211}
David Benjaminf31229b2017-01-25 14:08:15 -0500212
213cc_test {
214 name: "boringssl_crypto_test",
215 host_supported: true,
216 defaults: ["boringssl_crypto_test_sources", "boringssl_flags"],
217 whole_static_libs: ["boringssl_test_support"],
218
219 cflags: ["-DBORINGSSL_ANDROID_SYSTEM"],
220 shared_libs: ["libcrypto"],
221}
222
223cc_test {
224 name: "boringssl_ssl_test",
225 host_supported: true,
226 defaults: ["boringssl_ssl_test_sources", "boringssl_flags"],
227 whole_static_libs: ["boringssl_test_support"],
228
229 cflags: ["-DBORINGSSL_ANDROID_SYSTEM"],
230 shared_libs: ["libcrypto", "libssl"],
231}