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, |
Tom Cherry | a5edc0f | 2020-09-17 09:38:42 -0700 | [diff] [blame^] | 31 | ramdisk_available: true, |
Vijay Venkatraman | 651f838 | 2017-01-25 18:52:17 +0000 | [diff] [blame] | 32 | host_supported: true, |
Jiyong Park | 8bf9b16 | 2020-03-07 16:36:09 +0900 | [diff] [blame] | 33 | apex_available: [ |
| 34 | "//apex_available:platform", |
| 35 | "//apex_available:anyapex", |
| 36 | ], |
Jooyung Han | 88f00f2 | 2020-04-16 18:48:33 +0900 | [diff] [blame] | 37 | min_sdk_version: "29", |
dimitry | 051d5cb | 2019-05-16 14:17:00 +0200 | [diff] [blame] | 38 | native_bridge_supported: true, |
Vijay Venkatraman | 651f838 | 2017-01-25 18:52:17 +0000 | [diff] [blame] | 39 | export_include_dirs: ["include"], |
| 40 | target: { |
Steven Moreland | 385fe69 | 2017-04-13 14:29:58 -0700 | [diff] [blame] | 41 | vendor: { |
Steven Moreland | e1c834d | 2018-01-05 14:42:12 -0800 | [diff] [blame] | 42 | override_export_include_dirs: ["include_vndk"], |
Steven Moreland | 385fe69 | 2017-04-13 14:29:58 -0700 | [diff] [blame] | 43 | }, |
Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 44 | linux_bionic: { |
| 45 | enabled: true, |
| 46 | }, |
| 47 | windows: { |
| 48 | enabled: true, |
| 49 | }, |
Vijay Venkatraman | 651f838 | 2017-01-25 18:52:17 +0000 | [diff] [blame] | 50 | }, |
| 51 | } |
| 52 | |
Josh Gao | a9b62d5 | 2020-02-19 13:50:57 -0800 | [diff] [blame] | 53 | // Socket specific parts of libcutils that are safe to statically link into an APEX. |
Josh Gao | 7f8a37c | 2020-03-09 15:20:55 -0700 | [diff] [blame] | 54 | cc_library { |
Josh Gao | a9b62d5 | 2020-02-19 13:50:57 -0800 | [diff] [blame] | 55 | name: "libcutils_sockets", |
| 56 | vendor_available: true, |
Josh Gao | a9b62d5 | 2020-02-19 13:50:57 -0800 | [diff] [blame] | 57 | recovery_available: true, |
| 58 | host_supported: true, |
| 59 | native_bridge_supported: true, |
| 60 | apex_available: [ |
| 61 | "//apex_available:platform", |
| 62 | "//apex_available:anyapex", |
| 63 | ], |
Jooyung Han | 88f00f2 | 2020-04-16 18:48:33 +0900 | [diff] [blame] | 64 | min_sdk_version: "29", |
Josh Gao | a9b62d5 | 2020-02-19 13:50:57 -0800 | [diff] [blame] | 65 | |
| 66 | export_include_dirs: ["include"], |
| 67 | |
Josh Gao | 7f8a37c | 2020-03-09 15:20:55 -0700 | [diff] [blame] | 68 | shared_libs: ["liblog"], |
Josh Gao | a9b62d5 | 2020-02-19 13:50:57 -0800 | [diff] [blame] | 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 | ], |
Jooyung Han | 88f00f2 | 2020-04-16 18:48:33 +0900 | [diff] [blame] | 148 | min_sdk_version: "29", |
dimitry | 051d5cb | 2019-05-16 14:17:00 +0200 | [diff] [blame] | 149 | native_bridge_supported: true, |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 150 | srcs: [ |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 151 | "config_utils.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 152 | "canned_fs_config.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 153 | "iosched_policy.cpp", |
| 154 | "load_file.cpp", |
| 155 | "native_handle.cpp", |
S Vasudev Prasad | 100b08a | 2020-05-08 11:45:45 +0530 | [diff] [blame] | 156 | "properties.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 157 | "record_stream.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 158 | "strlcpy.c", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 159 | "threads.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 160 | ], |
| 161 | |
| 162 | target: { |
Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 163 | linux_bionic: { |
| 164 | enabled: true, |
Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 165 | }, |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 166 | not_windows: { |
| 167 | srcs: libcutils_nonwindows_sources + [ |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 168 | "ashmem-host.cpp", |
Jiyong Park | a2159c4 | 2019-02-03 00:34:29 +0900 | [diff] [blame] | 169 | "fs_config.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 170 | "trace-host.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 171 | ], |
| 172 | }, |
| 173 | windows: { |
Steven Moreland | e6132be | 2019-03-25 20:38:56 -0700 | [diff] [blame] | 174 | host_ldlibs: ["-lws2_32"], |
| 175 | |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 176 | srcs: [ |
David Sehr | eb2dd20 | 2018-12-20 12:59:36 -0800 | [diff] [blame] | 177 | "trace-host.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 178 | ], |
| 179 | |
| 180 | enabled: true, |
Mark Salyzyn | 163ecc6 | 2017-05-02 08:56:15 -0700 | [diff] [blame] | 181 | cflags: [ |
| 182 | "-D_GNU_SOURCE", |
| 183 | ], |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 184 | }, |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 185 | android: { |
| 186 | srcs: libcutils_nonwindows_sources + [ |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 187 | "android_reboot.cpp", |
| 188 | "ashmem-dev.cpp", |
Jiyong Park | a2159c4 | 2019-02-03 00:34:29 +0900 | [diff] [blame] | 189 | "fs_config.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 190 | "klog.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 191 | "partition_utils.cpp", |
Chenbo Feng | baede73 | 2017-10-25 12:31:43 -0700 | [diff] [blame] | 192 | "qtaguid.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 193 | "trace-dev.cpp", |
Luis Hector Chavez | e97a4b9 | 2017-11-02 14:17:43 -0700 | [diff] [blame] | 194 | "uevent.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 195 | ], |
Luis Hector Chavez | fae195b | 2017-11-03 16:22:05 -0700 | [diff] [blame] | 196 | }, |
| 197 | |
| 198 | android_arm: { |
Luis Hector Chavez | fae195b | 2017-11-03 16:22:05 -0700 | [diff] [blame] | 199 | sanitize: { |
| 200 | misc_undefined: ["integer"], |
| 201 | }, |
| 202 | }, |
| 203 | android_arm64: { |
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 | |
| 209 | android_x86: { |
Luis Hector Chavez | fae195b | 2017-11-03 16:22:05 -0700 | [diff] [blame] | 210 | // TODO: This is to work around b/29412086. |
| 211 | // Remove once __mulodi4 is available and move the "sanitize" block |
| 212 | // to the android target. |
| 213 | sanitize: { |
| 214 | misc_undefined: [], |
| 215 | }, |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 216 | }, |
| 217 | |
| 218 | android_x86_64: { |
Luis Hector Chavez | fae195b | 2017-11-03 16:22:05 -0700 | [diff] [blame] | 219 | sanitize: { |
| 220 | misc_undefined: ["integer"], |
| 221 | }, |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 222 | }, |
Logan Chien | 25b742c | 2018-05-08 17:37:29 +0800 | [diff] [blame] | 223 | |
| 224 | vendor: { |
| 225 | exclude_srcs: [ |
| 226 | // qtaguid.cpp loads libnetd_client.so with dlopen(). Since |
| 227 | // the interface of libnetd_client.so may vary between AOSP |
| 228 | // releases, exclude qtaguid.cpp from the VNDK-SP variant. |
| 229 | "qtaguid.cpp", |
| 230 | ], |
| 231 | } |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 232 | }, |
| 233 | |
Josh Gao | a9b62d5 | 2020-02-19 13:50:57 -0800 | [diff] [blame] | 234 | whole_static_libs: ["libcutils_sockets"], |
Joel Fernandes | 5194404 | 2018-12-18 13:32:31 -0800 | [diff] [blame] | 235 | shared_libs: [ |
| 236 | "liblog", |
| 237 | "libbase", |
| 238 | ], |
Steven Moreland | d73be1b | 2017-04-13 23:48:57 -0700 | [diff] [blame] | 239 | header_libs: [ |
Elliott Hughes | 9f49508 | 2018-04-25 14:52:50 -0700 | [diff] [blame] | 240 | "libbase_headers", |
Steven Moreland | d73be1b | 2017-04-13 23:48:57 -0700 | [diff] [blame] | 241 | "libcutils_headers", |
| 242 | "libutils_headers", |
Suren Baghdasaryan | 1bd127b | 2019-01-25 05:30:52 +0000 | [diff] [blame] | 243 | "libprocessgroup_headers", |
Steven Moreland | d73be1b | 2017-04-13 23:48:57 -0700 | [diff] [blame] | 244 | ], |
Suren Baghdasaryan | 1bd127b | 2019-01-25 05:30:52 +0000 | [diff] [blame] | 245 | export_header_lib_headers: [ |
| 246 | "libcutils_headers", |
| 247 | "libprocessgroup_headers", |
| 248 | ], |
Yifan Hong | b680712 | 2017-07-25 15:24:04 -0700 | [diff] [blame] | 249 | local_include_dirs: ["include"], |
Vijay Venkatraman | 651f838 | 2017-01-25 18:52:17 +0000 | [diff] [blame] | 250 | |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 251 | cflags: [ |
| 252 | "-Werror", |
| 253 | "-Wall", |
| 254 | "-Wextra", |
| 255 | ], |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 256 | } |
| 257 | |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 258 | cc_defaults { |
| 259 | name: "libcutils_test_default", |
Elliott Hughes | 7e42484 | 2019-11-12 20:20:42 -0800 | [diff] [blame] | 260 | srcs: [ |
| 261 | "native_handle_test.cpp", |
S Vasudev Prasad | 100b08a | 2020-05-08 11:45:45 +0530 | [diff] [blame] | 262 | "properties_test.cpp", |
Elliott Hughes | 7e42484 | 2019-11-12 20:20:42 -0800 | [diff] [blame] | 263 | "sockets_test.cpp", |
| 264 | ], |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 265 | |
| 266 | target: { |
| 267 | android: { |
| 268 | srcs: [ |
| 269 | "android_get_control_file_test.cpp", |
| 270 | "android_get_control_socket_test.cpp", |
| 271 | "ashmem_test.cpp", |
| 272 | "fs_config_test.cpp", |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 273 | "multiuser_test.cpp", |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 274 | "sched_policy_test.cpp", |
| 275 | "str_parms_test.cpp", |
| 276 | "trace-dev_test.cpp", |
| 277 | ], |
| 278 | }, |
| 279 | |
| 280 | not_windows: { |
| 281 | srcs: [ |
| 282 | "str_parms_test.cpp", |
| 283 | ], |
| 284 | }, |
| 285 | }, |
| 286 | |
| 287 | cflags: [ |
| 288 | "-Wall", |
| 289 | "-Wextra", |
| 290 | "-Werror", |
| 291 | ], |
| 292 | } |
| 293 | |
| 294 | test_libraries = [ |
| 295 | "libcutils", |
| 296 | "liblog", |
| 297 | "libbase", |
| 298 | "libjsoncpp", |
| 299 | "libprocessgroup", |
Yifan Hong | 53e0deb | 2019-03-22 17:01:08 -0700 | [diff] [blame] | 300 | "libcgrouprc", |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 301 | ] |
| 302 | |
| 303 | cc_test { |
| 304 | name: "libcutils_test", |
| 305 | test_suites: ["device-tests"], |
| 306 | defaults: ["libcutils_test_default"], |
| 307 | host_supported: true, |
| 308 | shared_libs: test_libraries, |
Tom Cherry | e41aded | 2019-11-07 14:06:21 -0800 | [diff] [blame] | 309 | require_root: true, |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 310 | } |
| 311 | |
nelsonli | d83f390 | 2020-01-16 17:20:18 +0800 | [diff] [blame] | 312 | cc_defaults { |
| 313 | name: "libcutils_test_static_defaults", |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 314 | defaults: ["libcutils_test_default"], |
Yifan Hong | 53e0deb | 2019-03-22 17:01:08 -0700 | [diff] [blame] | 315 | static_libs: [ |
| 316 | "libc", |
| 317 | "libcgrouprc_format", |
| 318 | ] + test_libraries, |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 319 | stl: "libc++_static", |
Tom Cherry | e41aded | 2019-11-07 14:06:21 -0800 | [diff] [blame] | 320 | require_root: true, |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 321 | |
| 322 | target: { |
| 323 | android: { |
| 324 | static_executable: true, |
| 325 | }, |
| 326 | windows: { |
| 327 | host_ldlibs: ["-lws2_32"], |
| 328 | |
| 329 | enabled: true, |
| 330 | }, |
| 331 | }, |
| 332 | } |
nelsonli | d83f390 | 2020-01-16 17:20:18 +0800 | [diff] [blame] | 333 | |
| 334 | cc_test { |
| 335 | name: "libcutils_test_static", |
| 336 | test_suites: ["device-tests"], |
| 337 | defaults: ["libcutils_test_static_defaults"], |
| 338 | } |
| 339 | |
| 340 | cc_test { |
| 341 | name: "KernelLibcutilsTest", |
Dan Shi | a7b9a2b | 2020-04-06 16:11:29 -0700 | [diff] [blame] | 342 | test_suites: ["general-tests", "vts"], |
nelsonli | d83f390 | 2020-01-16 17:20:18 +0800 | [diff] [blame] | 343 | defaults: ["libcutils_test_static_defaults"], |
| 344 | test_config: "KernelLibcutilsTest.xml", |
| 345 | } |