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