xref: /aosp_15_r20/external/bcc/Android.bp (revision 387f9dfdfa2baef462e92476d413c7bc2470293e)
1//
2// Copyright (C) 2018 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17package {
18    default_applicable_licenses: ["external_bcc_license"],
19}
20
21// Added automatically by a large-scale-change that took the approach of
22// 'apply every license found to every target'. While this makes sure we respect
23// every license restriction, it may not be entirely correct.
24//
25// e.g. GPL in an MIT project might only apply to the contrib/ directory.
26//
27// Please consider splitting the single license below into multiple licenses,
28// taking care not to lose any license_kind information, and overriding the
29// default license using the 'licenses: [...]' property on targets as needed.
30//
31// For unused files, consider creating a 'fileGroup' with "//visibility:private"
32// to attach the license to, and including a comment whether the files may be
33// used in the current project.
34//
35// large-scale-change included anything that looked like it might be a license
36// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
37//
38// Please consider removing redundant or irrelevant files from 'license_text:'.
39// See: http://go/android-license-faq
40license {
41    name: "external_bcc_license",
42    visibility: [":__subpackages__"],
43    license_kinds: [
44        "SPDX-license-identifier-Apache-2.0",
45        "SPDX-license-identifier-BSD",
46        "SPDX-license-identifier-BSL-1.0",
47        "SPDX-license-identifier-GPL",
48        "SPDX-license-identifier-GPL-2.0",
49        "SPDX-license-identifier-MIT",
50        "SPDX-license-identifier-NCSA",
51        "legacy_unencumbered",
52    ],
53    license_text: [
54        "LICENSE",
55        "LICENSE.txt",
56    ],
57}
58
59cc_defaults {
60    name: "libbpf_defaults",
61    cflags: [
62        "-Wnullable-to-nonnull-conversion",
63        "-Wthread-safety",
64        "-Wunused-parameter",
65    ],
66    tidy: true,
67    tidy_checks: [
68        "android-*",
69        "cert-*",
70        "clang-analyzer-security*",
71        // Many calls to snprintf/sscanf/memset/memcpy in libbpf.c have the following warning.
72        "-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling",
73        // Disabling due to many unavoidable warnings from POSIX API usage.
74        "-google-runtime-int",
75    ],
76}
77
78cc_library_headers {
79    name: "libbpf_bcc_headers",
80    vendor_available: true,
81    host_supported: false,
82    native_bridge_supported: true,
83    export_include_dirs: ["src/cc/includes/"],
84    target: {
85        linux_bionic: {
86            enabled: true,
87        },
88    },
89}
90
91cc_library {
92    name: "libbpf_bcc",
93    vendor_available: true,
94    host_supported: false,
95    native_bridge_supported: true,
96    target: {
97        android: {
98            srcs: [
99                "src/cc/libbpf.c",
100                "src/cc/perf_reader.c",
101                "src/cc/bcc_zip.c",
102            ],
103            sanitize: {
104                misc_undefined: ["integer"],
105            },
106        },
107    },
108    shared_libs: ["libbpf_minimal"],
109
110    header_libs: [
111        "libbpf_bcc_headers",
112    ],
113    export_header_lib_headers: ["libbpf_bcc_headers"],
114    local_include_dirs: ["src/cc"],
115
116    defaults: ["bpf_cc_defaults"],
117    cflags: [
118        "-DHAVE_EXTERNAL_LIBBPF",
119        "-DMINIMAL_LIBBPF",
120        "-Wno-sign-compare",
121        "-Wno-typedef-redefinition",
122        "-Wno-unused-parameter",
123    ],
124}
125