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", |
| 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 |
| 30 | cc_defaults { |
| 31 | name: "boringssl_defaults", |
| 32 | |
| 33 | local_include_dirs: ["src/include"], |
| 34 | export_include_dirs: ["src/include"], |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame^] | 35 | stl: "libc++_static", |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 36 | sdk_version: "9", |
| 37 | |
| 38 | cflags: ["-DBORINGSSL_ANDROID_SYSTEM"], |
| 39 | } |
| 40 | |
| 41 | //// libcrypto |
| 42 | |
Kenny Root | 30c1479 | 2016-07-21 14:33:54 -0700 | [diff] [blame] | 43 | // This should be removed when clang can compile everything. |
| 44 | libcrypto_sources_no_clang = [ |
| 45 | "linux-arm/crypto/aes/aes-armv4.S", |
| 46 | "linux-arm/crypto/aes/bsaes-armv7.S", |
Kenny Root | 30c1479 | 2016-07-21 14:33:54 -0700 | [diff] [blame] | 47 | ] |
| 48 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 49 | cc_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 Root | 7b550be | 2016-09-20 15:25:24 -0700 | [diff] [blame] | 63 | host: { |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 64 | host_ldlibs: ["-lpthread"], |
| 65 | }, |
| 66 | }, |
| 67 | |
| 68 | local_include_dirs: ["src/crypto"], |
| 69 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 70 | arch: { |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 71 | arm64: { |
| 72 | clang_asflags: ["-march=armv8-a+crypto"], |
| 73 | }, |
| 74 | }, |
Kenny Root | 30c1479 | 2016-07-21 14:33:54 -0700 | [diff] [blame] | 75 | |
| 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 Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 79 | } |
| 80 | |
| 81 | // Target and host library |
| 82 | cc_library { |
| 83 | name: "libcrypto", |
| 84 | defaults: ["libcrypto_sources", "libcrypto_defaults", "boringssl_defaults", "boringssl_flags"], |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 85 | unique_host_soname: true, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 86 | } |
| 87 | |
Kenny Root | 30c1479 | 2016-07-21 14:33:54 -0700 | [diff] [blame] | 88 | // Target and host library: files that don't compile with clang. This should |
| 89 | // go away when clang can compile everything with integrated assembler. |
| 90 | cc_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 Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 111 | // 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. |
| 114 | cc_library_static { |
| 115 | name: "libcrypto_static", |
| 116 | defaults: ["libcrypto_sources", "libcrypto_defaults", "boringssl_defaults", "boringssl_flags"], |
| 117 | |
| 118 | target: { |
| 119 | host: { |
| 120 | // TODO: b/26097626. ASAN breaks use of this library in JVM. |
| 121 | // Re-enable sanitization when the issue with making clients of this library |
| 122 | // preload ASAN runtime is resolved. Without that, clients are getting runtime |
| 123 | // errors due to unresoled ASAN symbols, such as |
| 124 | // __asan_option_detect_stack_use_after_return. |
| 125 | sanitize: { |
| 126 | never: true, |
| 127 | }, |
| 128 | }, |
| 129 | }, |
| 130 | } |
| 131 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 132 | //// libssl |
| 133 | |
| 134 | // Target static library |
| 135 | // Deprecated: all users should move to libssl |
| 136 | cc_library_static { |
| 137 | name: "libssl_static", |
| 138 | defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"], |
| 139 | } |
| 140 | |
| 141 | // Static and Shared library |
| 142 | cc_library { |
| 143 | name: "libssl", |
| 144 | host_supported: true, |
| 145 | defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"], |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 146 | unique_host_soname: true, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 147 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 148 | shared_libs: ["libcrypto"], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 149 | } |
| 150 | |
| 151 | // Host static library |
| 152 | cc_library_host_static { |
| 153 | name: "libssl_static-host", |
| 154 | defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"], |
| 155 | |
| 156 | // TODO: b/26097626. ASAN breaks use of this library in JVM. |
| 157 | // Re-enable sanitization when the issue with making clients of this library |
| 158 | // preload ASAN runtime is resolved. Without that, clients are getting runtime |
| 159 | // errors due to unresoled ASAN symbols, such as |
| 160 | // __asan_option_detect_stack_use_after_return. |
| 161 | sanitize: { |
| 162 | never: true, |
| 163 | }, |
| 164 | } |
| 165 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 166 | // Tool |
| 167 | cc_binary { |
| 168 | name: "bssl", |
| 169 | host_supported: true, |
| 170 | defaults: ["bssl_sources", "boringssl_flags"], |
| 171 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 172 | shared_libs: [ |
| 173 | "libcrypto", |
| 174 | "libssl", |
| 175 | ], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 176 | target: { |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 177 | host: { |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 178 | // Needed for clock_gettime. |
| 179 | host_ldlibs: ["-lrt"], |
| 180 | }, |
| 181 | darwin: { |
| 182 | enabled: false, |
| 183 | }, |
| 184 | }, |
| 185 | } |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 186 | |
| 187 | // Test support library |
| 188 | cc_library_static { |
| 189 | name: "boringssl_test_support", |
| 190 | host_supported: true, |
| 191 | defaults: ["boringssl_test_support_sources", "boringssl_flags"], |
| 192 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 193 | shared_libs: [ |
| 194 | "libcrypto", |
| 195 | "libssl", |
| 196 | ], |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 197 | } |
| 198 | |
| 199 | // Tests |
| 200 | cc_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 Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 207 | shared_libs: [ |
| 208 | "libcrypto", |
| 209 | "libssl", |
| 210 | ], |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 211 | } |
David Benjamin | f31229b | 2017-01-25 14:08:15 -0500 | [diff] [blame^] | 212 | |
| 213 | cc_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 | |
| 223 | cc_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 | } |