blob: b749d871a136cd4a647e15b02d2719da65a38022 [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",
161 "native_handle.cpp",
S Vasudev Prasad100b08a2020-05-08 11:45:45 +0530162 "properties.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800163 "record_stream.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700164 "strlcpy.c",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800165 "threads.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700166 ],
167
168 target: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -0700169 linux_bionic: {
170 enabled: true,
Dan Willemsene0cd1e02017-03-15 15:23:36 -0700171 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700172 not_windows: {
173 srcs: libcutils_nonwindows_sources + [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800174 "ashmem-host.cpp",
Jiyong Parka2159c42019-02-03 00:34:29 +0900175 "fs_config.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800176 "trace-host.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700177 ],
178 },
179 windows: {
Steven Morelande6132be2019-03-25 20:38:56 -0700180 host_ldlibs: ["-lws2_32"],
181
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700182 srcs: [
David Sehreb2dd202018-12-20 12:59:36 -0800183 "trace-host.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700184 ],
185
186 enabled: true,
Mark Salyzyn163ecc62017-05-02 08:56:15 -0700187 cflags: [
188 "-D_GNU_SOURCE",
189 ],
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700190 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700191 android: {
192 srcs: libcutils_nonwindows_sources + [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800193 "android_reboot.cpp",
194 "ashmem-dev.cpp",
Jiyong Parka2159c42019-02-03 00:34:29 +0900195 "fs_config.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700196 "klog.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800197 "partition_utils.cpp",
Chenbo Fengbaede732017-10-25 12:31:43 -0700198 "qtaguid.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800199 "trace-dev.cpp",
Luis Hector Chaveze97a4b92017-11-02 14:17:43 -0700200 "uevent.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700201 ],
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700202 },
203
204 android_arm: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700205 sanitize: {
206 misc_undefined: ["integer"],
207 },
208 },
209 android_arm64: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700210 sanitize: {
211 misc_undefined: ["integer"],
212 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700213 },
214
215 android_x86: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700216 // TODO: This is to work around b/29412086.
217 // Remove once __mulodi4 is available and move the "sanitize" block
218 // to the android target.
219 sanitize: {
220 misc_undefined: [],
221 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700222 },
223
224 android_x86_64: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700225 sanitize: {
226 misc_undefined: ["integer"],
227 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700228 },
Logan Chien25b742c2018-05-08 17:37:29 +0800229
230 vendor: {
231 exclude_srcs: [
232 // qtaguid.cpp loads libnetd_client.so with dlopen(). Since
233 // the interface of libnetd_client.so may vary between AOSP
234 // releases, exclude qtaguid.cpp from the VNDK-SP variant.
235 "qtaguid.cpp",
236 ],
237 }
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700238 },
239
Josh Gaoa9b62d52020-02-19 13:50:57 -0800240 whole_static_libs: ["libcutils_sockets"],
Joel Fernandes51944042018-12-18 13:32:31 -0800241 shared_libs: [
242 "liblog",
243 "libbase",
244 ],
Steven Morelandd73be1b2017-04-13 23:48:57 -0700245 header_libs: [
Elliott Hughes9f495082018-04-25 14:52:50 -0700246 "libbase_headers",
Steven Morelandd73be1b2017-04-13 23:48:57 -0700247 "libcutils_headers",
248 "libutils_headers",
Suren Baghdasaryan1bd127b2019-01-25 05:30:52 +0000249 "libprocessgroup_headers",
Steven Morelandd73be1b2017-04-13 23:48:57 -0700250 ],
Suren Baghdasaryan1bd127b2019-01-25 05:30:52 +0000251 export_header_lib_headers: [
252 "libcutils_headers",
253 "libprocessgroup_headers",
254 ],
Yifan Hongb6807122017-07-25 15:24:04 -0700255 local_include_dirs: ["include"],
Vijay Venkatraman651f8382017-01-25 18:52:17 +0000256
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700257 cflags: [
258 "-Werror",
259 "-Wall",
260 "-Wextra",
261 ],
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700262}
263
Elliott Hughes01705e42019-02-07 12:41:37 -0800264cc_defaults {
265 name: "libcutils_test_default",
Elliott Hughes7e424842019-11-12 20:20:42 -0800266 srcs: [
267 "native_handle_test.cpp",
S Vasudev Prasad100b08a2020-05-08 11:45:45 +0530268 "properties_test.cpp",
Elliott Hughes7e424842019-11-12 20:20:42 -0800269 "sockets_test.cpp",
270 ],
Elliott Hughes01705e42019-02-07 12:41:37 -0800271
272 target: {
273 android: {
274 srcs: [
275 "android_get_control_file_test.cpp",
276 "android_get_control_socket_test.cpp",
277 "ashmem_test.cpp",
278 "fs_config_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800279 "multiuser_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800280 "sched_policy_test.cpp",
281 "str_parms_test.cpp",
282 "trace-dev_test.cpp",
283 ],
284 },
285
286 not_windows: {
287 srcs: [
288 "str_parms_test.cpp",
289 ],
290 },
291 },
292
293 cflags: [
294 "-Wall",
295 "-Wextra",
296 "-Werror",
297 ],
298}
299
300test_libraries = [
301 "libcutils",
302 "liblog",
303 "libbase",
304 "libjsoncpp",
305 "libprocessgroup",
Yifan Hong53e0deb2019-03-22 17:01:08 -0700306 "libcgrouprc",
Elliott Hughes01705e42019-02-07 12:41:37 -0800307]
308
309cc_test {
310 name: "libcutils_test",
311 test_suites: ["device-tests"],
312 defaults: ["libcutils_test_default"],
313 host_supported: true,
314 shared_libs: test_libraries,
Tom Cherrye41aded2019-11-07 14:06:21 -0800315 require_root: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800316}
317
nelsonlid83f3902020-01-16 17:20:18 +0800318cc_defaults {
319 name: "libcutils_test_static_defaults",
Elliott Hughes01705e42019-02-07 12:41:37 -0800320 defaults: ["libcutils_test_default"],
Yifan Hong53e0deb2019-03-22 17:01:08 -0700321 static_libs: [
322 "libc",
323 "libcgrouprc_format",
324 ] + test_libraries,
Elliott Hughes01705e42019-02-07 12:41:37 -0800325 stl: "libc++_static",
Tom Cherrye41aded2019-11-07 14:06:21 -0800326 require_root: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800327
328 target: {
329 android: {
330 static_executable: true,
331 },
332 windows: {
333 host_ldlibs: ["-lws2_32"],
334
335 enabled: true,
336 },
337 },
338}
nelsonlid83f3902020-01-16 17:20:18 +0800339
340cc_test {
341 name: "libcutils_test_static",
342 test_suites: ["device-tests"],
343 defaults: ["libcutils_test_static_defaults"],
344}
345
346cc_test {
347 name: "KernelLibcutilsTest",
Dan Shia7b9a2b2020-04-06 16:11:29 -0700348 test_suites: ["general-tests", "vts"],
nelsonlid83f3902020-01-16 17:20:18 +0800349 defaults: ["libcutils_test_static_defaults"],
350 test_config: "KernelLibcutilsTest.xml",
351}