blob: 29fda33df716cb3275d5728db537178209186221 [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,
Jiyong Parka63cdda2018-05-24 14:08:14 +090016 recovery_available: true,
Justin Yund05a95e2017-07-24 15:19:44 +090017 vndk: {
18 enabled: true,
19 },
Chih-Hung Hsiehe39c5302017-09-28 13:39:39 -070020 defaults: ["libcap_defaults"],
Dan Willemsend0dbccb2016-08-01 23:43:42 -070021
22 srcs: [
23 "libcap/cap_alloc.c",
24 "libcap/cap_extint.c",
25 "libcap/cap_file.c",
26 "libcap/cap_flag.c",
27 "libcap/cap_proc.c",
28 "libcap/cap_text.c",
29 ],
Elliott Hughesa8b83df2020-06-04 14:38:03 -070030 generated_headers: ["cap_names.h"],
Dan Willemsend0dbccb2016-08-01 23:43:42 -070031
32 local_include_dirs: ["libcap/include"],
33 export_include_dirs: ["libcap/include"],
34
35 target: {
36 darwin: {
37 enabled: false,
Tom Cherry64dcb222017-05-09 16:38:39 -070038 },
39 linux_bionic: {
40 enabled: true,
41 },
Haibo Huangd29d5072020-04-09 15:35:15 -070042 linux_glibc: {
43 local_include_dirs: ["libcap/include/uapi"],
44 },
Tom Cherry64dcb222017-05-09 16:38:39 -070045 },
Jiyong Park4eca36a2020-04-08 22:36:47 +090046 apex_available: [
Jooyung Han32563b82020-04-16 18:48:27 +090047 "//apex_available:platform",
48 "com.android.adbd",
49 "com.android.media.swcodec",
Jiyong Park4eca36a2020-04-08 22:36:47 +090050 ],
Jooyung Han32563b82020-04-16 18:48:27 +090051 min_sdk_version: "29",
Dan Willemsend0dbccb2016-08-01 23:43:42 -070052}
liminghao5e044e02016-11-15 16:28:23 +080053
54cc_binary {
55 name: "getcap",
Chih-Hung Hsiehe39c5302017-09-28 13:39:39 -070056 defaults: ["libcap_defaults"],
Elliott Hughesa8b83df2020-06-04 14:38:03 -070057 srcs: ["progs/getcap.c"],
liminghao5e044e02016-11-15 16:28:23 +080058 static_libs: [
59 "libcap",
60 ],
61}
62
63cc_binary {
64 name: "setcap",
Chih-Hung Hsiehe39c5302017-09-28 13:39:39 -070065 defaults: ["libcap_defaults"],
Elliott Hughesa8b83df2020-06-04 14:38:03 -070066 srcs: ["progs/setcap.c"],
liminghao5e044e02016-11-15 16:28:23 +080067 static_libs: [
68 "libcap",
69 ],
70}
Elliott Hughesa8b83df2020-06-04 14:38:03 -070071
72//
73// Generate cap_names.list.h from the <linux/capability.h> header (using awk).
74//
75
76genrule {
77 name: "cap_names.list.h",
78 srcs: ["libcap/include/uapi/linux/capability.h"],
79 out: ["cap_names.list.h"],
80 tool_files: [":generate_cap_names_list.awk"],
81 cmd: "awk -f $(location :generate_cap_names_list.awk) $(in) > $(out)",
82}
83
84filegroup {
85 name: "generate_cap_names_list.awk",
86 srcs: ["generate_cap_names_list.awk"],
87}
88
89//
90// Generate cap_names.h from cap_names.list.h (using _makenames).
91//
92
93genrule {
94 name: "cap_names.h",
95 out: ["cap_names.h"],
96 tools: [":_makenames"],
97 cmd: "$(location :_makenames) > $(out)",
98}
99
100cc_binary {
101 name: "_makenames",
102 defaults: ["libcap_defaults"],
103 srcs: ["libcap/_makenames.c"],
104 generated_headers: ["cap_names.list.h"],
105 host_supported: true,
106}