blob: 1bf84b4c60eaf465cc918bfd5d498d2e7ebdf266 [file] [log] [blame]
Dan Willemseneee8e7f2016-06-06 22:31:58 -07001//
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
Bob Badourd69ad692021-02-16 19:02:14 -080017package {
18 default_applicable_licenses: ["system_core_libcutils_license"],
19}
20
21// Added automatically by a large-scale-change that took the approach of
22// 'apply every license found to every target'. While this makes sure we respect
23// every license restriction, it may not be entirely correct.
24//
25// e.g. GPL in an MIT project might only apply to the contrib/ directory.
26//
27// Please consider splitting the single license below into multiple licenses,
28// taking care not to lose any license_kind information, and overriding the
29// default license using the 'licenses: [...]' property on targets as needed.
30//
31// For unused files, consider creating a 'fileGroup' with "//visibility:private"
32// to attach the license to, and including a comment whether the files may be
33// used in the current project.
34// See: http://go/android-license-faq
35license {
36 name: "system_core_libcutils_license",
37 visibility: [":__subpackages__"],
38 license_kinds: [
39 "SPDX-license-identifier-Apache-2.0",
40 "SPDX-license-identifier-BSD",
41 "SPDX-license-identifier-MIT",
42 ],
43 license_text: [
44 "NOTICE",
45 ],
46}
47
Tom Cherry167fbf52020-09-17 09:39:24 -070048filegroup {
49 name: "android_filesystem_config_header",
50 srcs: ["include/private/android_filesystem_config.h"],
51}
52
Dan Willemseneee8e7f2016-06-06 22:31:58 -070053// some files must not be compiled when building against Mingw
54// they correspond to features not used by our host development tools
55// which are also hard or even impossible to port to native Win32
56libcutils_nonwindows_sources = [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -080057 "fs.cpp",
Elliott Hughes9d127252018-07-13 10:54:49 -070058 "hashmap.cpp",
Jeff Sharkey53d37ba2017-11-09 17:41:09 -070059 "multiuser.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -080060 "str_parms.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -070061]
62
Vijay Venkatraman651f8382017-01-25 18:52:17 +000063cc_library_headers {
Vijay Venkatraman651f8382017-01-25 18:52:17 +000064 name: "libcutils_headers",
Steven Moreland385fe692017-04-13 14:29:58 -070065 vendor_available: true,
Justin Yunfeef4d32020-11-11 19:17:40 +090066 product_available: true,
Jiyong Park612210c2018-04-27 21:48:43 +090067 recovery_available: true,
Tom Cherrya5edc0f2020-09-17 09:38:42 -070068 ramdisk_available: true,
Yifan Hong55015ff2020-10-27 16:37:06 -070069 vendor_ramdisk_available: true,
Vijay Venkatraman651f8382017-01-25 18:52:17 +000070 host_supported: true,
Jiyong Park8bf9b162020-03-07 16:36:09 +090071 apex_available: [
72 "//apex_available:platform",
73 "//apex_available:anyapex",
74 ],
Jooyung Han88f00f22020-04-16 18:48:33 +090075 min_sdk_version: "29",
dimitry051d5cb2019-05-16 14:17:00 +020076 native_bridge_supported: true,
Vijay Venkatraman651f8382017-01-25 18:52:17 +000077 export_include_dirs: ["include"],
78 target: {
Steven Moreland385fe692017-04-13 14:29:58 -070079 vendor: {
Justin Yunfeef4d32020-11-11 19:17:40 +090080 override_export_include_dirs: ["include_outside_system"],
81 },
82 product: {
83 override_export_include_dirs: ["include_outside_system"],
Steven Moreland385fe692017-04-13 14:29:58 -070084 },
Dan Willemsene0cd1e02017-03-15 15:23:36 -070085 linux_bionic: {
86 enabled: true,
87 },
88 windows: {
89 enabled: true,
90 },
Vijay Venkatraman651f8382017-01-25 18:52:17 +000091 },
92}
93
Josh Gaoa9b62d52020-02-19 13:50:57 -080094// Socket specific parts of libcutils that are safe to statically link into an APEX.
Josh Gao7f8a37c2020-03-09 15:20:55 -070095cc_library {
Josh Gaoa9b62d52020-02-19 13:50:57 -080096 name: "libcutils_sockets",
97 vendor_available: true,
Justin Yunfeef4d32020-11-11 19:17:40 +090098 product_available: true,
Josh Gaoa9b62d52020-02-19 13:50:57 -080099 recovery_available: true,
Akilesh Kailashdfb1e082020-09-30 01:34:42 +0000100 ramdisk_available: true,
Yifan Hong55015ff2020-10-27 16:37:06 -0700101 vendor_ramdisk_available: true,
Josh Gaoa9b62d52020-02-19 13:50:57 -0800102 host_supported: true,
103 native_bridge_supported: true,
104 apex_available: [
105 "//apex_available:platform",
106 "//apex_available:anyapex",
107 ],
Jooyung Han88f00f22020-04-16 18:48:33 +0900108 min_sdk_version: "29",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800109
110 export_include_dirs: ["include"],
111
Josh Gao7f8a37c2020-03-09 15:20:55 -0700112 shared_libs: ["liblog"],
Josh Gaoa9b62d52020-02-19 13:50:57 -0800113 srcs: ["sockets.cpp"],
114 target: {
115 linux_bionic: {
116 enabled: true,
117 },
118
119 not_windows: {
120 srcs: [
121 "socket_inaddr_any_server_unix.cpp",
122 "socket_local_client_unix.cpp",
123 "socket_local_server_unix.cpp",
124 "socket_network_client_unix.cpp",
125 "sockets_unix.cpp",
126 ],
127 },
128
129 // "not_windows" means "non-Windows host".
130 android: {
131 srcs: [
132 "android_get_control_file.cpp",
133 "socket_inaddr_any_server_unix.cpp",
134 "socket_local_client_unix.cpp",
135 "socket_local_server_unix.cpp",
136 "socket_network_client_unix.cpp",
137 "sockets_unix.cpp",
138 ],
139 static_libs: ["libbase"],
140 },
141
142 windows: {
143 host_ldlibs: ["-lws2_32"],
144 srcs: [
145 "socket_inaddr_any_server_windows.cpp",
146 "socket_network_client_windows.cpp",
147 "sockets_windows.cpp",
148 ],
149
150 enabled: true,
151 cflags: [
152 "-D_GNU_SOURCE",
153 ],
154 },
155 },
156}
157
158cc_test {
159 name: "libcutils_sockets_test",
160 test_suites: ["device-tests"],
161 static_libs: ["libbase", "libcutils_sockets"],
162 cflags: [
163 "-Wall",
164 "-Wextra",
165 "-Werror",
166 ],
167
168 srcs: ["sockets_test.cpp"],
169 target: {
170 android: {
171 srcs: [
172 "android_get_control_file_test.cpp",
173 "android_get_control_socket_test.cpp",
174 ],
175 },
176 },
177}
178
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700179cc_library {
180 name: "libcutils",
Steven Moreland385fe692017-04-13 14:29:58 -0700181 vendor_available: true,
Justin Yunfeef4d32020-11-11 19:17:40 +0900182 product_available: true,
Justin Yun9ca92452017-07-31 15:41:10 +0900183 vndk: {
184 enabled: true,
185 support_system_process: true,
186 },
Jiyong Park612210c2018-04-27 21:48:43 +0900187 recovery_available: true,
Yifan Hong55015ff2020-10-27 16:37:06 -0700188 vendor_ramdisk_available: true,
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700189 host_supported: true,
Jiyong Park8bf9b162020-03-07 16:36:09 +0900190 apex_available: [
191 "//apex_available:platform",
192 "//apex_available:anyapex",
193 ],
Jooyung Han88f00f22020-04-16 18:48:33 +0900194 min_sdk_version: "29",
dimitry051d5cb2019-05-16 14:17:00 +0200195 native_bridge_supported: true,
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700196 srcs: [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800197 "config_utils.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800198 "canned_fs_config.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800199 "iosched_policy.cpp",
200 "load_file.cpp",
201 "native_handle.cpp",
S Vasudev Prasad100b08a2020-05-08 11:45:45 +0530202 "properties.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800203 "record_stream.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700204 "strlcpy.c",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800205 "threads.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700206 ],
207
208 target: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -0700209 linux_bionic: {
210 enabled: true,
Dan Willemsene0cd1e02017-03-15 15:23:36 -0700211 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700212 not_windows: {
213 srcs: libcutils_nonwindows_sources + [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800214 "ashmem-host.cpp",
Jiyong Parka2159c42019-02-03 00:34:29 +0900215 "fs_config.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800216 "trace-host.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700217 ],
218 },
219 windows: {
Steven Morelande6132be2019-03-25 20:38:56 -0700220 host_ldlibs: ["-lws2_32"],
221
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700222 srcs: [
David Sehreb2dd202018-12-20 12:59:36 -0800223 "trace-host.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700224 ],
225
226 enabled: true,
Mark Salyzyn163ecc62017-05-02 08:56:15 -0700227 cflags: [
228 "-D_GNU_SOURCE",
229 ],
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700230 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700231 android: {
232 srcs: libcutils_nonwindows_sources + [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800233 "android_reboot.cpp",
234 "ashmem-dev.cpp",
Jiyong Parka2159c42019-02-03 00:34:29 +0900235 "fs_config.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700236 "klog.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800237 "partition_utils.cpp",
Chenbo Fengbaede732017-10-25 12:31:43 -0700238 "qtaguid.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800239 "trace-dev.cpp",
Luis Hector Chaveze97a4b92017-11-02 14:17:43 -0700240 "uevent.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700241 ],
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700242 },
243
244 android_arm: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700245 sanitize: {
246 misc_undefined: ["integer"],
247 },
248 },
249 android_arm64: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700250 sanitize: {
251 misc_undefined: ["integer"],
252 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700253 },
254
255 android_x86: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700256 // TODO: This is to work around b/29412086.
257 // Remove once __mulodi4 is available and move the "sanitize" block
258 // to the android target.
259 sanitize: {
260 misc_undefined: [],
261 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700262 },
263
264 android_x86_64: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700265 sanitize: {
266 misc_undefined: ["integer"],
267 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700268 },
Logan Chien25b742c2018-05-08 17:37:29 +0800269
Justin Yunfeef4d32020-11-11 19:17:40 +0900270 // qtaguid.cpp loads libnetd_client.so with dlopen(). Since
271 // the interface of libnetd_client.so may vary between AOSP
272 // releases, exclude qtaguid.cpp from the VNDK-SP variant.
Logan Chien25b742c2018-05-08 17:37:29 +0800273 vendor: {
274 exclude_srcs: [
Logan Chien25b742c2018-05-08 17:37:29 +0800275 "qtaguid.cpp",
276 ],
Justin Yunfeef4d32020-11-11 19:17:40 +0900277 },
278 product: {
279 exclude_srcs: [
280 "qtaguid.cpp",
281 ],
282 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700283 },
284
Josh Gaoa9b62d52020-02-19 13:50:57 -0800285 whole_static_libs: ["libcutils_sockets"],
Joel Fernandes51944042018-12-18 13:32:31 -0800286 shared_libs: [
287 "liblog",
288 "libbase",
289 ],
Steven Morelandd73be1b2017-04-13 23:48:57 -0700290 header_libs: [
Elliott Hughes9f495082018-04-25 14:52:50 -0700291 "libbase_headers",
Steven Morelandd73be1b2017-04-13 23:48:57 -0700292 "libcutils_headers",
293 "libutils_headers",
Suren Baghdasaryan1bd127b2019-01-25 05:30:52 +0000294 "libprocessgroup_headers",
Steven Morelandd73be1b2017-04-13 23:48:57 -0700295 ],
Suren Baghdasaryan1bd127b2019-01-25 05:30:52 +0000296 export_header_lib_headers: [
297 "libcutils_headers",
298 "libprocessgroup_headers",
299 ],
Yifan Hongb6807122017-07-25 15:24:04 -0700300 local_include_dirs: ["include"],
Vijay Venkatraman651f8382017-01-25 18:52:17 +0000301
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700302 cflags: [
303 "-Werror",
304 "-Wall",
305 "-Wextra",
306 ],
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700307}
308
Elliott Hughes01705e42019-02-07 12:41:37 -0800309cc_defaults {
310 name: "libcutils_test_default",
Elliott Hughes7e424842019-11-12 20:20:42 -0800311 srcs: [
312 "native_handle_test.cpp",
S Vasudev Prasad100b08a2020-05-08 11:45:45 +0530313 "properties_test.cpp",
Elliott Hughes7e424842019-11-12 20:20:42 -0800314 "sockets_test.cpp",
315 ],
Elliott Hughes01705e42019-02-07 12:41:37 -0800316
317 target: {
318 android: {
319 srcs: [
320 "android_get_control_file_test.cpp",
321 "android_get_control_socket_test.cpp",
322 "ashmem_test.cpp",
323 "fs_config_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800324 "multiuser_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800325 "sched_policy_test.cpp",
326 "str_parms_test.cpp",
327 "trace-dev_test.cpp",
328 ],
329 },
330
331 not_windows: {
332 srcs: [
333 "str_parms_test.cpp",
334 ],
335 },
336 },
337
338 cflags: [
339 "-Wall",
340 "-Wextra",
341 "-Werror",
342 ],
343}
344
345test_libraries = [
346 "libcutils",
347 "liblog",
348 "libbase",
349 "libjsoncpp",
350 "libprocessgroup",
Yifan Hong53e0deb2019-03-22 17:01:08 -0700351 "libcgrouprc",
Elliott Hughes01705e42019-02-07 12:41:37 -0800352]
353
354cc_test {
355 name: "libcutils_test",
356 test_suites: ["device-tests"],
357 defaults: ["libcutils_test_default"],
358 host_supported: true,
359 shared_libs: test_libraries,
Tom Cherrye41aded2019-11-07 14:06:21 -0800360 require_root: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800361}
362
nelsonlid83f3902020-01-16 17:20:18 +0800363cc_defaults {
364 name: "libcutils_test_static_defaults",
Elliott Hughes01705e42019-02-07 12:41:37 -0800365 defaults: ["libcutils_test_default"],
Yifan Hong53e0deb2019-03-22 17:01:08 -0700366 static_libs: [
367 "libc",
368 "libcgrouprc_format",
369 ] + test_libraries,
Elliott Hughes01705e42019-02-07 12:41:37 -0800370 stl: "libc++_static",
Tom Cherrye41aded2019-11-07 14:06:21 -0800371 require_root: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800372
373 target: {
374 android: {
375 static_executable: true,
376 },
377 windows: {
378 host_ldlibs: ["-lws2_32"],
379
380 enabled: true,
381 },
382 },
383}
nelsonlid83f3902020-01-16 17:20:18 +0800384
385cc_test {
386 name: "libcutils_test_static",
387 test_suites: ["device-tests"],
388 defaults: ["libcutils_test_static_defaults"],
389}
390
391cc_test {
392 name: "KernelLibcutilsTest",
Dan Shia7b9a2b2020-04-06 16:11:29 -0700393 test_suites: ["general-tests", "vts"],
nelsonlid83f3902020-01-16 17:20:18 +0800394 defaults: ["libcutils_test_static_defaults"],
395 test_config: "KernelLibcutilsTest.xml",
396}