blob: c9eebfe7a23582a7af8d5e06188c3d299ea829c1 [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.
Josh Gaod1ee5082020-03-09 15:20:55 -070048cc_library {
Josh Gaob5778c12020-02-19 13:50:57 -080049 name: "libcutils_sockets",
50 vendor_available: true,
Josh Gaob5778c12020-02-19 13:50:57 -080051 recovery_available: true,
52 host_supported: true,
53 native_bridge_supported: true,
54 apex_available: [
55 "//apex_available:platform",
56 "//apex_available:anyapex",
57 ],
58
59 export_include_dirs: ["include"],
60
Josh Gaod1ee5082020-03-09 15:20:55 -070061 shared_libs: ["liblog"],
Josh Gaob5778c12020-02-19 13:50:57 -080062 srcs: ["sockets.cpp"],
63 target: {
64 linux_bionic: {
65 enabled: true,
66 },
67
68 not_windows: {
69 srcs: [
70 "socket_inaddr_any_server_unix.cpp",
71 "socket_local_client_unix.cpp",
72 "socket_local_server_unix.cpp",
73 "socket_network_client_unix.cpp",
74 "sockets_unix.cpp",
75 ],
76 },
77
78 // "not_windows" means "non-Windows host".
79 android: {
80 srcs: [
81 "android_get_control_file.cpp",
82 "socket_inaddr_any_server_unix.cpp",
83 "socket_local_client_unix.cpp",
84 "socket_local_server_unix.cpp",
85 "socket_network_client_unix.cpp",
86 "sockets_unix.cpp",
87 ],
88 static_libs: ["libbase"],
89 },
90
91 windows: {
92 host_ldlibs: ["-lws2_32"],
93 srcs: [
94 "socket_inaddr_any_server_windows.cpp",
95 "socket_network_client_windows.cpp",
96 "sockets_windows.cpp",
97 ],
98
99 enabled: true,
100 cflags: [
101 "-D_GNU_SOURCE",
102 ],
103 },
104 },
105}
106
107cc_test {
108 name: "libcutils_sockets_test",
109 test_suites: ["device-tests"],
110 static_libs: ["libbase", "libcutils_sockets"],
111 cflags: [
112 "-Wall",
113 "-Wextra",
114 "-Werror",
115 ],
116
117 srcs: ["sockets_test.cpp"],
118 target: {
119 android: {
120 srcs: [
121 "android_get_control_file_test.cpp",
122 "android_get_control_socket_test.cpp",
123 ],
124 },
125 },
126}
127
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700128cc_library {
129 name: "libcutils",
Steven Moreland385fe692017-04-13 14:29:58 -0700130 vendor_available: true,
Justin Yun9ca92452017-07-31 15:41:10 +0900131 vndk: {
132 enabled: true,
133 support_system_process: true,
134 },
Jiyong Park612210c2018-04-27 21:48:43 +0900135 recovery_available: true,
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700136 host_supported: true,
dimitry051d5cb2019-05-16 14:17:00 +0200137 native_bridge_supported: true,
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700138 srcs: [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800139 "config_utils.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800140 "canned_fs_config.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800141 "iosched_policy.cpp",
142 "load_file.cpp",
143 "native_handle.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800144 "record_stream.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700145 "strlcpy.c",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800146 "threads.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700147 ],
148
149 target: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -0700150 linux_bionic: {
151 enabled: true,
Dan Willemsene0cd1e02017-03-15 15:23:36 -0700152 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700153 not_windows: {
154 srcs: libcutils_nonwindows_sources + [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800155 "ashmem-host.cpp",
Jiyong Parka2159c42019-02-03 00:34:29 +0900156 "fs_config.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800157 "trace-host.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700158 ],
159 },
160 windows: {
Steven Morelande6132be2019-03-25 20:38:56 -0700161 host_ldlibs: ["-lws2_32"],
162
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700163 srcs: [
David Sehreb2dd202018-12-20 12:59:36 -0800164 "trace-host.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700165 ],
166
167 enabled: true,
Mark Salyzyn163ecc62017-05-02 08:56:15 -0700168 cflags: [
169 "-D_GNU_SOURCE",
170 ],
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700171 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700172 android: {
173 srcs: libcutils_nonwindows_sources + [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800174 "android_reboot.cpp",
175 "ashmem-dev.cpp",
Jiyong Parka2159c42019-02-03 00:34:29 +0900176 "fs_config.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700177 "klog.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800178 "partition_utils.cpp",
Elliott Hughes4eacd702017-01-26 17:31:40 -0800179 "properties.cpp",
Chenbo Fengbaede732017-10-25 12:31:43 -0700180 "qtaguid.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800181 "trace-dev.cpp",
Luis Hector Chaveze97a4b92017-11-02 14:17:43 -0700182 "uevent.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700183 ],
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700184 },
185
186 android_arm: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700187 sanitize: {
188 misc_undefined: ["integer"],
189 },
190 },
191 android_arm64: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700192 sanitize: {
193 misc_undefined: ["integer"],
194 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700195 },
196
197 android_x86: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700198 // TODO: This is to work around b/29412086.
199 // Remove once __mulodi4 is available and move the "sanitize" block
200 // to the android target.
201 sanitize: {
202 misc_undefined: [],
203 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700204 },
205
206 android_x86_64: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700207 sanitize: {
208 misc_undefined: ["integer"],
209 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700210 },
Logan Chien25b742c2018-05-08 17:37:29 +0800211
212 vendor: {
213 exclude_srcs: [
214 // qtaguid.cpp loads libnetd_client.so with dlopen(). Since
215 // the interface of libnetd_client.so may vary between AOSP
216 // releases, exclude qtaguid.cpp from the VNDK-SP variant.
217 "qtaguid.cpp",
218 ],
219 }
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700220 },
221
Josh Gaob5778c12020-02-19 13:50:57 -0800222 whole_static_libs: ["libcutils_sockets"],
Joel Fernandes51944042018-12-18 13:32:31 -0800223 shared_libs: [
224 "liblog",
225 "libbase",
226 ],
Steven Morelandd73be1b2017-04-13 23:48:57 -0700227 header_libs: [
Elliott Hughes9f495082018-04-25 14:52:50 -0700228 "libbase_headers",
Steven Morelandd73be1b2017-04-13 23:48:57 -0700229 "libcutils_headers",
230 "libutils_headers",
Suren Baghdasaryan1bd127b2019-01-25 05:30:52 +0000231 "libprocessgroup_headers",
Steven Morelandd73be1b2017-04-13 23:48:57 -0700232 ],
Suren Baghdasaryan1bd127b2019-01-25 05:30:52 +0000233 export_header_lib_headers: [
234 "libcutils_headers",
235 "libprocessgroup_headers",
236 ],
Yifan Hongb6807122017-07-25 15:24:04 -0700237 local_include_dirs: ["include"],
Vijay Venkatraman651f8382017-01-25 18:52:17 +0000238
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700239 cflags: [
240 "-Werror",
241 "-Wall",
242 "-Wextra",
243 ],
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700244}
245
Elliott Hughes01705e42019-02-07 12:41:37 -0800246cc_defaults {
247 name: "libcutils_test_default",
Elliott Hughes7e424842019-11-12 20:20:42 -0800248 srcs: [
249 "native_handle_test.cpp",
250 "sockets_test.cpp",
251 ],
Elliott Hughes01705e42019-02-07 12:41:37 -0800252
253 target: {
254 android: {
255 srcs: [
256 "android_get_control_file_test.cpp",
257 "android_get_control_socket_test.cpp",
258 "ashmem_test.cpp",
259 "fs_config_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800260 "multiuser_test.cpp",
261 "properties_test.cpp",
262 "sched_policy_test.cpp",
263 "str_parms_test.cpp",
264 "trace-dev_test.cpp",
265 ],
266 },
267
268 not_windows: {
269 srcs: [
270 "str_parms_test.cpp",
271 ],
272 },
273 },
274
275 cflags: [
276 "-Wall",
277 "-Wextra",
278 "-Werror",
279 ],
280}
281
282test_libraries = [
283 "libcutils",
284 "liblog",
285 "libbase",
286 "libjsoncpp",
287 "libprocessgroup",
Yifan Hong53e0deb2019-03-22 17:01:08 -0700288 "libcgrouprc",
Elliott Hughes01705e42019-02-07 12:41:37 -0800289]
290
291cc_test {
292 name: "libcutils_test",
293 test_suites: ["device-tests"],
294 defaults: ["libcutils_test_default"],
295 host_supported: true,
296 shared_libs: test_libraries,
Tom Cherrye41aded2019-11-07 14:06:21 -0800297 require_root: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800298}
299
nelsonlid83f3902020-01-16 17:20:18 +0800300cc_defaults {
301 name: "libcutils_test_static_defaults",
Elliott Hughes01705e42019-02-07 12:41:37 -0800302 defaults: ["libcutils_test_default"],
Yifan Hong53e0deb2019-03-22 17:01:08 -0700303 static_libs: [
304 "libc",
305 "libcgrouprc_format",
306 ] + test_libraries,
Elliott Hughes01705e42019-02-07 12:41:37 -0800307 stl: "libc++_static",
Tom Cherrye41aded2019-11-07 14:06:21 -0800308 require_root: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800309
310 target: {
311 android: {
312 static_executable: true,
313 },
314 windows: {
315 host_ldlibs: ["-lws2_32"],
316
317 enabled: true,
318 },
319 },
320}
nelsonlid83f3902020-01-16 17:20:18 +0800321
322cc_test {
323 name: "libcutils_test_static",
324 test_suites: ["device-tests"],
325 defaults: ["libcutils_test_static_defaults"],
326}
327
328cc_test {
329 name: "KernelLibcutilsTest",
Dan Shia7b9a2b2020-04-06 16:11:29 -0700330 test_suites: ["general-tests", "vts"],
nelsonlid83f3902020-01-16 17:20:18 +0800331 defaults: ["libcutils_test_static_defaults"],
332 test_config: "KernelLibcutilsTest.xml",
333}