blob: 0c75dc725391ddac1ce6ef0ff9246de9a13362e6 [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,
Jiyong Park612210c2018-04-27 21:48:43 +090035 recovery_available: true,
Tom Cherrya5edc0f2020-09-17 09:38:42 -070036 ramdisk_available: true,
Vijay Venkatraman651f8382017-01-25 18:52:17 +000037 host_supported: true,
Jiyong Park8bf9b162020-03-07 16:36:09 +090038 apex_available: [
39 "//apex_available:platform",
40 "//apex_available:anyapex",
41 ],
Jooyung Han88f00f22020-04-16 18:48:33 +090042 min_sdk_version: "29",
dimitry051d5cb2019-05-16 14:17:00 +020043 native_bridge_supported: true,
Vijay Venkatraman651f8382017-01-25 18:52:17 +000044 export_include_dirs: ["include"],
45 target: {
Steven Moreland385fe692017-04-13 14:29:58 -070046 vendor: {
Steven Morelande1c834d2018-01-05 14:42:12 -080047 override_export_include_dirs: ["include_vndk"],
Steven Moreland385fe692017-04-13 14:29:58 -070048 },
Dan Willemsene0cd1e02017-03-15 15:23:36 -070049 linux_bionic: {
50 enabled: true,
51 },
52 windows: {
53 enabled: true,
54 },
Vijay Venkatraman651f8382017-01-25 18:52:17 +000055 },
56}
57
Josh Gaoa9b62d52020-02-19 13:50:57 -080058// Socket specific parts of libcutils that are safe to statically link into an APEX.
Josh Gao7f8a37c2020-03-09 15:20:55 -070059cc_library {
Josh Gaoa9b62d52020-02-19 13:50:57 -080060 name: "libcutils_sockets",
61 vendor_available: true,
Josh Gaoa9b62d52020-02-19 13:50:57 -080062 recovery_available: true,
Akilesh Kailashdfb1e082020-09-30 01:34:42 +000063 ramdisk_available: true,
Josh Gaoa9b62d52020-02-19 13:50:57 -080064 host_supported: true,
65 native_bridge_supported: true,
66 apex_available: [
67 "//apex_available:platform",
68 "//apex_available:anyapex",
69 ],
Jooyung Han88f00f22020-04-16 18:48:33 +090070 min_sdk_version: "29",
Josh Gaoa9b62d52020-02-19 13:50:57 -080071
72 export_include_dirs: ["include"],
73
Josh Gao7f8a37c2020-03-09 15:20:55 -070074 shared_libs: ["liblog"],
Josh Gaoa9b62d52020-02-19 13:50:57 -080075 srcs: ["sockets.cpp"],
76 target: {
77 linux_bionic: {
78 enabled: true,
79 },
80
81 not_windows: {
82 srcs: [
83 "socket_inaddr_any_server_unix.cpp",
84 "socket_local_client_unix.cpp",
85 "socket_local_server_unix.cpp",
86 "socket_network_client_unix.cpp",
87 "sockets_unix.cpp",
88 ],
89 },
90
91 // "not_windows" means "non-Windows host".
92 android: {
93 srcs: [
94 "android_get_control_file.cpp",
95 "socket_inaddr_any_server_unix.cpp",
96 "socket_local_client_unix.cpp",
97 "socket_local_server_unix.cpp",
98 "socket_network_client_unix.cpp",
99 "sockets_unix.cpp",
100 ],
101 static_libs: ["libbase"],
102 },
103
104 windows: {
105 host_ldlibs: ["-lws2_32"],
106 srcs: [
107 "socket_inaddr_any_server_windows.cpp",
108 "socket_network_client_windows.cpp",
109 "sockets_windows.cpp",
110 ],
111
112 enabled: true,
113 cflags: [
114 "-D_GNU_SOURCE",
115 ],
116 },
117 },
118}
119
120cc_test {
121 name: "libcutils_sockets_test",
122 test_suites: ["device-tests"],
123 static_libs: ["libbase", "libcutils_sockets"],
124 cflags: [
125 "-Wall",
126 "-Wextra",
127 "-Werror",
128 ],
129
130 srcs: ["sockets_test.cpp"],
131 target: {
132 android: {
133 srcs: [
134 "android_get_control_file_test.cpp",
135 "android_get_control_socket_test.cpp",
136 ],
137 },
138 },
139}
140
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700141cc_library {
142 name: "libcutils",
Steven Moreland385fe692017-04-13 14:29:58 -0700143 vendor_available: true,
Justin Yun9ca92452017-07-31 15:41:10 +0900144 vndk: {
145 enabled: true,
146 support_system_process: true,
147 },
Jiyong Park612210c2018-04-27 21:48:43 +0900148 recovery_available: true,
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700149 host_supported: true,
Jiyong Park8bf9b162020-03-07 16:36:09 +0900150 apex_available: [
151 "//apex_available:platform",
152 "//apex_available:anyapex",
153 ],
Jooyung Han88f00f22020-04-16 18:48:33 +0900154 min_sdk_version: "29",
dimitry051d5cb2019-05-16 14:17:00 +0200155 native_bridge_supported: true,
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700156 srcs: [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800157 "config_utils.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800158 "canned_fs_config.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800159 "iosched_policy.cpp",
160 "load_file.cpp",
Steven Morelandd22659b2020-10-05 23:20:11 +0000161 "memory.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800162 "native_handle.cpp",
S Vasudev Prasad100b08a2020-05-08 11:45:45 +0530163 "properties.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800164 "record_stream.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700165 "strlcpy.c",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800166 "threads.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700167 ],
168
169 target: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -0700170 linux_bionic: {
171 enabled: true,
Dan Willemsene0cd1e02017-03-15 15:23:36 -0700172 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700173 not_windows: {
174 srcs: libcutils_nonwindows_sources + [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800175 "ashmem-host.cpp",
Jiyong Parka2159c42019-02-03 00:34:29 +0900176 "fs_config.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800177 "trace-host.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700178 ],
179 },
180 windows: {
Steven Morelande6132be2019-03-25 20:38:56 -0700181 host_ldlibs: ["-lws2_32"],
182
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700183 srcs: [
David Sehreb2dd202018-12-20 12:59:36 -0800184 "trace-host.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700185 ],
186
187 enabled: true,
Mark Salyzyn163ecc62017-05-02 08:56:15 -0700188 cflags: [
189 "-D_GNU_SOURCE",
190 ],
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700191 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700192 android: {
193 srcs: libcutils_nonwindows_sources + [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800194 "android_reboot.cpp",
195 "ashmem-dev.cpp",
Jiyong Parka2159c42019-02-03 00:34:29 +0900196 "fs_config.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700197 "klog.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800198 "partition_utils.cpp",
Chenbo Fengbaede732017-10-25 12:31:43 -0700199 "qtaguid.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800200 "trace-dev.cpp",
Luis Hector Chaveze97a4b92017-11-02 14:17:43 -0700201 "uevent.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700202 ],
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700203 },
Steven Morelandd22659b2020-10-05 23:20:11 +0000204 bionic: {
205 header_libs: ["bionic_libc_platform_headers"],
206 },
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700207
208 android_arm: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700209 sanitize: {
210 misc_undefined: ["integer"],
211 },
212 },
213 android_arm64: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700214 sanitize: {
215 misc_undefined: ["integer"],
216 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700217 },
218
219 android_x86: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700220 // TODO: This is to work around b/29412086.
221 // Remove once __mulodi4 is available and move the "sanitize" block
222 // to the android target.
223 sanitize: {
224 misc_undefined: [],
225 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700226 },
227
228 android_x86_64: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700229 sanitize: {
230 misc_undefined: ["integer"],
231 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700232 },
Logan Chien25b742c2018-05-08 17:37:29 +0800233
234 vendor: {
235 exclude_srcs: [
236 // qtaguid.cpp loads libnetd_client.so with dlopen(). Since
237 // the interface of libnetd_client.so may vary between AOSP
238 // releases, exclude qtaguid.cpp from the VNDK-SP variant.
239 "qtaguid.cpp",
240 ],
241 }
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700242 },
243
Josh Gaoa9b62d52020-02-19 13:50:57 -0800244 whole_static_libs: ["libcutils_sockets"],
Joel Fernandes51944042018-12-18 13:32:31 -0800245 shared_libs: [
246 "liblog",
247 "libbase",
248 ],
Steven Morelandd73be1b2017-04-13 23:48:57 -0700249 header_libs: [
Elliott Hughes9f495082018-04-25 14:52:50 -0700250 "libbase_headers",
Steven Morelandd73be1b2017-04-13 23:48:57 -0700251 "libcutils_headers",
252 "libutils_headers",
Suren Baghdasaryan1bd127b2019-01-25 05:30:52 +0000253 "libprocessgroup_headers",
Steven Morelandd73be1b2017-04-13 23:48:57 -0700254 ],
Suren Baghdasaryan1bd127b2019-01-25 05:30:52 +0000255 export_header_lib_headers: [
256 "libcutils_headers",
257 "libprocessgroup_headers",
258 ],
Yifan Hongb6807122017-07-25 15:24:04 -0700259 local_include_dirs: ["include"],
Vijay Venkatraman651f8382017-01-25 18:52:17 +0000260
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700261 cflags: [
262 "-Werror",
263 "-Wall",
264 "-Wextra",
265 ],
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700266}
267
Elliott Hughes01705e42019-02-07 12:41:37 -0800268cc_defaults {
269 name: "libcutils_test_default",
Elliott Hughes7e424842019-11-12 20:20:42 -0800270 srcs: [
271 "native_handle_test.cpp",
S Vasudev Prasad100b08a2020-05-08 11:45:45 +0530272 "properties_test.cpp",
Elliott Hughes7e424842019-11-12 20:20:42 -0800273 "sockets_test.cpp",
274 ],
Elliott Hughes01705e42019-02-07 12:41:37 -0800275
276 target: {
277 android: {
278 srcs: [
279 "android_get_control_file_test.cpp",
280 "android_get_control_socket_test.cpp",
281 "ashmem_test.cpp",
282 "fs_config_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800283 "multiuser_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800284 "sched_policy_test.cpp",
285 "str_parms_test.cpp",
286 "trace-dev_test.cpp",
287 ],
288 },
289
290 not_windows: {
291 srcs: [
292 "str_parms_test.cpp",
293 ],
294 },
295 },
296
297 cflags: [
298 "-Wall",
299 "-Wextra",
300 "-Werror",
301 ],
302}
303
304test_libraries = [
305 "libcutils",
306 "liblog",
307 "libbase",
308 "libjsoncpp",
309 "libprocessgroup",
Yifan Hong53e0deb2019-03-22 17:01:08 -0700310 "libcgrouprc",
Elliott Hughes01705e42019-02-07 12:41:37 -0800311]
312
313cc_test {
314 name: "libcutils_test",
315 test_suites: ["device-tests"],
316 defaults: ["libcutils_test_default"],
317 host_supported: true,
318 shared_libs: test_libraries,
Tom Cherrye41aded2019-11-07 14:06:21 -0800319 require_root: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800320}
321
nelsonlid83f3902020-01-16 17:20:18 +0800322cc_defaults {
323 name: "libcutils_test_static_defaults",
Elliott Hughes01705e42019-02-07 12:41:37 -0800324 defaults: ["libcutils_test_default"],
Yifan Hong53e0deb2019-03-22 17:01:08 -0700325 static_libs: [
326 "libc",
327 "libcgrouprc_format",
328 ] + test_libraries,
Elliott Hughes01705e42019-02-07 12:41:37 -0800329 stl: "libc++_static",
Tom Cherrye41aded2019-11-07 14:06:21 -0800330 require_root: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800331
332 target: {
333 android: {
334 static_executable: true,
335 },
336 windows: {
337 host_ldlibs: ["-lws2_32"],
338
339 enabled: true,
340 },
341 },
342}
nelsonlid83f3902020-01-16 17:20:18 +0800343
344cc_test {
345 name: "libcutils_test_static",
346 test_suites: ["device-tests"],
347 defaults: ["libcutils_test_static_defaults"],
348}
349
350cc_test {
351 name: "KernelLibcutilsTest",
Dan Shia7b9a2b2020-04-06 16:11:29 -0700352 test_suites: ["general-tests", "vts"],
nelsonlid83f3902020-01-16 17:20:18 +0800353 defaults: ["libcutils_test_static_defaults"],
354 test_config: "KernelLibcutilsTest.xml",
355}