blob: d527a69c9e5b4a2a4adc038253baec33520a0680 [file] [log] [blame]
Bob Badourb5457a72021-02-12 15:24:13 -08001package {
2 default_applicable_licenses: ["external_libcap_license"],
3}
4
5// Added automatically by a large-scale-change that took the approach of
6// 'apply every license found to every target'. While this makes sure we respect
7// every license restriction, it may not be entirely correct.
8//
9// e.g. GPL in an MIT project might only apply to the contrib/ directory.
10//
11// Please consider splitting the single license below into multiple licenses,
12// taking care not to lose any license_kind information, and overriding the
13// default license using the 'licenses: [...]' property on targets as needed.
14//
15// For unused files, consider creating a 'fileGroup' with "//visibility:private"
16// to attach the license to, and including a comment whether the files may be
17// used in the current project.
18//
19// large-scale-change filtered out the below license kinds as false-positives:
20// SPDX-license-identifier-GPL
21// SPDX-license-identifier-GPL-2.0
22// SPDX-license-identifier-LGPL
23// See: http://go/android-license-faq
24license {
25 name: "external_libcap_license",
26 visibility: [":__subpackages__"],
27 license_kinds: [
28 "SPDX-license-identifier-Apache-2.0",
29 "SPDX-license-identifier-BSD",
30 "SPDX-license-identifier-BSD-3-Clause",
31 ],
32 license_text: [
33 "NOTICE",
34 ],
35}
36
Chih-Hung Hsiehe39c5302017-09-28 13:39:39 -070037cc_defaults {
38 name: "libcap_defaults",
39 cflags: [
Elliott Hughes5a87f0e2020-06-05 09:25:16 -070040 "-Wno-pointer-arith",
41 "-Wno-tautological-compare",
Chih-Hung Hsiehe39c5302017-09-28 13:39:39 -070042 "-Wno-unused-parameter",
43 "-Wno-unused-result",
Elliott Hughes5a87f0e2020-06-05 09:25:16 -070044 "-Wno-unused-variable",
Chih-Hung Hsiehe39c5302017-09-28 13:39:39 -070045 ],
46}
47
Dan Willemsend0dbccb2016-08-01 23:43:42 -070048cc_library {
49 name: "libcap",
Dan Willemsend0dbccb2016-08-01 23:43:42 -070050 host_supported: true,
Jiyong Park9c588102017-04-25 16:56:25 +090051 vendor_available: true,
Justin Yunf36c57c2020-11-11 16:24:15 +090052 product_available: true,
Jiyong Parka63cdda2018-05-24 14:08:14 +090053 recovery_available: true,
Justin Yund05a95e2017-07-24 15:19:44 +090054 vndk: {
55 enabled: true,
56 },
Chih-Hung Hsiehe39c5302017-09-28 13:39:39 -070057 defaults: ["libcap_defaults"],
Dan Willemsend0dbccb2016-08-01 23:43:42 -070058
59 srcs: [
60 "libcap/cap_alloc.c",
61 "libcap/cap_extint.c",
62 "libcap/cap_file.c",
63 "libcap/cap_flag.c",
64 "libcap/cap_proc.c",
65 "libcap/cap_text.c",
66 ],
Elliott Hughesa8b83df2020-06-04 14:38:03 -070067 generated_headers: ["cap_names.h"],
Dan Willemsend0dbccb2016-08-01 23:43:42 -070068
69 local_include_dirs: ["libcap/include"],
70 export_include_dirs: ["libcap/include"],
71
72 target: {
73 darwin: {
74 enabled: false,
Tom Cherry64dcb222017-05-09 16:38:39 -070075 },
76 linux_bionic: {
77 enabled: true,
78 },
Haibo Huangd29d5072020-04-09 15:35:15 -070079 linux_glibc: {
80 local_include_dirs: ["libcap/include/uapi"],
81 },
Tom Cherry64dcb222017-05-09 16:38:39 -070082 },
Jiyong Park4eca36a2020-04-08 22:36:47 +090083 apex_available: [
Jooyung Han32563b82020-04-16 18:48:27 +090084 "//apex_available:platform",
85 "com.android.adbd",
Victor Hsieh2cde6942021-05-11 12:36:11 -070086 "com.android.compos",
Jooyung Han32563b82020-04-16 18:48:27 +090087 "com.android.media.swcodec",
Jiyong Park8626dd42020-12-07 15:08:24 +090088 "com.android.virt",
Jiyong Park4eca36a2020-04-08 22:36:47 +090089 ],
Jooyung Han32563b82020-04-16 18:48:27 +090090 min_sdk_version: "29",
Dan Willemsend0dbccb2016-08-01 23:43:42 -070091}
liminghao5e044e02016-11-15 16:28:23 +080092
93cc_binary {
94 name: "getcap",
Chih-Hung Hsiehe39c5302017-09-28 13:39:39 -070095 defaults: ["libcap_defaults"],
Elliott Hughesa8b83df2020-06-04 14:38:03 -070096 srcs: ["progs/getcap.c"],
liminghao5e044e02016-11-15 16:28:23 +080097 static_libs: [
98 "libcap",
99 ],
100}
101
102cc_binary {
103 name: "setcap",
Chih-Hung Hsiehe39c5302017-09-28 13:39:39 -0700104 defaults: ["libcap_defaults"],
Elliott Hughesa8b83df2020-06-04 14:38:03 -0700105 srcs: ["progs/setcap.c"],
liminghao5e044e02016-11-15 16:28:23 +0800106 static_libs: [
107 "libcap",
108 ],
109}
Elliott Hughesa8b83df2020-06-04 14:38:03 -0700110
111//
112// Generate cap_names.list.h from the <linux/capability.h> header (using awk).
113//
114
115genrule {
116 name: "cap_names.list.h",
117 srcs: ["libcap/include/uapi/linux/capability.h"],
118 out: ["cap_names.list.h"],
119 tool_files: [":generate_cap_names_list.awk"],
120 cmd: "awk -f $(location :generate_cap_names_list.awk) $(in) > $(out)",
121}
122
123filegroup {
124 name: "generate_cap_names_list.awk",
125 srcs: ["generate_cap_names_list.awk"],
126}
127
128//
129// Generate cap_names.h from cap_names.list.h (using _makenames).
130//
131
132genrule {
133 name: "cap_names.h",
134 out: ["cap_names.h"],
135 tools: [":_makenames"],
136 cmd: "$(location :_makenames) > $(out)",
137}
138
139cc_binary {
140 name: "_makenames",
141 defaults: ["libcap_defaults"],
142 srcs: ["libcap/_makenames.c"],
143 generated_headers: ["cap_names.list.h"],
144 host_supported: true,
145}