Bob Badour | b5457a7 | 2021-02-12 15:24:13 -0800 | [diff] [blame] | 1 | package { |
| 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 |
| 24 | license { |
| 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 Hsieh | e39c530 | 2017-09-28 13:39:39 -0700 | [diff] [blame] | 37 | cc_defaults { |
| 38 | name: "libcap_defaults", |
| 39 | cflags: [ |
Elliott Hughes | 5a87f0e | 2020-06-05 09:25:16 -0700 | [diff] [blame] | 40 | "-Wno-pointer-arith", |
| 41 | "-Wno-tautological-compare", |
Chih-Hung Hsieh | e39c530 | 2017-09-28 13:39:39 -0700 | [diff] [blame] | 42 | "-Wno-unused-parameter", |
| 43 | "-Wno-unused-result", |
Elliott Hughes | 5a87f0e | 2020-06-05 09:25:16 -0700 | [diff] [blame] | 44 | "-Wno-unused-variable", |
Chih-Hung Hsieh | e39c530 | 2017-09-28 13:39:39 -0700 | [diff] [blame] | 45 | ], |
| 46 | } |
| 47 | |
Dan Willemsen | d0dbccb | 2016-08-01 23:43:42 -0700 | [diff] [blame] | 48 | cc_library { |
| 49 | name: "libcap", |
Dan Willemsen | d0dbccb | 2016-08-01 23:43:42 -0700 | [diff] [blame] | 50 | host_supported: true, |
Jiyong Park | 9c58810 | 2017-04-25 16:56:25 +0900 | [diff] [blame] | 51 | vendor_available: true, |
Justin Yun | f36c57c | 2020-11-11 16:24:15 +0900 | [diff] [blame] | 52 | product_available: true, |
Inseob Kim | 7e908d5 | 2021-06-14 11:55:24 +0900 | [diff] [blame] | 53 | ramdisk_available: true, |
Jiyong Park | a63cdda | 2018-05-24 14:08:14 +0900 | [diff] [blame] | 54 | recovery_available: true, |
Justin Yun | d05a95e | 2017-07-24 15:19:44 +0900 | [diff] [blame] | 55 | vndk: { |
| 56 | enabled: true, |
| 57 | }, |
Chih-Hung Hsieh | e39c530 | 2017-09-28 13:39:39 -0700 | [diff] [blame] | 58 | defaults: ["libcap_defaults"], |
Dan Willemsen | d0dbccb | 2016-08-01 23:43:42 -0700 | [diff] [blame] | 59 | |
| 60 | srcs: [ |
| 61 | "libcap/cap_alloc.c", |
| 62 | "libcap/cap_extint.c", |
| 63 | "libcap/cap_file.c", |
| 64 | "libcap/cap_flag.c", |
| 65 | "libcap/cap_proc.c", |
| 66 | "libcap/cap_text.c", |
| 67 | ], |
Elliott Hughes | a8b83df | 2020-06-04 14:38:03 -0700 | [diff] [blame] | 68 | generated_headers: ["cap_names.h"], |
Dan Willemsen | d0dbccb | 2016-08-01 23:43:42 -0700 | [diff] [blame] | 69 | |
| 70 | local_include_dirs: ["libcap/include"], |
| 71 | export_include_dirs: ["libcap/include"], |
| 72 | |
| 73 | target: { |
| 74 | darwin: { |
| 75 | enabled: false, |
Tom Cherry | 64dcb22 | 2017-05-09 16:38:39 -0700 | [diff] [blame] | 76 | }, |
| 77 | linux_bionic: { |
| 78 | enabled: true, |
| 79 | }, |
Haibo Huang | d29d507 | 2020-04-09 15:35:15 -0700 | [diff] [blame] | 80 | linux_glibc: { |
| 81 | local_include_dirs: ["libcap/include/uapi"], |
| 82 | }, |
Tom Cherry | 64dcb22 | 2017-05-09 16:38:39 -0700 | [diff] [blame] | 83 | }, |
Jiyong Park | 4eca36a | 2020-04-08 22:36:47 +0900 | [diff] [blame] | 84 | apex_available: [ |
Jooyung Han | 32563b8 | 2020-04-16 18:48:27 +0900 | [diff] [blame] | 85 | "//apex_available:platform", |
| 86 | "com.android.adbd", |
Victor Hsieh | 2cde694 | 2021-05-11 12:36:11 -0700 | [diff] [blame] | 87 | "com.android.compos", |
Jooyung Han | 32563b8 | 2020-04-16 18:48:27 +0900 | [diff] [blame] | 88 | "com.android.media.swcodec", |
Jiyong Park | 8626dd4 | 2020-12-07 15:08:24 +0900 | [diff] [blame] | 89 | "com.android.virt", |
Jiyong Park | 4eca36a | 2020-04-08 22:36:47 +0900 | [diff] [blame] | 90 | ], |
Jooyung Han | 32563b8 | 2020-04-16 18:48:27 +0900 | [diff] [blame] | 91 | min_sdk_version: "29", |
Dan Willemsen | d0dbccb | 2016-08-01 23:43:42 -0700 | [diff] [blame] | 92 | } |
liminghao | 5e044e0 | 2016-11-15 16:28:23 +0800 | [diff] [blame] | 93 | |
| 94 | cc_binary { |
| 95 | name: "getcap", |
Chih-Hung Hsieh | e39c530 | 2017-09-28 13:39:39 -0700 | [diff] [blame] | 96 | defaults: ["libcap_defaults"], |
Elliott Hughes | a8b83df | 2020-06-04 14:38:03 -0700 | [diff] [blame] | 97 | srcs: ["progs/getcap.c"], |
liminghao | 5e044e0 | 2016-11-15 16:28:23 +0800 | [diff] [blame] | 98 | static_libs: [ |
| 99 | "libcap", |
| 100 | ], |
| 101 | } |
| 102 | |
| 103 | cc_binary { |
| 104 | name: "setcap", |
Chih-Hung Hsieh | e39c530 | 2017-09-28 13:39:39 -0700 | [diff] [blame] | 105 | defaults: ["libcap_defaults"], |
Elliott Hughes | a8b83df | 2020-06-04 14:38:03 -0700 | [diff] [blame] | 106 | srcs: ["progs/setcap.c"], |
liminghao | 5e044e0 | 2016-11-15 16:28:23 +0800 | [diff] [blame] | 107 | static_libs: [ |
| 108 | "libcap", |
| 109 | ], |
| 110 | } |
Elliott Hughes | a8b83df | 2020-06-04 14:38:03 -0700 | [diff] [blame] | 111 | |
| 112 | // |
| 113 | // Generate cap_names.list.h from the <linux/capability.h> header (using awk). |
| 114 | // |
| 115 | |
| 116 | genrule { |
| 117 | name: "cap_names.list.h", |
| 118 | srcs: ["libcap/include/uapi/linux/capability.h"], |
| 119 | out: ["cap_names.list.h"], |
| 120 | tool_files: [":generate_cap_names_list.awk"], |
| 121 | cmd: "awk -f $(location :generate_cap_names_list.awk) $(in) > $(out)", |
| 122 | } |
| 123 | |
| 124 | filegroup { |
| 125 | name: "generate_cap_names_list.awk", |
| 126 | srcs: ["generate_cap_names_list.awk"], |
| 127 | } |
| 128 | |
| 129 | // |
| 130 | // Generate cap_names.h from cap_names.list.h (using _makenames). |
| 131 | // |
| 132 | |
| 133 | genrule { |
| 134 | name: "cap_names.h", |
| 135 | out: ["cap_names.h"], |
| 136 | tools: [":_makenames"], |
| 137 | cmd: "$(location :_makenames) > $(out)", |
| 138 | } |
| 139 | |
| 140 | cc_binary { |
| 141 | name: "_makenames", |
| 142 | defaults: ["libcap_defaults"], |
| 143 | srcs: ["libcap/_makenames.c"], |
| 144 | generated_headers: ["cap_names.list.h"], |
| 145 | host_supported: true, |
| 146 | } |