blob: 4e93df370d4acabaccaef2c40abd8a10d918738f [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,
Vijay Venkatraman651f8382017-01-25 18:52:17 +000031 host_supported: true,
dimitry051d5cb2019-05-16 14:17:00 +020032 native_bridge_supported: true,
Vijay Venkatraman651f8382017-01-25 18:52:17 +000033 export_include_dirs: ["include"],
34 target: {
Steven Moreland385fe692017-04-13 14:29:58 -070035 vendor: {
Steven Morelande1c834d2018-01-05 14:42:12 -080036 override_export_include_dirs: ["include_vndk"],
Steven Moreland385fe692017-04-13 14:29:58 -070037 },
Dan Willemsene0cd1e02017-03-15 15:23:36 -070038 linux_bionic: {
39 enabled: true,
40 },
41 windows: {
42 enabled: true,
43 },
Vijay Venkatraman651f8382017-01-25 18:52:17 +000044 },
45}
46
Josh Gaob5778c12020-02-19 13:50:57 -080047// Socket specific parts of libcutils that are safe to statically link into an APEX.
48cc_library_static {
49 name: "libcutils_sockets",
50 vendor_available: true,
51 vndk: {
52 enabled: true,
53 support_system_process: true,
54 },
55 recovery_available: true,
56 host_supported: true,
57 native_bridge_supported: true,
58 apex_available: [
59 "//apex_available:platform",
60 "//apex_available:anyapex",
61 ],
62
63 export_include_dirs: ["include"],
64
65 srcs: ["sockets.cpp"],
66 target: {
67 linux_bionic: {
68 enabled: true,
69 },
70
71 not_windows: {
72 srcs: [
73 "socket_inaddr_any_server_unix.cpp",
74 "socket_local_client_unix.cpp",
75 "socket_local_server_unix.cpp",
76 "socket_network_client_unix.cpp",
77 "sockets_unix.cpp",
78 ],
79 },
80
81 // "not_windows" means "non-Windows host".
82 android: {
83 srcs: [
84 "android_get_control_file.cpp",
85 "socket_inaddr_any_server_unix.cpp",
86 "socket_local_client_unix.cpp",
87 "socket_local_server_unix.cpp",
88 "socket_network_client_unix.cpp",
89 "sockets_unix.cpp",
90 ],
91 static_libs: ["libbase"],
92 },
93
94 windows: {
95 host_ldlibs: ["-lws2_32"],
96 srcs: [
97 "socket_inaddr_any_server_windows.cpp",
98 "socket_network_client_windows.cpp",
99 "sockets_windows.cpp",
100 ],
101
102 enabled: true,
103 cflags: [
104 "-D_GNU_SOURCE",
105 ],
106 },
107 },
108}
109
110cc_test {
111 name: "libcutils_sockets_test",
112 test_suites: ["device-tests"],
113 static_libs: ["libbase", "libcutils_sockets"],
114 cflags: [
115 "-Wall",
116 "-Wextra",
117 "-Werror",
118 ],
119
120 srcs: ["sockets_test.cpp"],
121 target: {
122 android: {
123 srcs: [
124 "android_get_control_file_test.cpp",
125 "android_get_control_socket_test.cpp",
126 ],
127 },
128 },
129}
130
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700131cc_library {
132 name: "libcutils",
Steven Moreland385fe692017-04-13 14:29:58 -0700133 vendor_available: true,
Justin Yun9ca92452017-07-31 15:41:10 +0900134 vndk: {
135 enabled: true,
136 support_system_process: true,
137 },
Jiyong Park612210c2018-04-27 21:48:43 +0900138 recovery_available: true,
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700139 host_supported: true,
dimitry051d5cb2019-05-16 14:17:00 +0200140 native_bridge_supported: true,
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700141 srcs: [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800142 "config_utils.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800143 "canned_fs_config.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800144 "iosched_policy.cpp",
145 "load_file.cpp",
146 "native_handle.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800147 "record_stream.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700148 "strlcpy.c",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800149 "threads.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700150 ],
151
152 target: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -0700153 linux_bionic: {
154 enabled: true,
Dan Willemsene0cd1e02017-03-15 15:23:36 -0700155 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700156 not_windows: {
157 srcs: libcutils_nonwindows_sources + [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800158 "ashmem-host.cpp",
Jiyong Parka2159c42019-02-03 00:34:29 +0900159 "fs_config.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800160 "trace-host.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700161 ],
162 },
163 windows: {
Steven Morelande6132be2019-03-25 20:38:56 -0700164 host_ldlibs: ["-lws2_32"],
165
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700166 srcs: [
David Sehreb2dd202018-12-20 12:59:36 -0800167 "trace-host.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700168 ],
169
170 enabled: true,
Mark Salyzyn163ecc62017-05-02 08:56:15 -0700171 cflags: [
172 "-D_GNU_SOURCE",
173 ],
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700174 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700175 android: {
176 srcs: libcutils_nonwindows_sources + [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800177 "android_reboot.cpp",
178 "ashmem-dev.cpp",
Jiyong Parka2159c42019-02-03 00:34:29 +0900179 "fs_config.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700180 "klog.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800181 "partition_utils.cpp",
Elliott Hughes4eacd702017-01-26 17:31:40 -0800182 "properties.cpp",
Chenbo Fengbaede732017-10-25 12:31:43 -0700183 "qtaguid.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800184 "trace-dev.cpp",
Luis Hector Chaveze97a4b92017-11-02 14:17:43 -0700185 "uevent.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700186 ],
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700187 },
188
189 android_arm: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700190 sanitize: {
191 misc_undefined: ["integer"],
192 },
193 },
194 android_arm64: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700195 sanitize: {
196 misc_undefined: ["integer"],
197 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700198 },
199
200 android_x86: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700201 // TODO: This is to work around b/29412086.
202 // Remove once __mulodi4 is available and move the "sanitize" block
203 // to the android target.
204 sanitize: {
205 misc_undefined: [],
206 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700207 },
208
209 android_x86_64: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700210 sanitize: {
211 misc_undefined: ["integer"],
212 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700213 },
Logan Chien25b742c2018-05-08 17:37:29 +0800214
215 vendor: {
216 exclude_srcs: [
217 // qtaguid.cpp loads libnetd_client.so with dlopen(). Since
218 // the interface of libnetd_client.so may vary between AOSP
219 // releases, exclude qtaguid.cpp from the VNDK-SP variant.
220 "qtaguid.cpp",
221 ],
222 }
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700223 },
224
Josh Gaob5778c12020-02-19 13:50:57 -0800225 whole_static_libs: ["libcutils_sockets"],
Joel Fernandes51944042018-12-18 13:32:31 -0800226 shared_libs: [
227 "liblog",
228 "libbase",
229 ],
Steven Morelandd73be1b2017-04-13 23:48:57 -0700230 header_libs: [
Elliott Hughes9f495082018-04-25 14:52:50 -0700231 "libbase_headers",
Steven Morelandd73be1b2017-04-13 23:48:57 -0700232 "libcutils_headers",
233 "libutils_headers",
Suren Baghdasaryan1bd127b2019-01-25 05:30:52 +0000234 "libprocessgroup_headers",
Steven Morelandd73be1b2017-04-13 23:48:57 -0700235 ],
Suren Baghdasaryan1bd127b2019-01-25 05:30:52 +0000236 export_header_lib_headers: [
237 "libcutils_headers",
238 "libprocessgroup_headers",
239 ],
Yifan Hongb6807122017-07-25 15:24:04 -0700240 local_include_dirs: ["include"],
Vijay Venkatraman651f8382017-01-25 18:52:17 +0000241
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700242 cflags: [
243 "-Werror",
244 "-Wall",
245 "-Wextra",
246 ],
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700247}
248
Elliott Hughes01705e42019-02-07 12:41:37 -0800249cc_defaults {
250 name: "libcutils_test_default",
Elliott Hughes7e424842019-11-12 20:20:42 -0800251 srcs: [
252 "native_handle_test.cpp",
253 "sockets_test.cpp",
254 ],
Elliott Hughes01705e42019-02-07 12:41:37 -0800255
256 target: {
257 android: {
258 srcs: [
259 "android_get_control_file_test.cpp",
260 "android_get_control_socket_test.cpp",
261 "ashmem_test.cpp",
262 "fs_config_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800263 "multiuser_test.cpp",
264 "properties_test.cpp",
265 "sched_policy_test.cpp",
266 "str_parms_test.cpp",
267 "trace-dev_test.cpp",
268 ],
269 },
270
271 not_windows: {
272 srcs: [
273 "str_parms_test.cpp",
274 ],
275 },
276 },
277
278 cflags: [
279 "-Wall",
280 "-Wextra",
281 "-Werror",
282 ],
283}
284
285test_libraries = [
286 "libcutils",
287 "liblog",
288 "libbase",
289 "libjsoncpp",
290 "libprocessgroup",
Yifan Hong53e0deb2019-03-22 17:01:08 -0700291 "libcgrouprc",
Elliott Hughes01705e42019-02-07 12:41:37 -0800292]
293
294cc_test {
295 name: "libcutils_test",
296 test_suites: ["device-tests"],
297 defaults: ["libcutils_test_default"],
298 host_supported: true,
299 shared_libs: test_libraries,
Tom Cherrye41aded2019-11-07 14:06:21 -0800300 require_root: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800301}
302
nelsonlid83f3902020-01-16 17:20:18 +0800303cc_defaults {
304 name: "libcutils_test_static_defaults",
Elliott Hughes01705e42019-02-07 12:41:37 -0800305 defaults: ["libcutils_test_default"],
Yifan Hong53e0deb2019-03-22 17:01:08 -0700306 static_libs: [
307 "libc",
308 "libcgrouprc_format",
309 ] + test_libraries,
Elliott Hughes01705e42019-02-07 12:41:37 -0800310 stl: "libc++_static",
Tom Cherrye41aded2019-11-07 14:06:21 -0800311 require_root: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800312
313 target: {
314 android: {
315 static_executable: true,
316 },
317 windows: {
318 host_ldlibs: ["-lws2_32"],
319
320 enabled: true,
321 },
322 },
323}
nelsonlid83f3902020-01-16 17:20:18 +0800324
325cc_test {
326 name: "libcutils_test_static",
327 test_suites: ["device-tests"],
328 defaults: ["libcutils_test_static_defaults"],
329}
330
331cc_test {
332 name: "KernelLibcutilsTest",
333 test_suites: ["general-tests", "vts-core"],
334 defaults: ["libcutils_test_static_defaults"],
335 test_config: "KernelLibcutilsTest.xml",
336}