blob: 524b715fd57f0e6301adc6a3b87160402b0a01e9 [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,
58 host_supported: true,
59 native_bridge_supported: true,
60 apex_available: [
61 "//apex_available:platform",
62 "//apex_available:anyapex",
63 ],
Jooyung Han88f00f22020-04-16 18:48:33 +090064 min_sdk_version: "29",
Josh Gaoa9b62d52020-02-19 13:50:57 -080065
66 export_include_dirs: ["include"],
67
Josh Gao7f8a37c2020-03-09 15:20:55 -070068 shared_libs: ["liblog"],
Josh Gaoa9b62d52020-02-19 13:50:57 -080069 srcs: ["sockets.cpp"],
70 target: {
71 linux_bionic: {
72 enabled: true,
73 },
74
75 not_windows: {
76 srcs: [
77 "socket_inaddr_any_server_unix.cpp",
78 "socket_local_client_unix.cpp",
79 "socket_local_server_unix.cpp",
80 "socket_network_client_unix.cpp",
81 "sockets_unix.cpp",
82 ],
83 },
84
85 // "not_windows" means "non-Windows host".
86 android: {
87 srcs: [
88 "android_get_control_file.cpp",
89 "socket_inaddr_any_server_unix.cpp",
90 "socket_local_client_unix.cpp",
91 "socket_local_server_unix.cpp",
92 "socket_network_client_unix.cpp",
93 "sockets_unix.cpp",
94 ],
95 static_libs: ["libbase"],
96 },
97
98 windows: {
99 host_ldlibs: ["-lws2_32"],
100 srcs: [
101 "socket_inaddr_any_server_windows.cpp",
102 "socket_network_client_windows.cpp",
103 "sockets_windows.cpp",
104 ],
105
106 enabled: true,
107 cflags: [
108 "-D_GNU_SOURCE",
109 ],
110 },
111 },
112}
113
114cc_test {
115 name: "libcutils_sockets_test",
116 test_suites: ["device-tests"],
117 static_libs: ["libbase", "libcutils_sockets"],
118 cflags: [
119 "-Wall",
120 "-Wextra",
121 "-Werror",
122 ],
123
124 srcs: ["sockets_test.cpp"],
125 target: {
126 android: {
127 srcs: [
128 "android_get_control_file_test.cpp",
129 "android_get_control_socket_test.cpp",
130 ],
131 },
132 },
133}
134
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700135cc_library {
136 name: "libcutils",
Steven Moreland385fe692017-04-13 14:29:58 -0700137 vendor_available: true,
Justin Yun9ca92452017-07-31 15:41:10 +0900138 vndk: {
139 enabled: true,
140 support_system_process: true,
141 },
Jiyong Park612210c2018-04-27 21:48:43 +0900142 recovery_available: true,
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700143 host_supported: true,
Jiyong Park8bf9b162020-03-07 16:36:09 +0900144 apex_available: [
145 "//apex_available:platform",
146 "//apex_available:anyapex",
147 ],
Jooyung Han88f00f22020-04-16 18:48:33 +0900148 min_sdk_version: "29",
dimitry051d5cb2019-05-16 14:17:00 +0200149 native_bridge_supported: true,
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700150 srcs: [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800151 "config_utils.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800152 "canned_fs_config.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800153 "iosched_policy.cpp",
154 "load_file.cpp",
155 "native_handle.cpp",
S Vasudev Prasad100b08a2020-05-08 11:45:45 +0530156 "properties.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800157 "record_stream.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700158 "strlcpy.c",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800159 "threads.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700160 ],
161
162 target: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -0700163 linux_bionic: {
164 enabled: true,
Dan Willemsene0cd1e02017-03-15 15:23:36 -0700165 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700166 not_windows: {
167 srcs: libcutils_nonwindows_sources + [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800168 "ashmem-host.cpp",
Jiyong Parka2159c42019-02-03 00:34:29 +0900169 "fs_config.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800170 "trace-host.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700171 ],
172 },
173 windows: {
Steven Morelande6132be2019-03-25 20:38:56 -0700174 host_ldlibs: ["-lws2_32"],
175
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700176 srcs: [
David Sehreb2dd202018-12-20 12:59:36 -0800177 "trace-host.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700178 ],
179
180 enabled: true,
Mark Salyzyn163ecc62017-05-02 08:56:15 -0700181 cflags: [
182 "-D_GNU_SOURCE",
183 ],
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700184 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700185 android: {
186 srcs: libcutils_nonwindows_sources + [
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800187 "android_reboot.cpp",
188 "ashmem-dev.cpp",
Jiyong Parka2159c42019-02-03 00:34:29 +0900189 "fs_config.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700190 "klog.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800191 "partition_utils.cpp",
Chenbo Fengbaede732017-10-25 12:31:43 -0700192 "qtaguid.cpp",
Elliott Hughes8e9aeb92017-11-10 10:22:07 -0800193 "trace-dev.cpp",
Luis Hector Chaveze97a4b92017-11-02 14:17:43 -0700194 "uevent.cpp",
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700195 ],
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700196 },
197
198 android_arm: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700199 sanitize: {
200 misc_undefined: ["integer"],
201 },
202 },
203 android_arm64: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700204 sanitize: {
205 misc_undefined: ["integer"],
206 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700207 },
208
209 android_x86: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700210 // TODO: This is to work around b/29412086.
211 // Remove once __mulodi4 is available and move the "sanitize" block
212 // to the android target.
213 sanitize: {
214 misc_undefined: [],
215 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700216 },
217
218 android_x86_64: {
Luis Hector Chavezfae195b2017-11-03 16:22:05 -0700219 sanitize: {
220 misc_undefined: ["integer"],
221 },
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700222 },
Logan Chien25b742c2018-05-08 17:37:29 +0800223
224 vendor: {
225 exclude_srcs: [
226 // qtaguid.cpp loads libnetd_client.so with dlopen(). Since
227 // the interface of libnetd_client.so may vary between AOSP
228 // releases, exclude qtaguid.cpp from the VNDK-SP variant.
229 "qtaguid.cpp",
230 ],
231 }
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700232 },
233
Josh Gaoa9b62d52020-02-19 13:50:57 -0800234 whole_static_libs: ["libcutils_sockets"],
Joel Fernandes51944042018-12-18 13:32:31 -0800235 shared_libs: [
236 "liblog",
237 "libbase",
238 ],
Steven Morelandd73be1b2017-04-13 23:48:57 -0700239 header_libs: [
Elliott Hughes9f495082018-04-25 14:52:50 -0700240 "libbase_headers",
Steven Morelandd73be1b2017-04-13 23:48:57 -0700241 "libcutils_headers",
242 "libutils_headers",
Suren Baghdasaryan1bd127b2019-01-25 05:30:52 +0000243 "libprocessgroup_headers",
Steven Morelandd73be1b2017-04-13 23:48:57 -0700244 ],
Suren Baghdasaryan1bd127b2019-01-25 05:30:52 +0000245 export_header_lib_headers: [
246 "libcutils_headers",
247 "libprocessgroup_headers",
248 ],
Yifan Hongb6807122017-07-25 15:24:04 -0700249 local_include_dirs: ["include"],
Vijay Venkatraman651f8382017-01-25 18:52:17 +0000250
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700251 cflags: [
252 "-Werror",
253 "-Wall",
254 "-Wextra",
255 ],
Dan Willemseneee8e7f2016-06-06 22:31:58 -0700256}
257
Elliott Hughes01705e42019-02-07 12:41:37 -0800258cc_defaults {
259 name: "libcutils_test_default",
Elliott Hughes7e424842019-11-12 20:20:42 -0800260 srcs: [
261 "native_handle_test.cpp",
S Vasudev Prasad100b08a2020-05-08 11:45:45 +0530262 "properties_test.cpp",
Elliott Hughes7e424842019-11-12 20:20:42 -0800263 "sockets_test.cpp",
264 ],
Elliott Hughes01705e42019-02-07 12:41:37 -0800265
266 target: {
267 android: {
268 srcs: [
269 "android_get_control_file_test.cpp",
270 "android_get_control_socket_test.cpp",
271 "ashmem_test.cpp",
272 "fs_config_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800273 "multiuser_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800274 "sched_policy_test.cpp",
275 "str_parms_test.cpp",
276 "trace-dev_test.cpp",
277 ],
278 },
279
280 not_windows: {
281 srcs: [
282 "str_parms_test.cpp",
283 ],
284 },
285 },
286
287 cflags: [
288 "-Wall",
289 "-Wextra",
290 "-Werror",
291 ],
292}
293
294test_libraries = [
295 "libcutils",
296 "liblog",
297 "libbase",
298 "libjsoncpp",
299 "libprocessgroup",
Yifan Hong53e0deb2019-03-22 17:01:08 -0700300 "libcgrouprc",
Elliott Hughes01705e42019-02-07 12:41:37 -0800301]
302
303cc_test {
304 name: "libcutils_test",
305 test_suites: ["device-tests"],
306 defaults: ["libcutils_test_default"],
307 host_supported: true,
308 shared_libs: test_libraries,
Tom Cherrye41aded2019-11-07 14:06:21 -0800309 require_root: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800310}
311
nelsonlid83f3902020-01-16 17:20:18 +0800312cc_defaults {
313 name: "libcutils_test_static_defaults",
Elliott Hughes01705e42019-02-07 12:41:37 -0800314 defaults: ["libcutils_test_default"],
Yifan Hong53e0deb2019-03-22 17:01:08 -0700315 static_libs: [
316 "libc",
317 "libcgrouprc_format",
318 ] + test_libraries,
Elliott Hughes01705e42019-02-07 12:41:37 -0800319 stl: "libc++_static",
Tom Cherrye41aded2019-11-07 14:06:21 -0800320 require_root: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800321
322 target: {
323 android: {
324 static_executable: true,
325 },
326 windows: {
327 host_ldlibs: ["-lws2_32"],
328
329 enabled: true,
330 },
331 },
332}
nelsonlid83f3902020-01-16 17:20:18 +0800333
334cc_test {
335 name: "libcutils_test_static",
336 test_suites: ["device-tests"],
337 defaults: ["libcutils_test_static_defaults"],
338}
339
340cc_test {
341 name: "KernelLibcutilsTest",
Dan Shia7b9a2b2020-04-06 16:11:29 -0700342 test_suites: ["general-tests", "vts"],
nelsonlid83f3902020-01-16 17:20:18 +0800343 defaults: ["libcutils_test_static_defaults"],
344 test_config: "KernelLibcutilsTest.xml",
345}