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