blob: b83d6ba309472803220679753a0623d0e7101d86 [file] [log] [blame]
Connor O'Briend8c2e9a2022-02-14 17:49:38 -08001
Bob Badour2db6b952022-04-07 21:04:51 -07002package {
3 default_applicable_licenses: ["external_bpftool_license"],
4}
5
6// See: http://go/android-license-faq
7license {
8 name: "external_bpftool_license",
9 visibility: [":__subpackages__"],
10 license_kinds: [
11 "SPDX-license-identifier-BSD-2-Clause",
12 "SPDX-license-identifier-GPL-2.0-only",
13 ],
14 license_text: [
15 "LICENSE.BSD-2-Clause",
16 "LICENSE.GPL-2.0",
17 ],
18}
19
Connor O'Briend8c2e9a2022-02-14 17:49:38 -080020cc_binary_host {
21 name: "bpftool",
22 srcs: [
23 "src/*.c",
24 "src/kernel/bpf/disasm.c",
25 ],
26 exclude_srcs: [
27 "src/jit_disasm.c",
28 ],
29 local_include_dirs: [
30 "include",
31 "include/uapi",
32 "src/kernel/bpf"
33 ],
Colin Cross61b9d9c2022-04-22 13:10:31 -070034 target: {
35 musl: {
36 // There is an unfortunate interaction between the bionic uapi headers
37 // used by musl and the kernel headers distributed with bpftool. The
38 // bionic uapi headers include <linux/compiler_types.h>, which they
39 // expect to be resolved to their own copy of compiler_types.h that
40 // includes compiler.h. It instead resolves to the bpftool copy,
41 // which includes compiler-gcc.h directly, triggering an error if
42 // the _LINUX_COMPILER_H_ header guard is not already defined. Hack
43 // around it by always including linux/compiler.h from the command line.
44 cflags: ["-include linux/compiler.h"],
45 },
46 },
Connor O'Briend8c2e9a2022-02-14 17:49:38 -080047 static_libs: [
48 "libbpf",
49 "libcap",
50 "libelf",
51 "libz",
52 ],
53 cflags: [
54 "-DBPFTOOL_WITHOUT_SKELETONS",
55 "-DBPFTOOL_VERSION=\"5.16.0-c446fdacb10d\"",
56 "-DUSE_LIBCAP",
57 "-Wno-missing-field-initializers",
58 "-Wno-pointer-arith",
59 "-Wno-unused-parameter",
60 ]
61}