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"], |
| 35 | stl: "none", |
| 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", |
| 47 | "linux-arm/crypto/sha/sha256-armv4.S", |
| 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 | }, |
| 64 | not_windows: { |
| 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", |
| 85 | defaults: ["libcrypto_sources", "libcrypto_defaults", "boringssl_defaults", "boringssl_flags"], |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 86 | unique_host_soname: true, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 87 | } |
| 88 | |
Kenny Root | 30c1479 | 2016-07-21 14:33:54 -0700 | [diff] [blame^] | 89 | // Target and host library: files that don't compile with clang. This should |
| 90 | // go away when clang can compile everything with integrated assembler. |
| 91 | cc_library_static { |
| 92 | name: "libcrypto_no_clang", |
| 93 | defaults: ["boringssl_defaults", "boringssl_flags"], |
| 94 | host_supported: true, |
| 95 | |
| 96 | target: { |
| 97 | windows: { |
| 98 | enabled: true, |
| 99 | }, |
| 100 | }, |
| 101 | |
| 102 | local_include_dirs: ["src/crypto"], |
| 103 | |
| 104 | arch: { |
| 105 | arm: { |
| 106 | clang_asflags: ["-no-integrated-as"], |
| 107 | srcs: libcrypto_sources_no_clang, |
| 108 | }, |
| 109 | }, |
| 110 | } |
| 111 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 112 | // Static library |
| 113 | // This should only be used for host modules that will be in a JVM, all other |
| 114 | // modules should use the static variant of libcrypto. |
| 115 | cc_library_static { |
| 116 | name: "libcrypto_static", |
| 117 | defaults: ["libcrypto_sources", "libcrypto_defaults", "boringssl_defaults", "boringssl_flags"], |
| 118 | |
| 119 | target: { |
| 120 | host: { |
| 121 | // TODO: b/26097626. ASAN breaks use of this library in JVM. |
| 122 | // Re-enable sanitization when the issue with making clients of this library |
| 123 | // preload ASAN runtime is resolved. Without that, clients are getting runtime |
| 124 | // errors due to unresoled ASAN symbols, such as |
| 125 | // __asan_option_detect_stack_use_after_return. |
| 126 | sanitize: { |
| 127 | never: true, |
| 128 | }, |
| 129 | }, |
| 130 | }, |
| 131 | } |
| 132 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 133 | //// libssl |
| 134 | |
| 135 | // Target static library |
| 136 | // Deprecated: all users should move to libssl |
| 137 | cc_library_static { |
| 138 | name: "libssl_static", |
| 139 | defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"], |
| 140 | } |
| 141 | |
| 142 | // Static and Shared library |
| 143 | cc_library { |
| 144 | name: "libssl", |
| 145 | host_supported: true, |
| 146 | defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"], |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 147 | unique_host_soname: true, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 148 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 149 | shared_libs: ["libcrypto"], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 150 | } |
| 151 | |
| 152 | // Host static library |
| 153 | cc_library_host_static { |
| 154 | name: "libssl_static-host", |
| 155 | defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"], |
| 156 | |
| 157 | // TODO: b/26097626. ASAN breaks use of this library in JVM. |
| 158 | // Re-enable sanitization when the issue with making clients of this library |
| 159 | // preload ASAN runtime is resolved. Without that, clients are getting runtime |
| 160 | // errors due to unresoled ASAN symbols, such as |
| 161 | // __asan_option_detect_stack_use_after_return. |
| 162 | sanitize: { |
| 163 | never: true, |
| 164 | }, |
| 165 | } |
| 166 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 167 | // Tool |
| 168 | cc_binary { |
| 169 | name: "bssl", |
| 170 | host_supported: true, |
| 171 | defaults: ["bssl_sources", "boringssl_flags"], |
| 172 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 173 | shared_libs: [ |
| 174 | "libcrypto", |
| 175 | "libssl", |
| 176 | ], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 177 | target: { |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 178 | host: { |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 179 | // Needed for clock_gettime. |
| 180 | host_ldlibs: ["-lrt"], |
| 181 | }, |
| 182 | darwin: { |
| 183 | enabled: false, |
| 184 | }, |
| 185 | }, |
| 186 | } |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 187 | |
| 188 | // Test support library |
| 189 | cc_library_static { |
| 190 | name: "boringssl_test_support", |
| 191 | host_supported: true, |
| 192 | defaults: ["boringssl_test_support_sources", "boringssl_flags"], |
| 193 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 194 | shared_libs: [ |
| 195 | "libcrypto", |
| 196 | "libssl", |
| 197 | ], |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 198 | } |
| 199 | |
| 200 | // Tests |
| 201 | cc_test { |
| 202 | name: "boringssl_tests", |
| 203 | host_supported: true, |
| 204 | test_per_src: true, |
| 205 | defaults: ["boringssl_tests_sources", "boringssl_flags"], |
| 206 | whole_static_libs: ["boringssl_test_support"], |
| 207 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame] | 208 | shared_libs: [ |
| 209 | "libcrypto", |
| 210 | "libssl", |
| 211 | ], |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 212 | } |