blob: 0e791254e1b71b02e8826edb37e9f4eea4e607c0 [file] [log] [blame]
Chih-Hung Hsiehe39c5302017-09-28 13:39:39 -07001cc_defaults {
2 name: "libcap_defaults",
3 cflags: [
Elliott Hughes5a87f0e2020-06-05 09:25:16 -07004 "-Wno-pointer-arith",
5 "-Wno-tautological-compare",
Chih-Hung Hsiehe39c5302017-09-28 13:39:39 -07006 "-Wno-unused-parameter",
7 "-Wno-unused-result",
Elliott Hughes5a87f0e2020-06-05 09:25:16 -07008 "-Wno-unused-variable",
Chih-Hung Hsiehe39c5302017-09-28 13:39:39 -07009 ],
10}
11
Dan Willemsend0dbccb2016-08-01 23:43:42 -070012cc_library {
13 name: "libcap",
Dan Willemsend0dbccb2016-08-01 23:43:42 -070014 host_supported: true,
Jiyong Park9c588102017-04-25 16:56:25 +090015 vendor_available: true,
Justin Yunf36c57c2020-11-11 16:24:15 +090016 product_available: true,
Jiyong Parka63cdda2018-05-24 14:08:14 +090017 recovery_available: true,
Justin Yund05a95e2017-07-24 15:19:44 +090018 vndk: {
19 enabled: true,
20 },
Chih-Hung Hsiehe39c5302017-09-28 13:39:39 -070021 defaults: ["libcap_defaults"],
Dan Willemsend0dbccb2016-08-01 23:43:42 -070022
23 srcs: [
24 "libcap/cap_alloc.c",
25 "libcap/cap_extint.c",
26 "libcap/cap_file.c",
27 "libcap/cap_flag.c",
28 "libcap/cap_proc.c",
29 "libcap/cap_text.c",
30 ],
Elliott Hughesa8b83df2020-06-04 14:38:03 -070031 generated_headers: ["cap_names.h"],
Dan Willemsend0dbccb2016-08-01 23:43:42 -070032
33 local_include_dirs: ["libcap/include"],
34 export_include_dirs: ["libcap/include"],
35
36 target: {
37 darwin: {
38 enabled: false,
Tom Cherry64dcb222017-05-09 16:38:39 -070039 },
40 linux_bionic: {
41 enabled: true,
42 },
Haibo Huangd29d5072020-04-09 15:35:15 -070043 linux_glibc: {
44 local_include_dirs: ["libcap/include/uapi"],
45 },
Tom Cherry64dcb222017-05-09 16:38:39 -070046 },
Jiyong Park4eca36a2020-04-08 22:36:47 +090047 apex_available: [
Jooyung Han32563b82020-04-16 18:48:27 +090048 "//apex_available:platform",
49 "com.android.adbd",
50 "com.android.media.swcodec",
Jiyong Park4eca36a2020-04-08 22:36:47 +090051 ],
Jooyung Han32563b82020-04-16 18:48:27 +090052 min_sdk_version: "29",
Dan Willemsend0dbccb2016-08-01 23:43:42 -070053}
liminghao5e044e02016-11-15 16:28:23 +080054
55cc_binary {
56 name: "getcap",
Chih-Hung Hsiehe39c5302017-09-28 13:39:39 -070057 defaults: ["libcap_defaults"],
Elliott Hughesa8b83df2020-06-04 14:38:03 -070058 srcs: ["progs/getcap.c"],
liminghao5e044e02016-11-15 16:28:23 +080059 static_libs: [
60 "libcap",
61 ],
62}
63
64cc_binary {
65 name: "setcap",
Chih-Hung Hsiehe39c5302017-09-28 13:39:39 -070066 defaults: ["libcap_defaults"],
Elliott Hughesa8b83df2020-06-04 14:38:03 -070067 srcs: ["progs/setcap.c"],
liminghao5e044e02016-11-15 16:28:23 +080068 static_libs: [
69 "libcap",
70 ],
71}
Elliott Hughesa8b83df2020-06-04 14:38:03 -070072
73//
74// Generate cap_names.list.h from the <linux/capability.h> header (using awk).
75//
76
77genrule {
78 name: "cap_names.list.h",
79 srcs: ["libcap/include/uapi/linux/capability.h"],
80 out: ["cap_names.list.h"],
81 tool_files: [":generate_cap_names_list.awk"],
82 cmd: "awk -f $(location :generate_cap_names_list.awk) $(in) > $(out)",
83}
84
85filegroup {
86 name: "generate_cap_names_list.awk",
87 srcs: ["generate_cap_names_list.awk"],
88}
89
90//
91// Generate cap_names.h from cap_names.list.h (using _makenames).
92//
93
94genrule {
95 name: "cap_names.h",
96 out: ["cap_names.h"],
97 tools: [":_makenames"],
98 cmd: "$(location :_makenames) > $(out)",
99}
100
101cc_binary {
102 name: "_makenames",
103 defaults: ["libcap_defaults"],
104 srcs: ["libcap/_makenames.c"],
105 generated_headers: ["cap_names.list.h"],
106 host_supported: true,
107}