Add Android.bp for bpftool
Build bpftool for host so we can use it to generate BPF skeleton
headers when building libbpf-tools.
For now, set -DBPFTOOL_WITHOUT_SKELETONS to avoid a multi-step build
process involving an intermediate "bootstrap" bpftool used to embed
BPF skeletons in the bpftool binary itself to support newer features
not needed for this use case.
Test: m bpftool
Bug: 203823368
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I8b4e2056dfb18761ac775819c30f9bd5f199db04
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..78ac00a
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,30 @@
+
+cc_binary_host {
+ name: "bpftool",
+ srcs: [
+ "src/*.c",
+ "src/kernel/bpf/disasm.c",
+ ],
+ exclude_srcs: [
+ "src/jit_disasm.c",
+ ],
+ local_include_dirs: [
+ "include",
+ "include/uapi",
+ "src/kernel/bpf"
+ ],
+ static_libs: [
+ "libbpf",
+ "libcap",
+ "libelf",
+ "libz",
+ ],
+ cflags: [
+ "-DBPFTOOL_WITHOUT_SKELETONS",
+ "-DBPFTOOL_VERSION=\"5.16.0-c446fdacb10d\"",
+ "-DUSE_LIBCAP",
+ "-Wno-missing-field-initializers",
+ "-Wno-pointer-arith",
+ "-Wno-unused-parameter",
+ ]
+}