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"], |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame^] | 79 | unique_host_soname: true, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | // Static library |
| 83 | // This should only be used for host modules that will be in a JVM, all other |
| 84 | // modules should use the static variant of libcrypto. |
| 85 | cc_library_static { |
| 86 | name: "libcrypto_static", |
| 87 | defaults: ["libcrypto_sources", "libcrypto_defaults", "boringssl_defaults", "boringssl_flags"], |
| 88 | |
| 89 | target: { |
| 90 | host: { |
| 91 | // TODO: b/26097626. ASAN breaks use of this library in JVM. |
| 92 | // Re-enable sanitization when the issue with making clients of this library |
| 93 | // preload ASAN runtime is resolved. Without that, clients are getting runtime |
| 94 | // errors due to unresoled ASAN symbols, such as |
| 95 | // __asan_option_detect_stack_use_after_return. |
| 96 | sanitize: { |
| 97 | never: true, |
| 98 | }, |
| 99 | }, |
| 100 | }, |
| 101 | } |
| 102 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 103 | //// libssl |
| 104 | |
| 105 | // Target static library |
| 106 | // Deprecated: all users should move to libssl |
| 107 | cc_library_static { |
| 108 | name: "libssl_static", |
| 109 | defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"], |
| 110 | } |
| 111 | |
| 112 | // Static and Shared library |
| 113 | cc_library { |
| 114 | name: "libssl", |
| 115 | host_supported: true, |
| 116 | defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"], |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame^] | 117 | unique_host_soname: true, |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 118 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame^] | 119 | shared_libs: ["libcrypto"], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 120 | } |
| 121 | |
| 122 | // Host static library |
| 123 | cc_library_host_static { |
| 124 | name: "libssl_static-host", |
| 125 | defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"], |
| 126 | |
| 127 | // TODO: b/26097626. ASAN breaks use of this library in JVM. |
| 128 | // Re-enable sanitization when the issue with making clients of this library |
| 129 | // preload ASAN runtime is resolved. Without that, clients are getting runtime |
| 130 | // errors due to unresoled ASAN symbols, such as |
| 131 | // __asan_option_detect_stack_use_after_return. |
| 132 | sanitize: { |
| 133 | never: true, |
| 134 | }, |
| 135 | } |
| 136 | |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 137 | // Tool |
| 138 | cc_binary { |
| 139 | name: "bssl", |
| 140 | host_supported: true, |
| 141 | defaults: ["bssl_sources", "boringssl_flags"], |
| 142 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame^] | 143 | shared_libs: [ |
| 144 | "libcrypto", |
| 145 | "libssl", |
| 146 | ], |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 147 | target: { |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 148 | host: { |
Dan Willemsen | 21986fb | 2016-07-14 15:23:56 -0700 | [diff] [blame] | 149 | // Needed for clock_gettime. |
| 150 | host_ldlibs: ["-lrt"], |
| 151 | }, |
| 152 | darwin: { |
| 153 | enabled: false, |
| 154 | }, |
| 155 | }, |
| 156 | } |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 157 | |
| 158 | // Test support library |
| 159 | cc_library_static { |
| 160 | name: "boringssl_test_support", |
| 161 | host_supported: true, |
| 162 | defaults: ["boringssl_test_support_sources", "boringssl_flags"], |
| 163 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame^] | 164 | shared_libs: [ |
| 165 | "libcrypto", |
| 166 | "libssl", |
| 167 | ], |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 168 | } |
| 169 | |
| 170 | // Tests |
| 171 | cc_test { |
| 172 | name: "boringssl_tests", |
| 173 | host_supported: true, |
| 174 | test_per_src: true, |
| 175 | defaults: ["boringssl_tests_sources", "boringssl_flags"], |
| 176 | whole_static_libs: ["boringssl_test_support"], |
| 177 | |
Dan Willemsen | 2b2c24b | 2016-07-21 11:03:36 -0700 | [diff] [blame^] | 178 | shared_libs: [ |
| 179 | "libcrypto", |
| 180 | "libssl", |
| 181 | ], |
Dan Willemsen | 2458a41 | 2016-07-15 09:28:31 -0700 | [diff] [blame] | 182 | } |