Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 1 | // 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 |
| 6 | build = ["sources.bp"] |
| 7 | |
| 8 | // Used by libcrypto, libssl, bssl tool, and native tests |
| 9 | cc_defaults { |
| 10 | name: "boringssl_flags", |
Steven Moreland | f593be8 | 2017-04-14 04:51:23 -0700 | [diff] [blame] | 11 | vendor_available: true, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 12 | |
| 13 | cflags: [ |
| 14 | "-fvisibility=hidden", |
| 15 | "-DBORINGSSL_SHARED_LIBRARY", |
| 16 | "-DBORINGSSL_IMPLEMENTATION", |
| 17 | "-DOPENSSL_SMALL", |
| 18 | "-D_XOPEN_SOURCE=700", |
| 19 | "-Wno-unused-parameter", |
| 20 | ], |
| 21 | |
| 22 | cppflags: [ |
| 23 | "-Wall", |
| 24 | "-Werror", |
| 25 | ], |
| 26 | |
| 27 | conlyflags: ["-std=c99"], |
| 28 | } |
| 29 | |
| 30 | // Used by libcrypto + libssl |
| 31 | cc_defaults { |
| 32 | name: "boringssl_defaults", |
| 33 | |
| 34 | local_include_dirs: ["src/include"], |
| 35 | export_include_dirs: ["src/include"], |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame] | 36 | stl: "libc++_static", |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 37 | sdk_version: "9", |
| 38 | |
| 39 | cflags: ["-DBORINGSSL_ANDROID_SYSTEM"], |
| 40 | } |
| 41 | |
| 42 | //// libcrypto |
| 43 | |
Kenny Root | 30c1479 | 2016-07-21 14:33:54 -0700 | [diff] [blame] | 44 | // This should be removed when clang can compile everything. |
| 45 | libcrypto_sources_no_clang = [ |
| 46 | "linux-arm/crypto/aes/aes-armv4.S", |
| 47 | "linux-arm/crypto/aes/bsaes-armv7.S", |
Kenny Root | 30c1479 | 2016-07-21 14:33:54 -0700 | [diff] [blame] | 48 | ] |
| 49 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 50 | cc_defaults { |
| 51 | name: "libcrypto_defaults", |
| 52 | host_supported: true, |
| 53 | |
| 54 | // Windows and Macs both have problems with assembly files |
| 55 | target: { |
| 56 | windows: { |
| 57 | enabled: true, |
| 58 | cflags: ["-DOPENSSL_NO_ASM"], |
| 59 | host_ldlibs: ["-lws2_32"], |
| 60 | }, |
| 61 | darwin: { |
| 62 | cflags: ["-DOPENSSL_NO_ASM"], |
| 63 | }, |
Kenny Root | 7b550be | 2016-09-20 15:25:24 -0700 | [diff] [blame] | 64 | host: { |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 65 | host_ldlibs: ["-lpthread"], |
| 66 | }, |
| 67 | }, |
| 68 | |
| 69 | local_include_dirs: ["src/crypto"], |
| 70 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 71 | arch: { |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 72 | arm64: { |
| 73 | clang_asflags: ["-march=armv8-a+crypto"], |
| 74 | }, |
| 75 | }, |
Kenny Root | 30c1479 | 2016-07-21 14:33:54 -0700 | [diff] [blame] | 76 | |
| 77 | // This should be removed when clang can compile everything. |
| 78 | exclude_srcs: libcrypto_sources_no_clang, |
| 79 | whole_static_libs: ["libcrypto_no_clang"], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | // Target and host library |
| 83 | cc_library { |
| 84 | name: "libcrypto", |
Vijay Venkatraman | 3caad95 | 2017-05-16 12:00:57 -0700 | [diff] [blame^] | 85 | vendor_available: true, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 86 | defaults: ["libcrypto_sources", "libcrypto_defaults", "boringssl_defaults", "boringssl_flags"], |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 87 | unique_host_soname: true, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 88 | } |
| 89 | |
Kenny Root | 30c1479 | 2016-07-21 14:33:54 -0700 | [diff] [blame] | 90 | // Target and host library: files that don't compile with clang. This should |
| 91 | // go away when clang can compile everything with integrated assembler. |
| 92 | cc_library_static { |
| 93 | name: "libcrypto_no_clang", |
| 94 | defaults: ["boringssl_defaults", "boringssl_flags"], |
| 95 | host_supported: true, |
| 96 | |
| 97 | target: { |
| 98 | windows: { |
| 99 | enabled: true, |
| 100 | }, |
| 101 | }, |
| 102 | |
| 103 | local_include_dirs: ["src/crypto"], |
| 104 | |
| 105 | arch: { |
| 106 | arm: { |
| 107 | clang_asflags: ["-no-integrated-as"], |
| 108 | srcs: libcrypto_sources_no_clang, |
| 109 | }, |
| 110 | }, |
| 111 | } |
| 112 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 113 | // Static library |
| 114 | // This should only be used for host modules that will be in a JVM, all other |
| 115 | // modules should use the static variant of libcrypto. |
| 116 | cc_library_static { |
| 117 | name: "libcrypto_static", |
| 118 | defaults: ["libcrypto_sources", "libcrypto_defaults", "boringssl_defaults", "boringssl_flags"], |
| 119 | |
| 120 | target: { |
| 121 | host: { |
David Benjamin | c0dedc0 | 2017-01-24 17:54:24 -0500 | [diff] [blame] | 122 | // TODO: b/26160319. ASAN breaks use of this library in JVM. |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 123 | // Re-enable sanitization when the issue with making clients of this library |
| 124 | // preload ASAN runtime is resolved. Without that, clients are getting runtime |
David Benjamin | c0dedc0 | 2017-01-24 17:54:24 -0500 | [diff] [blame] | 125 | // errors due to unresolved ASAN symbols, such as |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 126 | // __asan_option_detect_stack_use_after_return. |
| 127 | sanitize: { |
| 128 | never: true, |
| 129 | }, |
| 130 | }, |
| 131 | }, |
| 132 | } |
| 133 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 134 | //// libssl |
| 135 | |
| 136 | // Target static library |
| 137 | // Deprecated: all users should move to libssl |
| 138 | cc_library_static { |
| 139 | name: "libssl_static", |
| 140 | defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"], |
| 141 | } |
| 142 | |
| 143 | // Static and Shared library |
| 144 | cc_library { |
| 145 | name: "libssl", |
| 146 | host_supported: true, |
| 147 | defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"], |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 148 | unique_host_soname: true, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 149 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 150 | shared_libs: ["libcrypto"], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 151 | } |
| 152 | |
| 153 | // Host static library |
| 154 | cc_library_host_static { |
| 155 | name: "libssl_static-host", |
| 156 | defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"], |
| 157 | |
David Benjamin | c0dedc0 | 2017-01-24 17:54:24 -0500 | [diff] [blame] | 158 | // TODO: b/26160319. ASAN breaks use of this library in JVM. |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 159 | // Re-enable sanitization when the issue with making clients of this library |
| 160 | // preload ASAN runtime is resolved. Without that, clients are getting runtime |
David Benjamin | c0dedc0 | 2017-01-24 17:54:24 -0500 | [diff] [blame] | 161 | // errors due to unresolved ASAN symbols, such as |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 162 | // __asan_option_detect_stack_use_after_return. |
| 163 | sanitize: { |
| 164 | never: true, |
| 165 | }, |
| 166 | } |
| 167 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 168 | // Tool |
| 169 | cc_binary { |
| 170 | name: "bssl", |
| 171 | host_supported: true, |
| 172 | defaults: ["bssl_sources", "boringssl_flags"], |
| 173 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 174 | shared_libs: [ |
| 175 | "libcrypto", |
| 176 | "libssl", |
| 177 | ], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 178 | target: { |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 179 | host: { |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 180 | // Needed for clock_gettime. |
| 181 | host_ldlibs: ["-lrt"], |
| 182 | }, |
| 183 | darwin: { |
| 184 | enabled: false, |
| 185 | }, |
| 186 | }, |
| 187 | } |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 188 | |
| 189 | // Test support library |
| 190 | cc_library_static { |
| 191 | name: "boringssl_test_support", |
| 192 | host_supported: true, |
| 193 | defaults: ["boringssl_test_support_sources", "boringssl_flags"], |
| 194 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 195 | shared_libs: [ |
| 196 | "libcrypto", |
| 197 | "libssl", |
| 198 | ], |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 199 | } |
| 200 | |
| 201 | // Tests |
| 202 | cc_test { |
| 203 | name: "boringssl_tests", |
| 204 | host_supported: true, |
| 205 | test_per_src: true, |
| 206 | defaults: ["boringssl_tests_sources", "boringssl_flags"], |
| 207 | whole_static_libs: ["boringssl_test_support"], |
| 208 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 209 | shared_libs: [ |
| 210 | "libcrypto", |
| 211 | "libssl", |
| 212 | ], |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 213 | } |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame] | 214 | |
| 215 | cc_test { |
| 216 | name: "boringssl_crypto_test", |
| 217 | host_supported: true, |
| 218 | defaults: ["boringssl_crypto_test_sources", "boringssl_flags"], |
| 219 | whole_static_libs: ["boringssl_test_support"], |
| 220 | |
| 221 | cflags: ["-DBORINGSSL_ANDROID_SYSTEM"], |
| 222 | shared_libs: ["libcrypto"], |
| 223 | } |
| 224 | |
| 225 | cc_test { |
| 226 | name: "boringssl_ssl_test", |
| 227 | host_supported: true, |
| 228 | defaults: ["boringssl_ssl_test_sources", "boringssl_flags"], |
| 229 | whole_static_libs: ["boringssl_test_support"], |
| 230 | |
| 231 | cflags: ["-DBORINGSSL_ANDROID_SYSTEM"], |
| 232 | shared_libs: ["libcrypto", "libssl"], |
| 233 | } |