blob: cf809f1b08e63608b116510eb56c93813a50fa2e [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
Tom Cherry167fbf52020-09-17 09:39:24 -070017filegroup {
18 name: "android_filesystem_config_header",
19 srcs: ["include/private/android_filesystem_config.h"],
20}
21
Dan Willemseneee8e7f2016-06-06 22:31:58 -070022// some files must not be compiled when building against Mingw
23// they correspond to features not used by our host development tools
24// which are also hard or even impossible to port to native Win32
25libcutils_nonwindows_sources = [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -080026 "fs.cpp",
Elliott Hughes9d127252018-07-13 10:54:49 -070027 "hashmap.cpp",
Jeff Sharkey53d37ba2017-11-09 17:41:09 -070028 "multiuser.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -080029 "str_parms.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -070030]
31
Vijay Venkatraman651f8382017-01-25 18:52:17 +000032cc_library_headers {
Vijay Venkatraman651f8382017-01-25 18:52:17 +000033 name: "libcutils_headers",
Steven Moreland385fe692017-04-13 14:29:58 -070034 vendor_available: true,
Justin Yunfeef4d32020-11-11 19:17:40 +090035 product_available: true,
Jiyong Park612210c2018-04-27 21:48:43 +090036 recovery_available: true,
Tom Cherrya5edc0f2020-09-17 09:38:42 -070037 ramdisk_available: true,
Yifan Hong55015ff2020-10-27 16:37:06 -070038 vendor_ramdisk_available: true,
Vijay Venkatraman651f8382017-01-25 18:52:17 +000039 host_supported: true,
Jiyong Park8bf9b162020-03-07 16:36:09 +090040 apex_available: [
41 "//apex_available:platform",
42 "//apex_available:anyapex",
43 ],
Jooyung Han88f00f22020-04-16 18:48:33 +090044 min_sdk_version: "29",
dimitry051d5cb2019-05-16 14:17:00 +020045 native_bridge_supported: true,
Vijay Venkatraman651f8382017-01-25 18:52:17 +000046 export_include_dirs: ["include"],
47 target: {
Steven Moreland385fe692017-04-13 14:29:58 -070048 vendor: {
Justin Yunfeef4d32020-11-11 19:17:40 +090049 override_export_include_dirs: ["include_outside_system"],
50 },
51 product: {
52 override_export_include_dirs: ["include_outside_system"],
Steven Moreland385fe692017-04-13 14:29:58 -070053 },
Dan Willemsene0cd1e02017-03-15 15:23:36 -070054 linux_bionic: {
55 enabled: true,
56 },
57 windows: {
58 enabled: true,
59 },
Vijay Venkatraman651f8382017-01-25 18:52:17 +000060 },
61}
62
Josh Gaoa9b62d52020-02-19 13:50:57 -080063// Socket specific parts of libcutils that are safe to statically link into an APEX.
Josh Gao7f8a37c2020-03-09 15:20:55 -070064cc_library {
Josh Gaoa9b62d52020-02-19 13:50:57 -080065 name: "libcutils_sockets",
66 vendor_available: true,
Justin Yunfeef4d32020-11-11 19:17:40 +090067 product_available: true,
Josh Gaoa9b62d52020-02-19 13:50:57 -080068 recovery_available: true,
Akilesh Kailashdfb1e082020-09-30 01:34:42 +000069 ramdisk_available: true,
Yifan Hong55015ff2020-10-27 16:37:06 -070070 vendor_ramdisk_available: true,
Josh Gaoa9b62d52020-02-19 13:50:57 -080071 host_supported: true,
72 native_bridge_supported: true,
73 apex_available: [
74 "//apex_available:platform",
75 "//apex_available:anyapex",
76 ],
Jooyung Han88f00f22020-04-16 18:48:33 +090077 min_sdk_version: "29",
Josh Gaoa9b62d52020-02-19 13:50:57 -080078
79 export_include_dirs: ["include"],
80
Josh Gao7f8a37c2020-03-09 15:20:55 -070081 shared_libs: ["liblog"],
Josh Gaoa9b62d52020-02-19 13:50:57 -080082 srcs: ["sockets.cpp"],
83 target: {
84 linux_bionic: {
85 enabled: true,
86 },
87
88 not_windows: {
89 srcs: [
90 "socket_inaddr_any_server_unix.cpp",
91 "socket_local_client_unix.cpp",
92 "socket_local_server_unix.cpp",
93 "socket_network_client_unix.cpp",
94 "sockets_unix.cpp",
95 ],
96 },
97
98 // "not_windows" means "non-Windows host".
99 android: {
100 srcs: [
101 "android_get_control_file.cpp",
102 "socket_inaddr_any_server_unix.cpp",
103 "socket_local_client_unix.cpp",
104 "socket_local_server_unix.cpp",
105 "socket_network_client_unix.cpp",
106 "sockets_unix.cpp",
107 ],
108 static_libs: ["libbase"],
109 },
110
111 windows: {
112 host_ldlibs: ["-lws2_32"],
113 srcs: [
114 "socket_inaddr_any_server_windows.cpp",
115 "socket_network_client_windows.cpp",
116 "sockets_windows.cpp",
117 ],
118
119 enabled: true,
120 cflags: [
121 "-D_GNU_SOURCE",
122 ],
123 },
124 },
125}
126
127cc_test {
128 name: "libcutils_sockets_test",
129 test_suites: ["device-tests"],
130 static_libs: ["libbase", "libcutils_sockets"],
131 cflags: [
132 "-Wall",
133 "-Wextra",
134 "-Werror",
135 ],
136
137 srcs: ["sockets_test.cpp"],
138 target: {
139 android: {
140 srcs: [
141 "android_get_control_file_test.cpp",
142 "android_get_control_socket_test.cpp",
143 ],
144 },
145 },
146}
147
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700148cc_library {
149 name: "libcutils",
Steven Moreland385fe692017-04-13 14:29:58 -0700150 vendor_available: true,
Justin Yunfeef4d32020-11-11 19:17:40 +0900151 product_available: true,
Justin Yun9ca92452017-07-31 15:41:10 +0900152 vndk: {
153 enabled: true,
154 support_system_process: true,
155 },
Jiyong Park612210c2018-04-27 21:48:43 +0900156 recovery_available: true,
Yifan Hong55015ff2020-10-27 16:37:06 -0700157 vendor_ramdisk_available: true,
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700158 host_supported: true,
Jiyong Park8bf9b162020-03-07 16:36:09 +0900159 apex_available: [
160 "//apex_available:platform",
161 "//apex_available:anyapex",
162 ],
Jooyung Han88f00f22020-04-16 18:48:33 +0900163 min_sdk_version: "29",
dimitry051d5cb2019-05-16 14:17:00 +0200164 native_bridge_supported: true,
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700165 srcs: [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800166 "config_utils.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800167 "canned_fs_config.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800168 "iosched_policy.cpp",
169 "load_file.cpp",
Steven Morelandd22659b2020-10-05 23:20:11 +0000170 "memory.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800171 "native_handle.cpp",
S Vasudev Prasad100b08a2020-05-08 11:45:45 +0530172 "properties.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800173 "record_stream.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700174 "strlcpy.c",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800175 "threads.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700176 ],
177
178 target: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -0700179 linux_bionic: {
180 enabled: true,
Dan Willemsene0cd1e02017-03-15 15:23:36 -0700181 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700182 not_windows: {
183 srcs: libcutils_nonwindows_sources + [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800184 "ashmem-host.cpp",
Jiyong Parka2159c42019-02-03 00:34:29 +0900185 "fs_config.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800186 "trace-host.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700187 ],
188 },
189 windows: {
Steven Morelande6132be2019-03-25 20:38:56 -0700190 host_ldlibs: ["-lws2_32"],
191
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700192 srcs: [
David Sehreb2dd202018-12-20 12:59:36 -0800193 "trace-host.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700194 ],
195
196 enabled: true,
Mark Salyzyn163ecc62017-05-02 08:56:15 -0700197 cflags: [
198 "-D_GNU_SOURCE",
199 ],
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700200 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700201 android: {
202 srcs: libcutils_nonwindows_sources + [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800203 "android_reboot.cpp",
204 "ashmem-dev.cpp",
Jiyong Parka2159c42019-02-03 00:34:29 +0900205 "fs_config.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700206 "klog.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800207 "partition_utils.cpp",
Chenbo Fengbaede732017-10-25 12:31:43 -0700208 "qtaguid.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800209 "trace-dev.cpp",
Luis Hector Chaveze97a4b92017-11-02 14:17:43 -0700210 "uevent.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700211 ],
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700212 },
Steven Morelandd22659b2020-10-05 23:20:11 +0000213 bionic: {
214 header_libs: ["bionic_libc_platform_headers"],
215 },
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700216
217 android_arm: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700218 sanitize: {
219 misc_undefined: ["integer"],
220 },
221 },
222 android_arm64: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700223 sanitize: {
224 misc_undefined: ["integer"],
225 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700226 },
227
228 android_x86: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700229 // TODO: This is to work around b/29412086.
230 // Remove once __mulodi4 is available and move the "sanitize" block
231 // to the android target.
232 sanitize: {
233 misc_undefined: [],
234 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700235 },
236
237 android_x86_64: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700238 sanitize: {
239 misc_undefined: ["integer"],
240 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700241 },
Logan Chien25b742c2018-05-08 17:37:29 +0800242
Justin Yunfeef4d32020-11-11 19:17:40 +0900243 // qtaguid.cpp loads libnetd_client.so with dlopen(). Since
244 // the interface of libnetd_client.so may vary between AOSP
245 // releases, exclude qtaguid.cpp from the VNDK-SP variant.
Logan Chien25b742c2018-05-08 17:37:29 +0800246 vendor: {
247 exclude_srcs: [
Logan Chien25b742c2018-05-08 17:37:29 +0800248 "qtaguid.cpp",
249 ],
Justin Yunfeef4d32020-11-11 19:17:40 +0900250 },
251 product: {
252 exclude_srcs: [
253 "qtaguid.cpp",
254 ],
255 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700256 },
257
Josh Gaoa9b62d52020-02-19 13:50:57 -0800258 whole_static_libs: ["libcutils_sockets"],
Joel Fernandes51944042018-12-18 13:32:31 -0800259 shared_libs: [
260 "liblog",
261 "libbase",
262 ],
Steven Morelandd73be1b2017-04-13 23:48:57 -0700263 header_libs: [
Elliott Hughes9f495082018-04-25 14:52:50 -0700264 "libbase_headers",
Steven Morelandd73be1b2017-04-13 23:48:57 -0700265 "libcutils_headers",
266 "libutils_headers",
Suren Baghdasaryan1bd127b2019-01-25 05:30:52 +0000267 "libprocessgroup_headers",
Steven Morelandd73be1b2017-04-13 23:48:57 -0700268 ],
Suren Baghdasaryan1bd127b2019-01-25 05:30:52 +0000269 export_header_lib_headers: [
270 "libcutils_headers",
271 "libprocessgroup_headers",
272 ],
Yifan Hongb6807122017-07-25 15:24:04 -0700273 local_include_dirs: ["include"],
Vijay Venkatraman651f8382017-01-25 18:52:17 +0000274
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700275 cflags: [
276 "-Werror",
277 "-Wall",
278 "-Wextra",
279 ],
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700280}
281
Elliott Hughes01705e42019-02-07 12:41:37 -0800282cc_defaults {
283 name: "libcutils_test_default",
Elliott Hughes7e424842019-11-12 20:20:42 -0800284 srcs: [
285 "native_handle_test.cpp",
S Vasudev Prasad100b08a2020-05-08 11:45:45 +0530286 "properties_test.cpp",
Elliott Hughes7e424842019-11-12 20:20:42 -0800287 "sockets_test.cpp",
288 ],
Elliott Hughes01705e42019-02-07 12:41:37 -0800289
290 target: {
291 android: {
292 srcs: [
293 "android_get_control_file_test.cpp",
294 "android_get_control_socket_test.cpp",
295 "ashmem_test.cpp",
296 "fs_config_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800297 "multiuser_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800298 "sched_policy_test.cpp",
299 "str_parms_test.cpp",
300 "trace-dev_test.cpp",
301 ],
302 },
303
304 not_windows: {
305 srcs: [
306 "str_parms_test.cpp",
307 ],
308 },
309 },
310
311 cflags: [
312 "-Wall",
313 "-Wextra",
314 "-Werror",
315 ],
316}
317
318test_libraries = [
319 "libcutils",
320 "liblog",
321 "libbase",
322 "libjsoncpp",
323 "libprocessgroup",
Yifan Hong53e0deb2019-03-22 17:01:08 -0700324 "libcgrouprc",
Elliott Hughes01705e42019-02-07 12:41:37 -0800325]
326
327cc_test {
328 name: "libcutils_test",
329 test_suites: ["device-tests"],
330 defaults: ["libcutils_test_default"],
331 host_supported: true,
332 shared_libs: test_libraries,
Tom Cherrye41aded2019-11-07 14:06:21 -0800333 require_root: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800334}
335
nelsonlid83f3902020-01-16 17:20:18 +0800336cc_defaults {
337 name: "libcutils_test_static_defaults",
Elliott Hughes01705e42019-02-07 12:41:37 -0800338 defaults: ["libcutils_test_default"],
Yifan Hong53e0deb2019-03-22 17:01:08 -0700339 static_libs: [
340 "libc",
341 "libcgrouprc_format",
342 ] + test_libraries,
Elliott Hughes01705e42019-02-07 12:41:37 -0800343 stl: "libc++_static",
Tom Cherrye41aded2019-11-07 14:06:21 -0800344 require_root: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800345
346 target: {
347 android: {
348 static_executable: true,
349 },
350 windows: {
351 host_ldlibs: ["-lws2_32"],
352
353 enabled: true,
354 },
355 },
356}
nelsonlid83f3902020-01-16 17:20:18 +0800357
358cc_test {
359 name: "libcutils_test_static",
360 test_suites: ["device-tests"],
361 defaults: ["libcutils_test_static_defaults"],
362}
363
364cc_test {
365 name: "KernelLibcutilsTest",
Dan Shia7b9a2b2020-04-06 16:11:29 -0700366 test_suites: ["general-tests", "vts"],
nelsonlid83f3902020-01-16 17:20:18 +0800367 defaults: ["libcutils_test_static_defaults"],
368 test_config: "KernelLibcutilsTest.xml",
369}