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