Bob Badour | d69ad69 | 2021-02-16 19:02:14 -0800 | [diff] [blame] | 1 | package { |
| 2 | default_applicable_licenses: ["system_core_libcutils_license"], |
| 3 | } |
| 4 | |
Bob Badour | d69ad69 | 2021-02-16 19:02:14 -0800 | [diff] [blame] | 5 | license { |
| 6 | name: "system_core_libcutils_license", |
| 7 | visibility: [":__subpackages__"], |
| 8 | license_kinds: [ |
| 9 | "SPDX-license-identifier-Apache-2.0", |
| 10 | "SPDX-license-identifier-BSD", |
Elliott Hughes | 527d71f | 2021-03-04 09:18:19 -0800 | [diff] [blame] | 11 | "SPDX-license-identifier-MIT", // strlcpy.c |
Bob Badour | d69ad69 | 2021-02-16 19:02:14 -0800 | [diff] [blame] | 12 | ], |
| 13 | license_text: [ |
| 14 | "NOTICE", |
| 15 | ], |
| 16 | } |
| 17 | |
Tom Cherry | 167fbf5 | 2020-09-17 09:39:24 -0700 | [diff] [blame] | 18 | filegroup { |
| 19 | name: "android_filesystem_config_header", |
| 20 | srcs: ["include/private/android_filesystem_config.h"], |
| 21 | } |
| 22 | |
Elliott Hughes | 527d71f | 2021-03-04 09:18:19 -0800 | [diff] [blame] | 23 | cc_defaults { |
| 24 | name: "libcutils_defaults", |
| 25 | cflags: [ |
| 26 | "-Wno-exit-time-destructors", |
| 27 | ], |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 28 | |
Justin Yun | feef4d3 | 2020-11-11 19:17:40 +0900 | [diff] [blame] | 29 | product_available: true, |
Tom Cherry | a5edc0f | 2020-09-17 09:38:42 -0700 | [diff] [blame] | 30 | ramdisk_available: true, |
Elliott Hughes | 527d71f | 2021-03-04 09:18:19 -0800 | [diff] [blame] | 31 | recovery_available: true, |
| 32 | vendor_available: true, |
Yifan Hong | 55015ff | 2020-10-27 16:37:06 -0700 | [diff] [blame] | 33 | vendor_ramdisk_available: true, |
Elliott Hughes | 527d71f | 2021-03-04 09:18:19 -0800 | [diff] [blame] | 34 | |
Vijay Venkatraman | 651f838 | 2017-01-25 18:52:17 +0000 | [diff] [blame] | 35 | host_supported: true, |
Elliott Hughes | 527d71f | 2021-03-04 09:18:19 -0800 | [diff] [blame] | 36 | native_bridge_supported: true, |
| 37 | |
Jiyong Park | 8bf9b16 | 2020-03-07 16:36:09 +0900 | [diff] [blame] | 38 | apex_available: [ |
| 39 | "//apex_available:platform", |
| 40 | "//apex_available:anyapex", |
| 41 | ], |
Jooyung Han | 88f00f2 | 2020-04-16 18:48:33 +0900 | [diff] [blame] | 42 | min_sdk_version: "29", |
Elliott Hughes | 527d71f | 2021-03-04 09:18:19 -0800 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | cc_library_headers { |
| 46 | name: "libcutils_headers", |
| 47 | defaults: ["libcutils_defaults"], |
| 48 | |
Vijay Venkatraman | 651f838 | 2017-01-25 18:52:17 +0000 | [diff] [blame] | 49 | export_include_dirs: ["include"], |
T.J. Mercier | 1fd7993 | 2024-06-21 22:17:12 +0000 | [diff] [blame] | 50 | header_libs: ["libprocessgroup_headers"], |
| 51 | export_header_lib_headers: ["libprocessgroup_headers"], |
Vijay Venkatraman | 651f838 | 2017-01-25 18:52:17 +0000 | [diff] [blame] | 52 | target: { |
Steven Moreland | 385fe69 | 2017-04-13 14:29:58 -0700 | [diff] [blame] | 53 | vendor: { |
Justin Yun | feef4d3 | 2020-11-11 19:17:40 +0900 | [diff] [blame] | 54 | override_export_include_dirs: ["include_outside_system"], |
| 55 | }, |
| 56 | product: { |
| 57 | override_export_include_dirs: ["include_outside_system"], |
Steven Moreland | 385fe69 | 2017-04-13 14:29:58 -0700 | [diff] [blame] | 58 | }, |
Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 59 | linux_bionic: { |
| 60 | enabled: true, |
| 61 | }, |
| 62 | windows: { |
| 63 | enabled: true, |
| 64 | }, |
Vijay Venkatraman | 651f838 | 2017-01-25 18:52:17 +0000 | [diff] [blame] | 65 | }, |
| 66 | } |
| 67 | |
Josh Gao | a9b62d5 | 2020-02-19 13:50:57 -0800 | [diff] [blame] | 68 | // 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] | 69 | cc_library { |
Josh Gao | a9b62d5 | 2020-02-19 13:50:57 -0800 | [diff] [blame] | 70 | name: "libcutils_sockets", |
Elliott Hughes | 527d71f | 2021-03-04 09:18:19 -0800 | [diff] [blame] | 71 | defaults: ["libcutils_defaults"], |
Josh Gao | a9b62d5 | 2020-02-19 13:50:57 -0800 | [diff] [blame] | 72 | |
| 73 | export_include_dirs: ["include"], |
| 74 | |
Josh Gao | 7f8a37c | 2020-03-09 15:20:55 -0700 | [diff] [blame] | 75 | shared_libs: ["liblog"], |
Josh Gao | a9b62d5 | 2020-02-19 13:50:57 -0800 | [diff] [blame] | 76 | srcs: ["sockets.cpp"], |
| 77 | target: { |
| 78 | linux_bionic: { |
| 79 | enabled: true, |
| 80 | }, |
| 81 | |
| 82 | not_windows: { |
| 83 | srcs: [ |
| 84 | "socket_inaddr_any_server_unix.cpp", |
| 85 | "socket_local_client_unix.cpp", |
| 86 | "socket_local_server_unix.cpp", |
| 87 | "socket_network_client_unix.cpp", |
| 88 | "sockets_unix.cpp", |
| 89 | ], |
| 90 | }, |
| 91 | |
| 92 | // "not_windows" means "non-Windows host". |
| 93 | android: { |
| 94 | srcs: [ |
| 95 | "android_get_control_file.cpp", |
| 96 | "socket_inaddr_any_server_unix.cpp", |
| 97 | "socket_local_client_unix.cpp", |
| 98 | "socket_local_server_unix.cpp", |
| 99 | "socket_network_client_unix.cpp", |
| 100 | "sockets_unix.cpp", |
| 101 | ], |
| 102 | static_libs: ["libbase"], |
| 103 | }, |
| 104 | |
| 105 | windows: { |
| 106 | host_ldlibs: ["-lws2_32"], |
| 107 | srcs: [ |
| 108 | "socket_inaddr_any_server_windows.cpp", |
| 109 | "socket_network_client_windows.cpp", |
| 110 | "sockets_windows.cpp", |
| 111 | ], |
| 112 | |
| 113 | enabled: true, |
| 114 | cflags: [ |
| 115 | "-D_GNU_SOURCE", |
| 116 | ], |
| 117 | }, |
| 118 | }, |
| 119 | } |
| 120 | |
Elliott Hughes | 527d71f | 2021-03-04 09:18:19 -0800 | [diff] [blame] | 121 | // some files must not be compiled when building against Mingw |
| 122 | // they correspond to features not used by our host development tools |
| 123 | // which are also hard or even impossible to port to native Win32 |
| 124 | libcutils_nonwindows_sources = [ |
| 125 | "fs.cpp", |
| 126 | "hashmap.cpp", |
| 127 | "multiuser.cpp", |
| 128 | "str_parms.cpp", |
| 129 | ] |
| 130 | |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 131 | cc_library { |
| 132 | name: "libcutils", |
Elliott Hughes | 527d71f | 2021-03-04 09:18:19 -0800 | [diff] [blame] | 133 | defaults: ["libcutils_defaults"], |
Kiyoung Kim | ad8cf52 | 2024-03-11 13:04:38 +0900 | [diff] [blame] | 134 | double_loadable: true, |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 135 | srcs: [ |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 136 | "config_utils.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 137 | "iosched_policy.cpp", |
| 138 | "load_file.cpp", |
| 139 | "native_handle.cpp", |
S Vasudev Prasad | 100b08a | 2020-05-08 11:45:45 +0530 | [diff] [blame] | 140 | "properties.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 141 | "record_stream.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 142 | "strlcpy.c", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 143 | ], |
| 144 | |
| 145 | target: { |
Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 146 | linux_bionic: { |
| 147 | enabled: true, |
Brian Duddie | 9f2af69 | 2022-08-24 19:52:08 +0000 | [diff] [blame] | 148 | static_libs: [ |
| 149 | "libasync_safe", |
| 150 | ], |
Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 151 | }, |
Elliott Hughes | 94ccdc0 | 2023-09-22 18:44:28 +0000 | [diff] [blame] | 152 | linux: { |
| 153 | srcs: [ |
| 154 | "canned_fs_config.cpp", |
| 155 | "fs_config.cpp", |
| 156 | ], |
| 157 | }, |
Michael Hoisie | 7c4beee | 2024-01-12 19:18:19 +0000 | [diff] [blame] | 158 | host: { |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 159 | srcs: [ |
David Sehr | eb2dd20 | 2018-12-20 12:59:36 -0800 | [diff] [blame] | 160 | "trace-host.cpp", |
Michael Hoisie | 7c4beee | 2024-01-12 19:18:19 +0000 | [diff] [blame] | 161 | "ashmem-host.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 162 | ], |
Michael Hoisie | 7c4beee | 2024-01-12 19:18:19 +0000 | [diff] [blame] | 163 | }, |
| 164 | not_windows: { |
| 165 | srcs: libcutils_nonwindows_sources, |
| 166 | }, |
| 167 | windows: { |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 168 | enabled: true, |
Michael Hoisie | 7c4beee | 2024-01-12 19:18:19 +0000 | [diff] [blame] | 169 | host_ldlibs: ["-lws2_32"], |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 170 | }, |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 171 | android: { |
Elliott Hughes | 06a839f | 2022-10-18 16:31:04 +0000 | [diff] [blame] | 172 | sanitize: { |
| 173 | misc_undefined: ["integer"], |
| 174 | }, |
Brian Duddie | 9f2af69 | 2022-08-24 19:52:08 +0000 | [diff] [blame] | 175 | static_libs: [ |
| 176 | "libasync_safe", |
| 177 | ], |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 178 | srcs: libcutils_nonwindows_sources + [ |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 179 | "android_reboot.cpp", |
| 180 | "ashmem-dev.cpp", |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 181 | "klog.cpp", |
Elliott Hughes | 8e9aeb9 | 2017-11-10 10:22:07 -0800 | [diff] [blame] | 182 | "partition_utils.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 | |
Justin Yun | feef4d3 | 2020-11-11 19:17:40 +0900 | [diff] [blame] | 189 | // qtaguid.cpp loads libnetd_client.so with dlopen(). Since |
| 190 | // the interface of libnetd_client.so may vary between AOSP |
| 191 | // releases, exclude qtaguid.cpp from the VNDK-SP variant. |
Logan Chien | 25b742c | 2018-05-08 17:37:29 +0800 | [diff] [blame] | 192 | vendor: { |
| 193 | exclude_srcs: [ |
Logan Chien | 25b742c | 2018-05-08 17:37:29 +0800 | [diff] [blame] | 194 | "qtaguid.cpp", |
| 195 | ], |
Kiyoung Kim | a4648c2 | 2023-06-23 11:12:38 +0900 | [diff] [blame] | 196 | header_abi_checker: { |
| 197 | enabled: true, |
| 198 | ref_dump_dirs: ["abi-dumps"], |
| 199 | }, |
Justin Yun | feef4d3 | 2020-11-11 19:17:40 +0900 | [diff] [blame] | 200 | }, |
| 201 | product: { |
| 202 | exclude_srcs: [ |
| 203 | "qtaguid.cpp", |
| 204 | ], |
Kiyoung Kim | a4648c2 | 2023-06-23 11:12:38 +0900 | [diff] [blame] | 205 | header_abi_checker: { |
| 206 | enabled: true, |
| 207 | ref_dump_dirs: ["abi-dumps"], |
| 208 | }, |
Justin Yun | feef4d3 | 2020-11-11 19:17:40 +0900 | [diff] [blame] | 209 | }, |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 210 | }, |
| 211 | |
Josh Gao | a9b62d5 | 2020-02-19 13:50:57 -0800 | [diff] [blame] | 212 | whole_static_libs: ["libcutils_sockets"], |
Joel Fernandes | 5194404 | 2018-12-18 13:32:31 -0800 | [diff] [blame] | 213 | shared_libs: [ |
| 214 | "liblog", |
| 215 | "libbase", |
| 216 | ], |
Steven Moreland | d73be1b | 2017-04-13 23:48:57 -0700 | [diff] [blame] | 217 | header_libs: [ |
Elliott Hughes | 9f49508 | 2018-04-25 14:52:50 -0700 | [diff] [blame] | 218 | "libbase_headers", |
Steven Moreland | d73be1b | 2017-04-13 23:48:57 -0700 | [diff] [blame] | 219 | "libcutils_headers", |
Suren Baghdasaryan | 1bd127b | 2019-01-25 05:30:52 +0000 | [diff] [blame] | 220 | "libprocessgroup_headers", |
Steven Moreland | d73be1b | 2017-04-13 23:48:57 -0700 | [diff] [blame] | 221 | ], |
Suren Baghdasaryan | 1bd127b | 2019-01-25 05:30:52 +0000 | [diff] [blame] | 222 | export_header_lib_headers: [ |
| 223 | "libcutils_headers", |
| 224 | "libprocessgroup_headers", |
| 225 | ], |
Yifan Hong | b680712 | 2017-07-25 15:24:04 -0700 | [diff] [blame] | 226 | local_include_dirs: ["include"], |
Vijay Venkatraman | 651f838 | 2017-01-25 18:52:17 +0000 | [diff] [blame] | 227 | |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 228 | cflags: [ |
| 229 | "-Werror", |
| 230 | "-Wall", |
| 231 | "-Wextra", |
| 232 | ], |
Dan Willemsen | eee8e7f | 2016-06-06 22:31:58 -0700 | [diff] [blame] | 233 | } |
| 234 | |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 235 | cc_defaults { |
| 236 | name: "libcutils_test_default", |
Elliott Hughes | 7e42484 | 2019-11-12 20:20:42 -0800 | [diff] [blame] | 237 | srcs: [ |
Michael Hoisie | 7c4beee | 2024-01-12 19:18:19 +0000 | [diff] [blame] | 238 | "ashmem_base_test.cpp", |
Elliott Hughes | 7e42484 | 2019-11-12 20:20:42 -0800 | [diff] [blame] | 239 | "native_handle_test.cpp", |
S Vasudev Prasad | 100b08a | 2020-05-08 11:45:45 +0530 | [diff] [blame] | 240 | "properties_test.cpp", |
Elliott Hughes | 7e42484 | 2019-11-12 20:20:42 -0800 | [diff] [blame] | 241 | "sockets_test.cpp", |
| 242 | ], |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 243 | |
| 244 | target: { |
| 245 | android: { |
| 246 | srcs: [ |
| 247 | "android_get_control_file_test.cpp", |
| 248 | "android_get_control_socket_test.cpp", |
| 249 | "ashmem_test.cpp", |
| 250 | "fs_config_test.cpp", |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 251 | "multiuser_test.cpp", |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 252 | "sched_policy_test.cpp", |
| 253 | "str_parms_test.cpp", |
| 254 | "trace-dev_test.cpp", |
| 255 | ], |
| 256 | }, |
| 257 | |
| 258 | not_windows: { |
| 259 | srcs: [ |
| 260 | "str_parms_test.cpp", |
| 261 | ], |
| 262 | }, |
| 263 | }, |
| 264 | |
| 265 | cflags: [ |
| 266 | "-Wall", |
| 267 | "-Wextra", |
| 268 | "-Werror", |
| 269 | ], |
| 270 | } |
| 271 | |
Steven Moreland | 40b59a6 | 2023-06-06 17:52:39 +0000 | [diff] [blame] | 272 | always_static_test_libraries = [ |
| 273 | "libjsoncpp", |
| 274 | ] |
| 275 | |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 276 | test_libraries = [ |
| 277 | "libcutils", |
| 278 | "liblog", |
| 279 | "libbase", |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 280 | "libprocessgroup", |
Yifan Hong | 53e0deb | 2019-03-22 17:01:08 -0700 | [diff] [blame] | 281 | "libcgrouprc", |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 282 | ] |
| 283 | |
| 284 | cc_test { |
| 285 | name: "libcutils_test", |
| 286 | test_suites: ["device-tests"], |
| 287 | defaults: ["libcutils_test_default"], |
| 288 | host_supported: true, |
| 289 | shared_libs: test_libraries, |
Steven Moreland | 40b59a6 | 2023-06-06 17:52:39 +0000 | [diff] [blame] | 290 | static_libs: always_static_test_libraries, |
Tom Cherry | e41aded | 2019-11-07 14:06:21 -0800 | [diff] [blame] | 291 | require_root: true, |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 292 | } |
| 293 | |
nelsonli | d83f390 | 2020-01-16 17:20:18 +0800 | [diff] [blame] | 294 | cc_defaults { |
| 295 | name: "libcutils_test_static_defaults", |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 296 | defaults: ["libcutils_test_default"], |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 297 | stl: "libc++_static", |
Tom Cherry | e41aded | 2019-11-07 14:06:21 -0800 | [diff] [blame] | 298 | require_root: true, |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 299 | |
| 300 | target: { |
| 301 | android: { |
| 302 | static_executable: true, |
Michael Hoisie | 7c4beee | 2024-01-12 19:18:19 +0000 | [diff] [blame] | 303 | static_libs: [ |
| 304 | "libcgrouprc_format", |
| 305 | ] + test_libraries + always_static_test_libraries, |
| 306 | }, |
| 307 | not_windows: { |
| 308 | static_libs: test_libraries + always_static_test_libraries, |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 309 | }, |
| 310 | windows: { |
Michael Hoisie | 7c4beee | 2024-01-12 19:18:19 +0000 | [diff] [blame] | 311 | static_libs: [ |
| 312 | "libbase", |
| 313 | "libcutils", |
| 314 | "libcutils_sockets", |
| 315 | ], |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 316 | host_ldlibs: ["-lws2_32"], |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 317 | enabled: true, |
| 318 | }, |
| 319 | }, |
| 320 | } |
nelsonli | d83f390 | 2020-01-16 17:20:18 +0800 | [diff] [blame] | 321 | |
| 322 | cc_test { |
| 323 | name: "libcutils_test_static", |
Michael Hoisie | 7c4beee | 2024-01-12 19:18:19 +0000 | [diff] [blame] | 324 | host_supported: true, |
nelsonli | d83f390 | 2020-01-16 17:20:18 +0800 | [diff] [blame] | 325 | test_suites: ["device-tests"], |
| 326 | defaults: ["libcutils_test_static_defaults"], |
| 327 | } |
| 328 | |
| 329 | cc_test { |
| 330 | name: "KernelLibcutilsTest", |
Michael Hoisie | d1e4c26 | 2024-03-06 17:22:45 +0000 | [diff] [blame] | 331 | test_suites: [ |
| 332 | "general-tests", |
| 333 | "vts", |
| 334 | ], |
nelsonli | d83f390 | 2020-01-16 17:20:18 +0800 | [diff] [blame] | 335 | defaults: ["libcutils_test_static_defaults"], |
| 336 | test_config: "KernelLibcutilsTest.xml", |
| 337 | } |