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