Chih-Hung Hsieh | e39c530 | 2017-09-28 13:39:39 -0700 | [diff] [blame] | 1 | cc_defaults { |
| 2 | name: "libcap_defaults", |
| 3 | cflags: [ |
Elliott Hughes | 5a87f0e | 2020-06-05 09:25:16 -0700 | [diff] [blame] | 4 | "-Wno-pointer-arith", |
| 5 | "-Wno-tautological-compare", |
Chih-Hung Hsieh | e39c530 | 2017-09-28 13:39:39 -0700 | [diff] [blame] | 6 | "-Wno-unused-parameter", |
| 7 | "-Wno-unused-result", |
Elliott Hughes | 5a87f0e | 2020-06-05 09:25:16 -0700 | [diff] [blame] | 8 | "-Wno-unused-variable", |
Chih-Hung Hsieh | e39c530 | 2017-09-28 13:39:39 -0700 | [diff] [blame] | 9 | ], |
| 10 | } |
| 11 | |
Dan Willemsen | d0dbccb | 2016-08-01 23:43:42 -0700 | [diff] [blame] | 12 | cc_library { |
| 13 | name: "libcap", |
Dan Willemsen | d0dbccb | 2016-08-01 23:43:42 -0700 | [diff] [blame] | 14 | host_supported: true, |
Jiyong Park | 9c58810 | 2017-04-25 16:56:25 +0900 | [diff] [blame] | 15 | vendor_available: true, |
Jiyong Park | a63cdda | 2018-05-24 14:08:14 +0900 | [diff] [blame] | 16 | recovery_available: true, |
Justin Yun | d05a95e | 2017-07-24 15:19:44 +0900 | [diff] [blame] | 17 | vndk: { |
| 18 | enabled: true, |
| 19 | }, |
Chih-Hung Hsieh | e39c530 | 2017-09-28 13:39:39 -0700 | [diff] [blame] | 20 | defaults: ["libcap_defaults"], |
Dan Willemsen | d0dbccb | 2016-08-01 23:43:42 -0700 | [diff] [blame] | 21 | |
| 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 Hughes | a8b83df | 2020-06-04 14:38:03 -0700 | [diff] [blame] | 30 | generated_headers: ["cap_names.h"], |
Dan Willemsen | d0dbccb | 2016-08-01 23:43:42 -0700 | [diff] [blame] | 31 | |
| 32 | local_include_dirs: ["libcap/include"], |
| 33 | export_include_dirs: ["libcap/include"], |
| 34 | |
| 35 | target: { |
| 36 | darwin: { |
| 37 | enabled: false, |
Tom Cherry | 64dcb22 | 2017-05-09 16:38:39 -0700 | [diff] [blame] | 38 | }, |
| 39 | linux_bionic: { |
| 40 | enabled: true, |
| 41 | }, |
Haibo Huang | d29d507 | 2020-04-09 15:35:15 -0700 | [diff] [blame] | 42 | linux_glibc: { |
| 43 | local_include_dirs: ["libcap/include/uapi"], |
| 44 | }, |
Tom Cherry | 64dcb22 | 2017-05-09 16:38:39 -0700 | [diff] [blame] | 45 | }, |
Jiyong Park | 4eca36a | 2020-04-08 22:36:47 +0900 | [diff] [blame] | 46 | apex_available: [ |
Jooyung Han | 32563b8 | 2020-04-16 18:48:27 +0900 | [diff] [blame] | 47 | "//apex_available:platform", |
| 48 | "com.android.adbd", |
| 49 | "com.android.media.swcodec", |
Jiyong Park | 4eca36a | 2020-04-08 22:36:47 +0900 | [diff] [blame] | 50 | ], |
Jooyung Han | 32563b8 | 2020-04-16 18:48:27 +0900 | [diff] [blame] | 51 | min_sdk_version: "29", |
Dan Willemsen | d0dbccb | 2016-08-01 23:43:42 -0700 | [diff] [blame] | 52 | } |
liminghao | 5e044e0 | 2016-11-15 16:28:23 +0800 | [diff] [blame] | 53 | |
| 54 | cc_binary { |
| 55 | name: "getcap", |
Chih-Hung Hsieh | e39c530 | 2017-09-28 13:39:39 -0700 | [diff] [blame] | 56 | defaults: ["libcap_defaults"], |
Elliott Hughes | a8b83df | 2020-06-04 14:38:03 -0700 | [diff] [blame] | 57 | srcs: ["progs/getcap.c"], |
liminghao | 5e044e0 | 2016-11-15 16:28:23 +0800 | [diff] [blame] | 58 | static_libs: [ |
| 59 | "libcap", |
| 60 | ], |
| 61 | } |
| 62 | |
| 63 | cc_binary { |
| 64 | name: "setcap", |
Chih-Hung Hsieh | e39c530 | 2017-09-28 13:39:39 -0700 | [diff] [blame] | 65 | defaults: ["libcap_defaults"], |
Elliott Hughes | a8b83df | 2020-06-04 14:38:03 -0700 | [diff] [blame] | 66 | srcs: ["progs/setcap.c"], |
liminghao | 5e044e0 | 2016-11-15 16:28:23 +0800 | [diff] [blame] | 67 | static_libs: [ |
| 68 | "libcap", |
| 69 | ], |
| 70 | } |
Elliott Hughes | a8b83df | 2020-06-04 14:38:03 -0700 | [diff] [blame] | 71 | |
| 72 | // |
| 73 | // Generate cap_names.list.h from the <linux/capability.h> header (using awk). |
| 74 | // |
| 75 | |
| 76 | genrule { |
| 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 | |
| 84 | filegroup { |
| 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 | |
| 93 | genrule { |
| 94 | name: "cap_names.h", |
| 95 | out: ["cap_names.h"], |
| 96 | tools: [":_makenames"], |
| 97 | cmd: "$(location :_makenames) > $(out)", |
| 98 | } |
| 99 | |
| 100 | cc_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 | } |