Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2008 The Android Open Source Project |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | // |
| 16 | |
| 17 | // some files must not be compiled when building against Mingw |
| 18 | // they correspond to features not used by our host development tools |
| 19 | // which are also hard or even impossible to port to native Win32 |
| 20 | libcutils_nonwindows_sources = [ |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 21 | "fs.cpp", |
Elliott Hughes | 9d12725 | 2018-07-13 10:54:49 -0700 | [diff] [blame] | 22 | "hashmap.cpp", |
Jeff Sharkey | 53d37ba | 2017-11-09 17:41:09 -0700 | [diff] [blame] | 23 | "multiuser.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 24 | "str_parms.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 25 | ] |
| 26 | |
Vijay Venkatraman | 651f838 | 2017-01-25 18:52:17 +0000 | [diff] [blame] | 27 | cc_library_headers { |
Vijay Venkatraman | 651f838 | 2017-01-25 18:52:17 +0000 | [diff] [blame] | 28 | name: "libcutils_headers", |
Steven Moreland | 385fe69 | 2017-04-13 14:29:58 -0700 | [diff] [blame] | 29 | vendor_available: true, |
Jiyong Park | 612210c | 2018-04-27 21:48:43 +0900 | [diff] [blame] | 30 | recovery_available: true, |
Vijay Venkatraman | 651f838 | 2017-01-25 18:52:17 +0000 | [diff] [blame] | 31 | host_supported: true, |
dimitry | 051d5cb | 2019-05-16 14:17:00 +0200 | [diff] [blame] | 32 | native_bridge_supported: true, |
Vijay Venkatraman | 651f838 | 2017-01-25 18:52:17 +0000 | [diff] [blame] | 33 | export_include_dirs: ["include"], |
| 34 | target: { |
Steven Moreland | 385fe69 | 2017-04-13 14:29:58 -0700 | [diff] [blame] | 35 | vendor: { |
Steven Moreland | e1c834d | 2018-01-05 14:42:12 -0800 | [diff] [blame] | 36 | override_export_include_dirs: ["include_vndk"], |
Steven Moreland | 385fe69 | 2017-04-13 14:29:58 -0700 | [diff] [blame] | 37 | }, |
Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 38 | linux_bionic: { |
| 39 | enabled: true, |
| 40 | }, |
| 41 | windows: { |
| 42 | enabled: true, |
| 43 | }, |
Vijay Venkatraman | 651f838 | 2017-01-25 18:52:17 +0000 | [diff] [blame] | 44 | }, |
| 45 | } |
| 46 | |
Josh Gao | a9b62d5 | 2020-02-19 13:50:57 -0800 | [diff] [blame^] | 47 | // Socket specific parts of libcutils that are safe to statically link into an APEX. |
| 48 | cc_library_static { |
| 49 | name: "libcutils_sockets", |
| 50 | vendor_available: true, |
| 51 | vndk: { |
| 52 | enabled: true, |
| 53 | support_system_process: true, |
| 54 | }, |
| 55 | recovery_available: true, |
| 56 | host_supported: true, |
| 57 | native_bridge_supported: true, |
| 58 | apex_available: [ |
| 59 | "//apex_available:platform", |
| 60 | "//apex_available:anyapex", |
| 61 | ], |
| 62 | |
| 63 | export_include_dirs: ["include"], |
| 64 | |
| 65 | srcs: ["sockets.cpp"], |
| 66 | target: { |
| 67 | linux_bionic: { |
| 68 | enabled: true, |
| 69 | }, |
| 70 | |
| 71 | not_windows: { |
| 72 | srcs: [ |
| 73 | "socket_inaddr_any_server_unix.cpp", |
| 74 | "socket_local_client_unix.cpp", |
| 75 | "socket_local_server_unix.cpp", |
| 76 | "socket_network_client_unix.cpp", |
| 77 | "sockets_unix.cpp", |
| 78 | ], |
| 79 | }, |
| 80 | |
| 81 | // "not_windows" means "non-Windows host". |
| 82 | android: { |
| 83 | srcs: [ |
| 84 | "android_get_control_file.cpp", |
| 85 | "socket_inaddr_any_server_unix.cpp", |
| 86 | "socket_local_client_unix.cpp", |
| 87 | "socket_local_server_unix.cpp", |
| 88 | "socket_network_client_unix.cpp", |
| 89 | "sockets_unix.cpp", |
| 90 | ], |
| 91 | static_libs: ["libbase"], |
| 92 | }, |
| 93 | |
| 94 | windows: { |
| 95 | host_ldlibs: ["-lws2_32"], |
| 96 | srcs: [ |
| 97 | "socket_inaddr_any_server_windows.cpp", |
| 98 | "socket_network_client_windows.cpp", |
| 99 | "sockets_windows.cpp", |
| 100 | ], |
| 101 | |
| 102 | enabled: true, |
| 103 | cflags: [ |
| 104 | "-D_GNU_SOURCE", |
| 105 | ], |
| 106 | }, |
| 107 | }, |
| 108 | } |
| 109 | |
| 110 | cc_test { |
| 111 | name: "libcutils_sockets_test", |
| 112 | test_suites: ["device-tests"], |
| 113 | static_libs: ["libbase", "libcutils_sockets"], |
| 114 | cflags: [ |
| 115 | "-Wall", |
| 116 | "-Wextra", |
| 117 | "-Werror", |
| 118 | ], |
| 119 | |
| 120 | srcs: ["sockets_test.cpp"], |
| 121 | target: { |
| 122 | android: { |
| 123 | srcs: [ |
| 124 | "android_get_control_file_test.cpp", |
| 125 | "android_get_control_socket_test.cpp", |
| 126 | ], |
| 127 | }, |
| 128 | }, |
| 129 | } |
| 130 | |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 131 | cc_library { |
| 132 | name: "libcutils", |
Steven Moreland | 385fe69 | 2017-04-13 14:29:58 -0700 | [diff] [blame] | 133 | vendor_available: true, |
Justin Yun | 9ca9245 | 2017-07-31 15:41:10 +0900 | [diff] [blame] | 134 | vndk: { |
| 135 | enabled: true, |
| 136 | support_system_process: true, |
| 137 | }, |
Jiyong Park | 612210c | 2018-04-27 21:48:43 +0900 | [diff] [blame] | 138 | recovery_available: true, |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 139 | host_supported: true, |
dimitry | 051d5cb | 2019-05-16 14:17:00 +0200 | [diff] [blame] | 140 | native_bridge_supported: true, |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 141 | srcs: [ |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 142 | "config_utils.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 143 | "canned_fs_config.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 144 | "iosched_policy.cpp", |
| 145 | "load_file.cpp", |
| 146 | "native_handle.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 147 | "record_stream.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 148 | "strlcpy.c", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 149 | "threads.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 150 | ], |
| 151 | |
| 152 | target: { |
Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 153 | linux_bionic: { |
| 154 | enabled: true, |
Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 155 | }, |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 156 | not_windows: { |
| 157 | srcs: libcutils_nonwindows_sources + [ |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 158 | "ashmem-host.cpp", |
Jiyong Park | a2159c4 | 2019-02-03 00:34:29 +0900 | [diff] [blame] | 159 | "fs_config.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 160 | "trace-host.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 161 | ], |
| 162 | }, |
| 163 | windows: { |
Steven Moreland | e6132be | 2019-03-25 20:38:56 -0700 | [diff] [blame] | 164 | host_ldlibs: ["-lws2_32"], |
| 165 | |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 166 | srcs: [ |
David Sehr | eb2dd20 | 2018-12-20 12:59:36 -0800 | [diff] [blame] | 167 | "trace-host.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 168 | ], |
| 169 | |
| 170 | enabled: true, |
Mark Salyzyn | 163ecc6 | 2017-05-02 08:56:15 -0700 | [diff] [blame] | 171 | cflags: [ |
| 172 | "-D_GNU_SOURCE", |
| 173 | ], |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 174 | }, |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 175 | android: { |
| 176 | srcs: libcutils_nonwindows_sources + [ |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 177 | "android_reboot.cpp", |
| 178 | "ashmem-dev.cpp", |
Jiyong Park | a2159c4 | 2019-02-03 00:34:29 +0900 | [diff] [blame] | 179 | "fs_config.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 180 | "klog.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 181 | "partition_utils.cpp", |
Elliott Hughes | 4eacd70 | 2017-01-26 17:31:40 -0800 | [diff] [blame] | 182 | "properties.cpp", |
Chenbo Feng | baede73 | 2017-10-25 12:31:43 -0700 | [diff] [blame] | 183 | "qtaguid.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 184 | "trace-dev.cpp", |
Luis Hector Chavez | e97a4b9 | 2017-11-02 14:17:43 -0700 | [diff] [blame] | 185 | "uevent.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 186 | ], |
Luis Hector Chavez | fae195b | 2017-11-03 16:22:05 -0700 | [diff] [blame] | 187 | }, |
| 188 | |
| 189 | android_arm: { |
| 190 | srcs: ["arch-arm/memset32.S"], |
| 191 | sanitize: { |
| 192 | misc_undefined: ["integer"], |
| 193 | }, |
| 194 | }, |
| 195 | android_arm64: { |
| 196 | srcs: ["arch-arm64/android_memset.S"], |
Evgenii Stepanov | 54c7886 | 2017-01-31 16:33:53 -0800 | [diff] [blame] | 197 | sanitize: { |
| 198 | misc_undefined: ["integer"], |
| 199 | }, |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 200 | }, |
| 201 | |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 202 | android_mips: { |
| 203 | srcs: ["arch-mips/android_memset.c"], |
Luis Hector Chavez | fae195b | 2017-11-03 16:22:05 -0700 | [diff] [blame] | 204 | sanitize: { |
| 205 | misc_undefined: ["integer"], |
| 206 | }, |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 207 | }, |
| 208 | android_mips64: { |
| 209 | srcs: ["arch-mips/android_memset.c"], |
Luis Hector Chavez | fae195b | 2017-11-03 16:22:05 -0700 | [diff] [blame] | 210 | sanitize: { |
| 211 | misc_undefined: ["integer"], |
| 212 | }, |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 213 | }, |
| 214 | |
| 215 | android_x86: { |
| 216 | srcs: [ |
| 217 | "arch-x86/android_memset16.S", |
| 218 | "arch-x86/android_memset32.S", |
| 219 | ], |
Luis Hector Chavez | fae195b | 2017-11-03 16:22:05 -0700 | [diff] [blame] | 220 | // TODO: This is to work around b/29412086. |
| 221 | // Remove once __mulodi4 is available and move the "sanitize" block |
| 222 | // to the android target. |
| 223 | sanitize: { |
| 224 | misc_undefined: [], |
| 225 | }, |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 226 | }, |
| 227 | |
| 228 | android_x86_64: { |
| 229 | srcs: [ |
| 230 | "arch-x86_64/android_memset16.S", |
| 231 | "arch-x86_64/android_memset32.S", |
| 232 | ], |
Luis Hector Chavez | fae195b | 2017-11-03 16:22:05 -0700 | [diff] [blame] | 233 | sanitize: { |
| 234 | misc_undefined: ["integer"], |
| 235 | }, |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 236 | }, |
Logan Chien | 25b742c | 2018-05-08 17:37:29 +0800 | [diff] [blame] | 237 | |
| 238 | vendor: { |
| 239 | exclude_srcs: [ |
| 240 | // qtaguid.cpp loads libnetd_client.so with dlopen(). Since |
| 241 | // the interface of libnetd_client.so may vary between AOSP |
| 242 | // releases, exclude qtaguid.cpp from the VNDK-SP variant. |
| 243 | "qtaguid.cpp", |
| 244 | ], |
| 245 | } |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 246 | }, |
| 247 | |
Josh Gao | a9b62d5 | 2020-02-19 13:50:57 -0800 | [diff] [blame^] | 248 | whole_static_libs: ["libcutils_sockets"], |
Joel Fernandes | 5194404 | 2018-12-18 13:32:31 -0800 | [diff] [blame] | 249 | shared_libs: [ |
| 250 | "liblog", |
| 251 | "libbase", |
| 252 | ], |
Steven Moreland | d73be1b | 2017-04-13 23:48:57 -0700 | [diff] [blame] | 253 | header_libs: [ |
Elliott Hughes | 9f49508 | 2018-04-25 14:52:50 -0700 | [diff] [blame] | 254 | "libbase_headers", |
Steven Moreland | d73be1b | 2017-04-13 23:48:57 -0700 | [diff] [blame] | 255 | "libcutils_headers", |
| 256 | "libutils_headers", |
Suren Baghdasaryan | 1bd127b | 2019-01-25 05:30:52 +0000 | [diff] [blame] | 257 | "libprocessgroup_headers", |
Steven Moreland | d73be1b | 2017-04-13 23:48:57 -0700 | [diff] [blame] | 258 | ], |
Suren Baghdasaryan | 1bd127b | 2019-01-25 05:30:52 +0000 | [diff] [blame] | 259 | export_header_lib_headers: [ |
| 260 | "libcutils_headers", |
| 261 | "libprocessgroup_headers", |
| 262 | ], |
Yifan Hong | b680712 | 2017-07-25 15:24:04 -0700 | [diff] [blame] | 263 | local_include_dirs: ["include"], |
Vijay Venkatraman | 651f838 | 2017-01-25 18:52:17 +0000 | [diff] [blame] | 264 | |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 265 | cflags: [ |
| 266 | "-Werror", |
| 267 | "-Wall", |
| 268 | "-Wextra", |
| 269 | ], |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 270 | } |
| 271 | |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 272 | cc_defaults { |
| 273 | name: "libcutils_test_default", |
Elliott Hughes | 7e42484 | 2019-11-12 20:20:42 -0800 | [diff] [blame] | 274 | srcs: [ |
| 275 | "native_handle_test.cpp", |
| 276 | "sockets_test.cpp", |
| 277 | ], |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 278 | |
| 279 | target: { |
| 280 | android: { |
| 281 | srcs: [ |
| 282 | "android_get_control_file_test.cpp", |
| 283 | "android_get_control_socket_test.cpp", |
| 284 | "ashmem_test.cpp", |
| 285 | "fs_config_test.cpp", |
| 286 | "memset_test.cpp", |
| 287 | "multiuser_test.cpp", |
| 288 | "properties_test.cpp", |
| 289 | "sched_policy_test.cpp", |
| 290 | "str_parms_test.cpp", |
| 291 | "trace-dev_test.cpp", |
| 292 | ], |
| 293 | }, |
| 294 | |
| 295 | not_windows: { |
| 296 | srcs: [ |
| 297 | "str_parms_test.cpp", |
| 298 | ], |
| 299 | }, |
| 300 | }, |
| 301 | |
| 302 | cflags: [ |
| 303 | "-Wall", |
| 304 | "-Wextra", |
| 305 | "-Werror", |
| 306 | ], |
| 307 | } |
| 308 | |
| 309 | test_libraries = [ |
| 310 | "libcutils", |
| 311 | "liblog", |
| 312 | "libbase", |
| 313 | "libjsoncpp", |
| 314 | "libprocessgroup", |
Yifan Hong | 53e0deb | 2019-03-22 17:01:08 -0700 | [diff] [blame] | 315 | "libcgrouprc", |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 316 | ] |
| 317 | |
| 318 | cc_test { |
| 319 | name: "libcutils_test", |
| 320 | test_suites: ["device-tests"], |
| 321 | defaults: ["libcutils_test_default"], |
| 322 | host_supported: true, |
| 323 | shared_libs: test_libraries, |
Tom Cherry | e41aded | 2019-11-07 14:06:21 -0800 | [diff] [blame] | 324 | require_root: true, |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 325 | } |
| 326 | |
nelsonli | d83f390 | 2020-01-16 17:20:18 +0800 | [diff] [blame] | 327 | cc_defaults { |
| 328 | name: "libcutils_test_static_defaults", |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 329 | defaults: ["libcutils_test_default"], |
Yifan Hong | 53e0deb | 2019-03-22 17:01:08 -0700 | [diff] [blame] | 330 | static_libs: [ |
| 331 | "libc", |
| 332 | "libcgrouprc_format", |
| 333 | ] + test_libraries, |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 334 | stl: "libc++_static", |
Tom Cherry | e41aded | 2019-11-07 14:06:21 -0800 | [diff] [blame] | 335 | require_root: true, |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 336 | |
| 337 | target: { |
| 338 | android: { |
| 339 | static_executable: true, |
| 340 | }, |
| 341 | windows: { |
| 342 | host_ldlibs: ["-lws2_32"], |
| 343 | |
| 344 | enabled: true, |
| 345 | }, |
| 346 | }, |
| 347 | } |
nelsonli | d83f390 | 2020-01-16 17:20:18 +0800 | [diff] [blame] | 348 | |
| 349 | cc_test { |
| 350 | name: "libcutils_test_static", |
| 351 | test_suites: ["device-tests"], |
| 352 | defaults: ["libcutils_test_static_defaults"], |
| 353 | } |
| 354 | |
| 355 | cc_test { |
| 356 | name: "KernelLibcutilsTest", |
| 357 | test_suites: ["general-tests", "vts-core"], |
| 358 | defaults: ["libcutils_test_static_defaults"], |
| 359 | test_config: "KernelLibcutilsTest.xml", |
| 360 | } |