blob: 1f775db627ea2aa63fc67e7d53a7d87a1709a852 [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
17// some files must not be compiled when building against Mingw
18// they correspond to features not used by our host development tools
19// which are also hard or even impossible to port to native Win32
20libcutils_nonwindows_sources = [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -080021 "fs.cpp",
Elliott Hughes9d127252018-07-13 10:54:49 -070022 "hashmap.cpp",
Jeff Sharkey53d37ba2017-11-09 17:41:09 -070023 "multiuser.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -080024 "str_parms.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -070025]
26
Vijay Venkatraman651f8382017-01-25 18:52:17 +000027cc_library_headers {
Vijay Venkatraman651f8382017-01-25 18:52:17 +000028 name: "libcutils_headers",
Steven Moreland385fe692017-04-13 14:29:58 -070029 vendor_available: true,
Jiyong Park612210c2018-04-27 21:48:43 +090030 recovery_available: true,
Tom Cherrya5edc0f2020-09-17 09:38:42 -070031 ramdisk_available: true,
Vijay Venkatraman651f8382017-01-25 18:52:17 +000032 host_supported: true,
Jiyong Park8bf9b162020-03-07 16:36:09 +090033 apex_available: [
34 "//apex_available:platform",
35 "//apex_available:anyapex",
36 ],
Jooyung Han88f00f22020-04-16 18:48:33 +090037 min_sdk_version: "29",
dimitry051d5cb2019-05-16 14:17:00 +020038 native_bridge_supported: true,
Vijay Venkatraman651f8382017-01-25 18:52:17 +000039 export_include_dirs: ["include"],
40 target: {
Steven Moreland385fe692017-04-13 14:29:58 -070041 vendor: {
Steven Morelande1c834d2018-01-05 14:42:12 -080042 override_export_include_dirs: ["include_vndk"],
Steven Moreland385fe692017-04-13 14:29:58 -070043 },
Dan Willemsene0cd1e02017-03-15 15:23:36 -070044 linux_bionic: {
45 enabled: true,
46 },
47 windows: {
48 enabled: true,
49 },
Vijay Venkatraman651f8382017-01-25 18:52:17 +000050 },
51}
52
Josh Gaoa9b62d52020-02-19 13:50:57 -080053// Socket specific parts of libcutils that are safe to statically link into an APEX.
Josh Gao7f8a37c2020-03-09 15:20:55 -070054cc_library {
Josh Gaoa9b62d52020-02-19 13:50:57 -080055 name: "libcutils_sockets",
56 vendor_available: true,
Josh Gaoa9b62d52020-02-19 13:50:57 -080057 recovery_available: true,
Akilesh Kailashdfb1e082020-09-30 01:34:42 +000058 ramdisk_available: true,
Josh Gaoa9b62d52020-02-19 13:50:57 -080059 host_supported: true,
60 native_bridge_supported: true,
61 apex_available: [
62 "//apex_available:platform",
63 "//apex_available:anyapex",
64 ],
Jooyung Han88f00f22020-04-16 18:48:33 +090065 min_sdk_version: "29",
Josh Gaoa9b62d52020-02-19 13:50:57 -080066
67 export_include_dirs: ["include"],
68
Josh Gao7f8a37c2020-03-09 15:20:55 -070069 shared_libs: ["liblog"],
Josh Gaoa9b62d52020-02-19 13:50:57 -080070 srcs: ["sockets.cpp"],
71 target: {
72 linux_bionic: {
73 enabled: true,
74 },
75
76 not_windows: {
77 srcs: [
78 "socket_inaddr_any_server_unix.cpp",
79 "socket_local_client_unix.cpp",
80 "socket_local_server_unix.cpp",
81 "socket_network_client_unix.cpp",
82 "sockets_unix.cpp",
83 ],
84 },
85
86 // "not_windows" means "non-Windows host".
87 android: {
88 srcs: [
89 "android_get_control_file.cpp",
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 static_libs: ["libbase"],
97 },
98
99 windows: {
100 host_ldlibs: ["-lws2_32"],
101 srcs: [
102 "socket_inaddr_any_server_windows.cpp",
103 "socket_network_client_windows.cpp",
104 "sockets_windows.cpp",
105 ],
106
107 enabled: true,
108 cflags: [
109 "-D_GNU_SOURCE",
110 ],
111 },
112 },
113}
114
115cc_test {
116 name: "libcutils_sockets_test",
117 test_suites: ["device-tests"],
118 static_libs: ["libbase", "libcutils_sockets"],
119 cflags: [
120 "-Wall",
121 "-Wextra",
122 "-Werror",
123 ],
124
125 srcs: ["sockets_test.cpp"],
126 target: {
127 android: {
128 srcs: [
129 "android_get_control_file_test.cpp",
130 "android_get_control_socket_test.cpp",
131 ],
132 },
133 },
134}
135
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700136cc_library {
137 name: "libcutils",
Steven Moreland385fe692017-04-13 14:29:58 -0700138 vendor_available: true,
Justin Yun9ca92452017-07-31 15:41:10 +0900139 vndk: {
140 enabled: true,
141 support_system_process: true,
142 },
Jiyong Park612210c2018-04-27 21:48:43 +0900143 recovery_available: true,
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700144 host_supported: true,
Jiyong Park8bf9b162020-03-07 16:36:09 +0900145 apex_available: [
146 "//apex_available:platform",
147 "//apex_available:anyapex",
148 ],
Jooyung Han88f00f22020-04-16 18:48:33 +0900149 min_sdk_version: "29",
dimitry051d5cb2019-05-16 14:17:00 +0200150 native_bridge_supported: true,
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700151 srcs: [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800152 "config_utils.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800153 "canned_fs_config.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800154 "iosched_policy.cpp",
155 "load_file.cpp",
156 "native_handle.cpp",
S Vasudev Prasad100b08a2020-05-08 11:45:45 +0530157 "properties.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800158 "record_stream.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700159 "strlcpy.c",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800160 "threads.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700161 ],
162
163 target: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -0700164 linux_bionic: {
165 enabled: true,
Dan Willemsene0cd1e02017-03-15 15:23:36 -0700166 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700167 not_windows: {
168 srcs: libcutils_nonwindows_sources + [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800169 "ashmem-host.cpp",
Jiyong Parka2159c42019-02-03 00:34:29 +0900170 "fs_config.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800171 "trace-host.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700172 ],
173 },
174 windows: {
Steven Morelande6132be2019-03-25 20:38:56 -0700175 host_ldlibs: ["-lws2_32"],
176
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700177 srcs: [
David Sehreb2dd202018-12-20 12:59:36 -0800178 "trace-host.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700179 ],
180
181 enabled: true,
Mark Salyzyn163ecc62017-05-02 08:56:15 -0700182 cflags: [
183 "-D_GNU_SOURCE",
184 ],
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700185 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700186 android: {
187 srcs: libcutils_nonwindows_sources + [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800188 "android_reboot.cpp",
189 "ashmem-dev.cpp",
Jiyong Parka2159c42019-02-03 00:34:29 +0900190 "fs_config.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700191 "klog.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800192 "partition_utils.cpp",
Chenbo Fengbaede732017-10-25 12:31:43 -0700193 "qtaguid.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800194 "trace-dev.cpp",
Luis Hector Chaveze97a4b92017-11-02 14:17:43 -0700195 "uevent.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700196 ],
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700197 },
198
199 android_arm: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700200 sanitize: {
201 misc_undefined: ["integer"],
202 },
203 },
204 android_arm64: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700205 sanitize: {
206 misc_undefined: ["integer"],
207 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700208 },
209
210 android_x86: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700211 // TODO: This is to work around b/29412086.
212 // Remove once __mulodi4 is available and move the "sanitize" block
213 // to the android target.
214 sanitize: {
215 misc_undefined: [],
216 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700217 },
218
219 android_x86_64: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700220 sanitize: {
221 misc_undefined: ["integer"],
222 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700223 },
Logan Chien25b742c2018-05-08 17:37:29 +0800224
225 vendor: {
226 exclude_srcs: [
227 // qtaguid.cpp loads libnetd_client.so with dlopen(). Since
228 // the interface of libnetd_client.so may vary between AOSP
229 // releases, exclude qtaguid.cpp from the VNDK-SP variant.
230 "qtaguid.cpp",
231 ],
232 }
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700233 },
234
Josh Gaoa9b62d52020-02-19 13:50:57 -0800235 whole_static_libs: ["libcutils_sockets"],
Joel Fernandes51944042018-12-18 13:32:31 -0800236 shared_libs: [
237 "liblog",
238 "libbase",
239 ],
Steven Morelandd73be1b2017-04-13 23:48:57 -0700240 header_libs: [
Elliott Hughes9f495082018-04-25 14:52:50 -0700241 "libbase_headers",
Steven Morelandd73be1b2017-04-13 23:48:57 -0700242 "libcutils_headers",
243 "libutils_headers",
Suren Baghdasaryan1bd127b2019-01-25 05:30:52 +0000244 "libprocessgroup_headers",
Steven Morelandd73be1b2017-04-13 23:48:57 -0700245 ],
Suren Baghdasaryan1bd127b2019-01-25 05:30:52 +0000246 export_header_lib_headers: [
247 "libcutils_headers",
248 "libprocessgroup_headers",
249 ],
Yifan Hongb6807122017-07-25 15:24:04 -0700250 local_include_dirs: ["include"],
Vijay Venkatraman651f8382017-01-25 18:52:17 +0000251
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700252 cflags: [
253 "-Werror",
254 "-Wall",
255 "-Wextra",
256 ],
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700257}
258
Elliott Hughes01705e42019-02-07 12:41:37 -0800259cc_defaults {
260 name: "libcutils_test_default",
Elliott Hughes7e424842019-11-12 20:20:42 -0800261 srcs: [
262 "native_handle_test.cpp",
S Vasudev Prasad100b08a2020-05-08 11:45:45 +0530263 "properties_test.cpp",
Elliott Hughes7e424842019-11-12 20:20:42 -0800264 "sockets_test.cpp",
265 ],
Elliott Hughes01705e42019-02-07 12:41:37 -0800266
267 target: {
268 android: {
269 srcs: [
270 "android_get_control_file_test.cpp",
271 "android_get_control_socket_test.cpp",
272 "ashmem_test.cpp",
273 "fs_config_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800274 "multiuser_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800275 "sched_policy_test.cpp",
276 "str_parms_test.cpp",
277 "trace-dev_test.cpp",
278 ],
279 },
280
281 not_windows: {
282 srcs: [
283 "str_parms_test.cpp",
284 ],
285 },
286 },
287
288 cflags: [
289 "-Wall",
290 "-Wextra",
291 "-Werror",
292 ],
293}
294
295test_libraries = [
296 "libcutils",
297 "liblog",
298 "libbase",
299 "libjsoncpp",
300 "libprocessgroup",
Yifan Hong53e0deb2019-03-22 17:01:08 -0700301 "libcgrouprc",
Elliott Hughes01705e42019-02-07 12:41:37 -0800302]
303
304cc_test {
305 name: "libcutils_test",
306 test_suites: ["device-tests"],
307 defaults: ["libcutils_test_default"],
308 host_supported: true,
309 shared_libs: test_libraries,
Tom Cherrye41aded2019-11-07 14:06:21 -0800310 require_root: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800311}
312
nelsonlid83f3902020-01-16 17:20:18 +0800313cc_defaults {
314 name: "libcutils_test_static_defaults",
Elliott Hughes01705e42019-02-07 12:41:37 -0800315 defaults: ["libcutils_test_default"],
Yifan Hong53e0deb2019-03-22 17:01:08 -0700316 static_libs: [
317 "libc",
318 "libcgrouprc_format",
319 ] + test_libraries,
Elliott Hughes01705e42019-02-07 12:41:37 -0800320 stl: "libc++_static",
Tom Cherrye41aded2019-11-07 14:06:21 -0800321 require_root: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800322
323 target: {
324 android: {
325 static_executable: true,
326 },
327 windows: {
328 host_ldlibs: ["-lws2_32"],
329
330 enabled: true,
331 },
332 },
333}
nelsonlid83f3902020-01-16 17:20:18 +0800334
335cc_test {
336 name: "libcutils_test_static",
337 test_suites: ["device-tests"],
338 defaults: ["libcutils_test_static_defaults"],
339}
340
341cc_test {
342 name: "KernelLibcutilsTest",
Dan Shia7b9a2b2020-04-06 16:11:29 -0700343 test_suites: ["general-tests", "vts"],
nelsonlid83f3902020-01-16 17:20:18 +0800344 defaults: ["libcutils_test_static_defaults"],
345 test_config: "KernelLibcutilsTest.xml",
346}