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 6build = ["sources.bp"] 7 8// Used by libcrypto, libssl, bssl tool, and native tests 9cc_defaults { 10 name: "boringssl_flags", 11 vendor_available: true, 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 31cc_defaults { 32 name: "boringssl_defaults", 33 34 local_include_dirs: ["src/include"], 35 export_include_dirs: ["src/include"], 36 stl: "libc++_static", 37 sdk_version: "9", 38 39 cflags: ["-DBORINGSSL_ANDROID_SYSTEM"], 40} 41 42//// libcrypto 43 44// This should be removed when clang can compile everything. 45libcrypto_sources_no_clang = [ 46 "linux-arm/crypto/aes/aes-armv4.S", 47 "linux-arm/crypto/aes/bsaes-armv7.S", 48] 49 50cc_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 }, 64 host: { 65 host_ldlibs: ["-lpthread"], 66 }, 67 }, 68 69 local_include_dirs: ["src/crypto"], 70 71 arch: { 72 arm64: { 73 clang_asflags: ["-march=armv8-a+crypto"], 74 }, 75 }, 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"], 80} 81 82// Target and host library 83cc_library { 84 name: "libcrypto", 85 vendor_available: true, 86 defaults: ["libcrypto_sources", "libcrypto_defaults", "boringssl_defaults", "boringssl_flags"], 87 unique_host_soname: true, 88} 89 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. 92cc_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 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. 116cc_library_static { 117 name: "libcrypto_static", 118 defaults: ["libcrypto_sources", "libcrypto_defaults", "boringssl_defaults", "boringssl_flags"], 119 120 target: { 121 host: { 122 // TODO: b/26160319. ASAN breaks use of this library in JVM. 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 125 // errors due to unresolved ASAN symbols, such as 126 // __asan_option_detect_stack_use_after_return. 127 sanitize: { 128 never: true, 129 }, 130 }, 131 }, 132} 133 134//// libssl 135 136// Target static library 137// Deprecated: all users should move to libssl 138cc_library_static { 139 name: "libssl_static", 140 defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"], 141} 142 143// Static and Shared library 144cc_library { 145 name: "libssl", 146 host_supported: true, 147 defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"], 148 unique_host_soname: true, 149 150 shared_libs: ["libcrypto"], 151} 152 153// Host static library 154cc_library_host_static { 155 name: "libssl_static-host", 156 defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"], 157 158 // TODO: b/26160319. ASAN breaks use of this library in JVM. 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 161 // errors due to unresolved ASAN symbols, such as 162 // __asan_option_detect_stack_use_after_return. 163 sanitize: { 164 never: true, 165 }, 166} 167 168// Tool 169cc_binary { 170 name: "bssl", 171 host_supported: true, 172 defaults: ["bssl_sources", "boringssl_flags"], 173 174 shared_libs: [ 175 "libcrypto", 176 "libssl", 177 ], 178 target: { 179 host: { 180 // Needed for clock_gettime. 181 host_ldlibs: ["-lrt"], 182 }, 183 darwin: { 184 enabled: false, 185 }, 186 }, 187} 188 189// Test support library 190cc_library_static { 191 name: "boringssl_test_support", 192 host_supported: true, 193 defaults: ["boringssl_test_support_sources", "boringssl_flags"], 194 195 shared_libs: [ 196 "libcrypto", 197 "libssl", 198 ], 199} 200 201// Tests 202cc_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 209 shared_libs: [ 210 "libcrypto", 211 "libssl", 212 ], 213} 214 215cc_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 225cc_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} 234