blob: 467c4d4aa9045d6dabcf67a0c56eb37b7c62aea7 [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 Park8626dd42020-12-07 15:08:24 +090051 "com.android.virt",
Jiyong Park4eca36a2020-04-08 22:36:47 +090052 ],
Jooyung Han32563b82020-04-16 18:48:27 +090053 min_sdk_version: "29",
Dan Willemsend0dbccb2016-08-01 23:43:42 -070054}
liminghao5e044e02016-11-15 16:28:23 +080055
56cc_binary {
57 name: "getcap",
Chih-Hung Hsiehe39c5302017-09-28 13:39:39 -070058 defaults: ["libcap_defaults"],
Elliott Hughesa8b83df2020-06-04 14:38:03 -070059 srcs: ["progs/getcap.c"],
liminghao5e044e02016-11-15 16:28:23 +080060 static_libs: [
61 "libcap",
62 ],
63}
64
65cc_binary {
66 name: "setcap",
Chih-Hung Hsiehe39c5302017-09-28 13:39:39 -070067 defaults: ["libcap_defaults"],
Elliott Hughesa8b83df2020-06-04 14:38:03 -070068 srcs: ["progs/setcap.c"],
liminghao5e044e02016-11-15 16:28:23 +080069 static_libs: [
70 "libcap",
71 ],
72}
Elliott Hughesa8b83df2020-06-04 14:38:03 -070073
74//
75// Generate cap_names.list.h from the <linux/capability.h> header (using awk).
76//
77
78genrule {
79 name: "cap_names.list.h",
80 srcs: ["libcap/include/uapi/linux/capability.h"],
81 out: ["cap_names.list.h"],
82 tool_files: [":generate_cap_names_list.awk"],
83 cmd: "awk -f $(location :generate_cap_names_list.awk) $(in) > $(out)",
84}
85
86filegroup {
87 name: "generate_cap_names_list.awk",
88 srcs: ["generate_cap_names_list.awk"],
89}
90
91//
92// Generate cap_names.h from cap_names.list.h (using _makenames).
93//
94
95genrule {
96 name: "cap_names.h",
97 out: ["cap_names.h"],
98 tools: [":_makenames"],
99 cmd: "$(location :_makenames) > $(out)",
100}
101
102cc_binary {
103 name: "_makenames",
104 defaults: ["libcap_defaults"],
105 srcs: ["libcap/_makenames.c"],
106 generated_headers: ["cap_names.list.h"],
107 host_supported: true,
108}