| Hridya Valsaraju | dea91b4 | 2018-07-17 11:14:01 -0700 | [diff] [blame] | 1 | // Copyright (C) 2018 The Android Open Source Project | 
|  | 2 | // | 
|  | 3 | // Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 4 | // you may not use this file except in compliance with the License. | 
|  | 5 | // You may obtain a copy of the License at | 
|  | 6 | // | 
|  | 7 | //      http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 8 | // | 
|  | 9 | // Unless required by applicable law or agreed to in writing, software | 
|  | 10 | // distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 12 | // See the License for the specific language governing permissions and | 
|  | 13 | // limitations under the License. | 
|  | 14 |  | 
| Aaron Wisner | a5ad20a | 2018-08-24 09:59:50 -0500 | [diff] [blame] | 15 | // This is required because no Android.bp can include a library defined in an | 
|  | 16 | // Android.mk. Eventually should kill libfastboot (defined in Android.mk) | 
| Aaron Wisner | db51120 | 2018-06-26 15:38:35 -0500 | [diff] [blame] | 17 | cc_library_host_static { | 
|  | 18 | name: "libfastboot2", | 
|  | 19 |  | 
|  | 20 | //host_supported: true, | 
|  | 21 |  | 
|  | 22 | compile_multilib: "first", | 
|  | 23 | srcs: [ | 
| Dan Willemsen | ab971b5 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 24 | "bootimg_utils.cpp", | 
|  | 25 | "fs.cpp", | 
|  | 26 | "socket.cpp", | 
|  | 27 | "tcp.cpp", | 
|  | 28 | "udp.cpp", | 
|  | 29 | "util.cpp", | 
|  | 30 | "fastboot_driver.cpp", | 
| Aaron Wisner | db51120 | 2018-06-26 15:38:35 -0500 | [diff] [blame] | 31 | ], | 
|  | 32 |  | 
|  | 33 | static_libs: [ | 
| Dan Willemsen | ab971b5 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 34 | "libziparchive", | 
|  | 35 | "libsparse", | 
|  | 36 | "libutils", | 
|  | 37 | "liblog", | 
|  | 38 | "libz", | 
|  | 39 | "libdiagnose_usb", | 
|  | 40 | "libbase", | 
|  | 41 | "libcutils", | 
|  | 42 | "libgtest", | 
|  | 43 | "libgtest_main", | 
|  | 44 | "libbase", | 
|  | 45 | "libadb_host", | 
| David Anderson | 8956964 | 2018-11-16 15:53:35 -0800 | [diff] [blame] | 46 | "liblp", | 
| Aaron Wisner | db51120 | 2018-06-26 15:38:35 -0500 | [diff] [blame] | 47 | ], | 
|  | 48 |  | 
|  | 49 | header_libs: [ | 
| Dan Willemsen | ab971b5 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 50 | "bootimg_headers", | 
| Aaron Wisner | db51120 | 2018-06-26 15:38:35 -0500 | [diff] [blame] | 51 | ], | 
|  | 52 |  | 
|  | 53 | export_header_lib_headers: [ | 
| Dan Willemsen | ab971b5 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 54 | "bootimg_headers", | 
| Aaron Wisner | db51120 | 2018-06-26 15:38:35 -0500 | [diff] [blame] | 55 | ], | 
|  | 56 |  | 
| Aaron Wisner | db51120 | 2018-06-26 15:38:35 -0500 | [diff] [blame] | 57 | target: { | 
| Dan Willemsen | ab971b5 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 58 | linux: { | 
|  | 59 | srcs: ["usb_linux.cpp"], | 
|  | 60 | }, | 
| Aaron Wisner | a5ad20a | 2018-08-24 09:59:50 -0500 | [diff] [blame] | 61 |  | 
| Dan Willemsen | ab971b5 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 62 | darwin: { | 
|  | 63 | srcs: ["usb_osx.cpp"], | 
| Aaron Wisner | a5ad20a | 2018-08-24 09:59:50 -0500 | [diff] [blame] | 64 |  | 
| Dan Willemsen | ab971b5 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 65 | host_ldlibs: [ | 
|  | 66 | "-framework CoreFoundation", | 
|  | 67 | "-framework IOKit", | 
|  | 68 | ], | 
|  | 69 | }, | 
| Aaron Wisner | a5ad20a | 2018-08-24 09:59:50 -0500 | [diff] [blame] | 70 |  | 
| Dan Willemsen | ab971b5 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 71 | windows: { | 
|  | 72 | srcs: ["usb_windows.cpp"], | 
| Aaron Wisner | a5ad20a | 2018-08-24 09:59:50 -0500 | [diff] [blame] | 73 |  | 
| Dan Willemsen | ab971b5 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 74 | host_ldlibs: [ | 
|  | 75 | "-lws2_32", | 
|  | 76 | ], | 
|  | 77 | }, | 
| Aaron Wisner | db51120 | 2018-06-26 15:38:35 -0500 | [diff] [blame] | 78 | }, | 
|  | 79 |  | 
|  | 80 | cflags: [ | 
| Dan Willemsen | ab971b5 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 81 | "-Wall", | 
|  | 82 | "-Wextra", | 
|  | 83 | "-Werror", | 
|  | 84 | "-Wunreachable-code", | 
| Aaron Wisner | db51120 | 2018-06-26 15:38:35 -0500 | [diff] [blame] | 85 | ], | 
|  | 86 |  | 
|  | 87 | export_include_dirs: ["."], | 
|  | 88 |  | 
|  | 89 | } | 
| Hridya Valsaraju | dea91b4 | 2018-07-17 11:14:01 -0700 | [diff] [blame] | 90 |  | 
|  | 91 | cc_defaults { | 
|  | 92 | name: "fastboot_defaults", | 
|  | 93 |  | 
|  | 94 | cflags: [ | 
|  | 95 | "-Wall", | 
|  | 96 | "-Wextra", | 
|  | 97 | "-Werror", | 
|  | 98 | "-Wvla", | 
|  | 99 | ], | 
|  | 100 | rtti: true, | 
|  | 101 |  | 
|  | 102 | clang_cflags: [ | 
|  | 103 | "-Wthread-safety", | 
|  | 104 | ], | 
|  | 105 | } | 
|  | 106 |  | 
|  | 107 | cc_binary { | 
|  | 108 | name: "fastbootd", | 
|  | 109 | defaults: ["fastboot_defaults"], | 
|  | 110 |  | 
|  | 111 | recovery: true, | 
|  | 112 |  | 
|  | 113 | srcs: [ | 
|  | 114 | "device/commands.cpp", | 
|  | 115 | "device/fastboot_device.cpp", | 
| David Anderson | 12211d1 | 2018-07-24 15:21:20 -0700 | [diff] [blame] | 116 | "device/flashing.cpp", | 
| Hridya Valsaraju | dea91b4 | 2018-07-17 11:14:01 -0700 | [diff] [blame] | 117 | "device/main.cpp", | 
|  | 118 | "device/usb_client.cpp", | 
| Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 119 | "device/utility.cpp", | 
|  | 120 | "device/variables.cpp", | 
| Hridya Valsaraju | dea91b4 | 2018-07-17 11:14:01 -0700 | [diff] [blame] | 121 | ], | 
|  | 122 |  | 
|  | 123 | shared_libs: [ | 
| Hridya Valsaraju | 31d2c26 | 2018-07-20 13:35:50 -0700 | [diff] [blame] | 124 | "android.hardware.boot@1.0", | 
| Hridya Valsaraju | bf9f8d1 | 2018-09-05 16:57:24 -0700 | [diff] [blame] | 125 | "android.hardware.fastboot@1.0", | 
| Hridya Valsaraju | 47658ca | 2018-09-28 11:41:22 -0700 | [diff] [blame] | 126 | "android.hardware.health@2.0", | 
| Hridya Valsaraju | dea91b4 | 2018-07-17 11:14:01 -0700 | [diff] [blame] | 127 | "libadbd", | 
| Tao Bao | b71eedf | 2018-08-06 19:13:38 -0700 | [diff] [blame] | 128 | "libasyncio", | 
|  | 129 | "libbase", | 
|  | 130 | "libbootloader_message", | 
|  | 131 | "libcutils", | 
| David Anderson | 0d4277d | 2018-07-31 13:27:37 -0700 | [diff] [blame] | 132 | "libext2_uuid", | 
| Tao Bao | b71eedf | 2018-08-06 19:13:38 -0700 | [diff] [blame] | 133 | "libext4_utils", | 
|  | 134 | "libfs_mgr", | 
| David Anderson | 1d504e3 | 2019-01-15 14:38:20 -0800 | [diff] [blame] | 135 | "libgsi", | 
| Tao Bao | b71eedf | 2018-08-06 19:13:38 -0700 | [diff] [blame] | 136 | "libhidlbase", | 
| Tao Bao | b71eedf | 2018-08-06 19:13:38 -0700 | [diff] [blame] | 137 | "liblog", | 
| David Anderson | 88ef0b1 | 2018-08-09 10:40:00 -0700 | [diff] [blame] | 138 | "liblp", | 
| Tao Bao | b71eedf | 2018-08-06 19:13:38 -0700 | [diff] [blame] | 139 | "libsparse", | 
|  | 140 | "libutils", | 
| Hridya Valsaraju | dea91b4 | 2018-07-17 11:14:01 -0700 | [diff] [blame] | 141 | ], | 
|  | 142 |  | 
| Hridya Valsaraju | 47658ca | 2018-09-28 11:41:22 -0700 | [diff] [blame] | 143 | static_libs: [ | 
|  | 144 | "libhealthhalutils", | 
|  | 145 | ], | 
| Hridya Valsaraju | dea91b4 | 2018-07-17 11:14:01 -0700 | [diff] [blame] | 146 | } | 
| Dan Willemsen | ab971b5 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 147 |  | 
|  | 148 | cc_defaults { | 
|  | 149 | name: "fastboot_host_defaults", | 
|  | 150 |  | 
|  | 151 | use_version_lib: true, | 
|  | 152 |  | 
|  | 153 | cflags: [ | 
|  | 154 | "-Wall", | 
|  | 155 | "-Wextra", | 
|  | 156 | "-Werror", | 
|  | 157 | "-Wunreachable-code", | 
|  | 158 | ], | 
|  | 159 |  | 
|  | 160 | target: { | 
|  | 161 | darwin: { | 
|  | 162 | cflags: ["-Wno-unused-parameter"], | 
|  | 163 | host_ldlibs: [ | 
|  | 164 | "-lpthread", | 
|  | 165 | "-framework CoreFoundation", | 
|  | 166 | "-framework IOKit", | 
| Dan Willemsen | ab971b5 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 167 | ], | 
|  | 168 | }, | 
|  | 169 | windows: { | 
|  | 170 | enabled: true, | 
|  | 171 |  | 
|  | 172 | host_ldlibs: ["-lws2_32"], | 
|  | 173 | }, | 
| David Anderson | 8956964 | 2018-11-16 15:53:35 -0800 | [diff] [blame] | 174 | not_windows: { | 
|  | 175 | static_libs: [ | 
|  | 176 | "libext4_utils", | 
|  | 177 | ], | 
|  | 178 | }, | 
| Dan Willemsen | ab971b5 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 179 | }, | 
|  | 180 |  | 
|  | 181 | stl: "libc++_static", | 
|  | 182 |  | 
|  | 183 | // Don't add anything here, we don't want additional shared dependencies | 
|  | 184 | // on the host fastboot tool, and shared libraries that link against libc++ | 
|  | 185 | // will violate ODR. | 
|  | 186 | shared_libs: [], | 
|  | 187 |  | 
|  | 188 | header_libs: ["bootimg_headers"], | 
|  | 189 | static_libs: [ | 
|  | 190 | "libziparchive", | 
|  | 191 | "libsparse", | 
|  | 192 | "libutils", | 
|  | 193 | "liblog", | 
|  | 194 | "libz", | 
|  | 195 | "libdiagnose_usb", | 
|  | 196 | "libbase", | 
|  | 197 | "libcutils", | 
|  | 198 | "libgtest_host", | 
| David Anderson | 8956964 | 2018-11-16 15:53:35 -0800 | [diff] [blame] | 199 | "liblp", | 
|  | 200 | "libcrypto", | 
| Dan Willemsen | ab971b5 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 201 | ], | 
|  | 202 | } | 
|  | 203 |  | 
|  | 204 | // | 
|  | 205 | // Build host libfastboot. | 
|  | 206 | // | 
|  | 207 |  | 
|  | 208 | cc_library_host_static { | 
|  | 209 | name: "libfastboot", | 
|  | 210 | defaults: ["fastboot_host_defaults"], | 
|  | 211 |  | 
| Dan Willemsen | ab971b5 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 212 | srcs: [ | 
|  | 213 | "bootimg_utils.cpp", | 
| Dan Willemsen | ab971b5 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 214 | "fastboot.cpp", | 
|  | 215 | "fs.cpp", | 
|  | 216 | "socket.cpp", | 
|  | 217 | "tcp.cpp", | 
|  | 218 | "udp.cpp", | 
|  | 219 | "util.cpp", | 
|  | 220 | "fastboot_driver.cpp", | 
|  | 221 | ], | 
|  | 222 |  | 
|  | 223 | // Only version the final binaries | 
|  | 224 | use_version_lib: false, | 
|  | 225 | static_libs: ["libbuildversion"], | 
|  | 226 |  | 
|  | 227 | generated_headers: ["platform_tools_version"], | 
|  | 228 |  | 
|  | 229 | target: { | 
|  | 230 | windows: { | 
|  | 231 | srcs: ["usb_windows.cpp"], | 
|  | 232 |  | 
|  | 233 | include_dirs: ["development/host/windows/usb/api"], | 
|  | 234 | }, | 
|  | 235 | darwin: { | 
|  | 236 | srcs: ["usb_osx.cpp"], | 
|  | 237 | }, | 
|  | 238 | linux_glibc: { | 
|  | 239 | srcs: ["usb_linux.cpp"], | 
|  | 240 | }, | 
|  | 241 | }, | 
|  | 242 | } | 
|  | 243 |  | 
|  | 244 | // | 
|  | 245 | // Build host fastboot / fastboot.exe | 
|  | 246 | // | 
|  | 247 |  | 
|  | 248 | cc_binary_host { | 
|  | 249 | name: "fastboot", | 
|  | 250 | defaults: ["fastboot_host_defaults"], | 
|  | 251 |  | 
|  | 252 | srcs: ["main.cpp"], | 
|  | 253 | static_libs: ["libfastboot"], | 
|  | 254 |  | 
|  | 255 | required: [ | 
|  | 256 | "mke2fs", | 
|  | 257 | "make_f2fs", | 
|  | 258 | ], | 
| Dan Willemsen | 3f439a7 | 2018-11-19 19:11:35 -0800 | [diff] [blame] | 259 | dist: { | 
|  | 260 | targets: [ | 
|  | 261 | "dist_files", | 
|  | 262 | "sdk", | 
|  | 263 | "win_sdk", | 
|  | 264 | ], | 
|  | 265 | }, | 
| Dan Willemsen | ab971b5 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 266 |  | 
|  | 267 | target: { | 
|  | 268 | not_windows: { | 
|  | 269 | required: [ | 
|  | 270 | "e2fsdroid", | 
|  | 271 | "mke2fs.conf", | 
|  | 272 | "sload_f2fs", | 
|  | 273 | ], | 
|  | 274 | }, | 
|  | 275 | windows: { | 
|  | 276 | required: ["AdbWinUsbApi"], | 
|  | 277 | shared_libs: ["AdbWinApi"], | 
|  | 278 | }, | 
|  | 279 | }, | 
|  | 280 | } | 
|  | 281 |  | 
|  | 282 | // | 
|  | 283 | // Build host fastboot_test. | 
|  | 284 | // | 
|  | 285 |  | 
|  | 286 | cc_test_host { | 
|  | 287 | name: "fastboot_test", | 
|  | 288 | defaults: ["fastboot_host_defaults"], | 
|  | 289 |  | 
|  | 290 | srcs: [ | 
|  | 291 | "fastboot_test.cpp", | 
|  | 292 | "socket_mock.cpp", | 
|  | 293 | "socket_test.cpp", | 
|  | 294 | "tcp_test.cpp", | 
|  | 295 | "udp_test.cpp", | 
|  | 296 | ], | 
|  | 297 |  | 
|  | 298 | static_libs: ["libfastboot"], | 
|  | 299 |  | 
|  | 300 | target: { | 
|  | 301 | windows: { | 
|  | 302 | shared_libs: ["AdbWinApi"], | 
|  | 303 | }, | 
|  | 304 | windows_x86_64: { | 
|  | 305 | // Avoid trying to build for win64 | 
|  | 306 | enabled: false, | 
|  | 307 | }, | 
|  | 308 | }, | 
|  | 309 | } |