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 | |
| 43 | cc_defaults { |
| 44 | name: "libcrypto_defaults", |
| 45 | host_supported: true, |
| 46 | |
| 47 | // Windows and Macs both have problems with assembly files |
| 48 | target: { |
| 49 | windows: { |
| 50 | enabled: true, |
| 51 | cflags: ["-DOPENSSL_NO_ASM"], |
| 52 | host_ldlibs: ["-lws2_32"], |
| 53 | }, |
| 54 | darwin: { |
| 55 | cflags: ["-DOPENSSL_NO_ASM"], |
| 56 | }, |
| 57 | not_windows: { |
| 58 | host_ldlibs: ["-lpthread"], |
| 59 | }, |
| 60 | }, |
| 61 | |
| 62 | local_include_dirs: ["src/crypto"], |
| 63 | |
| 64 | // sha256-armv4.S does not compile with clang. |
| 65 | arch: { |
| 66 | arm: { |
| 67 | clang_asflags: ["-no-integrated-as"], |
| 68 | }, |
| 69 | arm64: { |
| 70 | clang_asflags: ["-march=armv8-a+crypto"], |
| 71 | }, |
| 72 | }, |
| 73 | } |
| 74 | |
| 75 | // Target and host library |
| 76 | cc_library { |
| 77 | name: "libcrypto", |
| 78 | defaults: ["libcrypto_sources", "libcrypto_defaults", "boringssl_defaults", "boringssl_flags"], |
| 79 | |
| 80 | // Shared host library is disabled until all users use libcrypto instead of libcrypto-host |
| 81 | target: { |
| 82 | host: { |
| 83 | shared: { |
| 84 | enabled: false, |
| 85 | }, |
| 86 | }, |
| 87 | }, |
| 88 | } |
| 89 | |
| 90 | // Static library |
| 91 | // This should only be used for host modules that will be in a JVM, all other |
| 92 | // modules should use the static variant of libcrypto. |
| 93 | cc_library_static { |
| 94 | name: "libcrypto_static", |
| 95 | defaults: ["libcrypto_sources", "libcrypto_defaults", "boringssl_defaults", "boringssl_flags"], |
| 96 | |
| 97 | target: { |
| 98 | host: { |
| 99 | // TODO: b/26097626. ASAN breaks use of this library in JVM. |
| 100 | // Re-enable sanitization when the issue with making clients of this library |
| 101 | // preload ASAN runtime is resolved. Without that, clients are getting runtime |
| 102 | // errors due to unresoled ASAN symbols, such as |
| 103 | // __asan_option_detect_stack_use_after_return. |
| 104 | sanitize: { |
| 105 | never: true, |
| 106 | }, |
| 107 | }, |
| 108 | }, |
| 109 | } |
| 110 | |
| 111 | // Host shared library |
| 112 | cc_library_host_shared { |
| 113 | name: "libcrypto-host", |
| 114 | defaults: ["libcrypto_sources", "libcrypto_defaults", "boringssl_defaults", "boringssl_flags"], |
| 115 | } |
| 116 | |
| 117 | //// libssl |
| 118 | |
| 119 | // Target static library |
| 120 | // Deprecated: all users should move to libssl |
| 121 | cc_library_static { |
| 122 | name: "libssl_static", |
| 123 | defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"], |
| 124 | } |
| 125 | |
| 126 | // Static and Shared library |
| 127 | cc_library { |
| 128 | name: "libssl", |
| 129 | host_supported: true, |
| 130 | defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"], |
| 131 | |
| 132 | // Shared host library is disabled until all users use libssl instead of libssl-host |
| 133 | target: { |
| 134 | android: { |
| 135 | shared_libs: ["libcrypto"], |
| 136 | }, |
| 137 | host: { |
| 138 | shared_libs: ["libcrypto-host"], |
| 139 | |
| 140 | shared: { |
| 141 | enabled: false, |
| 142 | }, |
| 143 | }, |
| 144 | }, |
| 145 | } |
| 146 | |
| 147 | // Host static library |
| 148 | cc_library_host_static { |
| 149 | name: "libssl_static-host", |
| 150 | defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"], |
| 151 | |
| 152 | // TODO: b/26097626. ASAN breaks use of this library in JVM. |
| 153 | // Re-enable sanitization when the issue with making clients of this library |
| 154 | // preload ASAN runtime is resolved. Without that, clients are getting runtime |
| 155 | // errors due to unresoled ASAN symbols, such as |
| 156 | // __asan_option_detect_stack_use_after_return. |
| 157 | sanitize: { |
| 158 | never: true, |
| 159 | }, |
| 160 | } |
| 161 | |
| 162 | // Host shared library |
| 163 | cc_library_host_shared { |
| 164 | name: "libssl-host", |
| 165 | defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"], |
| 166 | |
| 167 | shared_libs: ["libcrypto-host"], |
| 168 | } |
| 169 | |
| 170 | // Tool |
| 171 | cc_binary { |
| 172 | name: "bssl", |
| 173 | host_supported: true, |
| 174 | defaults: ["bssl_sources", "boringssl_flags"], |
| 175 | |
| 176 | target: { |
| 177 | android: { |
| 178 | shared_libs: [ |
| 179 | "libcrypto", |
| 180 | "libssl", |
| 181 | ], |
| 182 | }, |
| 183 | host: { |
| 184 | shared_libs: [ |
| 185 | "libcrypto-host", |
| 186 | "libssl-host", |
| 187 | ], |
| 188 | |
| 189 | // Needed for clock_gettime. |
| 190 | host_ldlibs: ["-lrt"], |
| 191 | }, |
| 192 | darwin: { |
| 193 | enabled: false, |
| 194 | }, |
| 195 | }, |
| 196 | } |