1*f7c14bbaSAndroid Build Coastguard Worker// Copyright (C) 2020 The Android Open Source Project 2*f7c14bbaSAndroid Build Coastguard Worker// 3*f7c14bbaSAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License"); 4*f7c14bbaSAndroid Build Coastguard Worker// you may not use this file except in compliance with the License. 5*f7c14bbaSAndroid Build Coastguard Worker// You may obtain a copy of the License at 6*f7c14bbaSAndroid Build Coastguard Worker// 7*f7c14bbaSAndroid Build Coastguard Worker// http://www.apache.org/licenses/LICENSE-2.0 8*f7c14bbaSAndroid Build Coastguard Worker// 9*f7c14bbaSAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software 10*f7c14bbaSAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS, 11*f7c14bbaSAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*f7c14bbaSAndroid Build Coastguard Worker// See the License for the specific language governing permissions and 13*f7c14bbaSAndroid Build Coastguard Worker// limitations under the License. 14*f7c14bbaSAndroid Build Coastguard Worker 15*f7c14bbaSAndroid Build Coastguard Workerpackage { 16*f7c14bbaSAndroid Build Coastguard Worker default_applicable_licenses: ["external_libbpf_license"], 17*f7c14bbaSAndroid Build Coastguard Worker} 18*f7c14bbaSAndroid Build Coastguard Worker 19*f7c14bbaSAndroid Build Coastguard Worker// See: http://go/android-license-faq 20*f7c14bbaSAndroid Build Coastguard Workerlicense { 21*f7c14bbaSAndroid Build Coastguard Worker name: "external_libbpf_license", 22*f7c14bbaSAndroid Build Coastguard Worker visibility: [":__subpackages__"], 23*f7c14bbaSAndroid Build Coastguard Worker license_kinds: [ 24*f7c14bbaSAndroid Build Coastguard Worker "SPDX-license-identifier-BSD-2-Clause", 25*f7c14bbaSAndroid Build Coastguard Worker "SPDX-license-identifier-Linux-syscall-note", 26*f7c14bbaSAndroid Build Coastguard Worker ], 27*f7c14bbaSAndroid Build Coastguard Worker license_text: [ 28*f7c14bbaSAndroid Build Coastguard Worker "LICENSE.BSD-2-Clause", 29*f7c14bbaSAndroid Build Coastguard Worker ], 30*f7c14bbaSAndroid Build Coastguard Worker} 31*f7c14bbaSAndroid Build Coastguard Worker 32*f7c14bbaSAndroid Build Coastguard Workergenrule { 33*f7c14bbaSAndroid Build Coastguard Worker name: "libbpf_headers", 34*f7c14bbaSAndroid Build Coastguard Worker srcs: [ 35*f7c14bbaSAndroid Build Coastguard Worker "src/*.h", 36*f7c14bbaSAndroid Build Coastguard Worker ], 37*f7c14bbaSAndroid Build Coastguard Worker cmd: "mkdir -p $(genDir)/bpf && cp $(in) $(genDir)/bpf/", 38*f7c14bbaSAndroid Build Coastguard Worker out: [ 39*f7c14bbaSAndroid Build Coastguard Worker "bpf/bpf_core_read.h", 40*f7c14bbaSAndroid Build Coastguard Worker "bpf/bpf_endian.h", 41*f7c14bbaSAndroid Build Coastguard Worker "bpf/bpf.h", 42*f7c14bbaSAndroid Build Coastguard Worker "bpf/bpf_helper_defs.h", 43*f7c14bbaSAndroid Build Coastguard Worker "bpf/bpf_helpers.h", 44*f7c14bbaSAndroid Build Coastguard Worker "bpf/bpf_tracing.h", 45*f7c14bbaSAndroid Build Coastguard Worker "bpf/btf.h", 46*f7c14bbaSAndroid Build Coastguard Worker "bpf/hashmap.h", 47*f7c14bbaSAndroid Build Coastguard Worker "bpf/libbpf_common.h", 48*f7c14bbaSAndroid Build Coastguard Worker "bpf/libbpf.h", 49*f7c14bbaSAndroid Build Coastguard Worker "bpf/libbpf_internal.h", 50*f7c14bbaSAndroid Build Coastguard Worker "bpf/libbpf_legacy.h", 51*f7c14bbaSAndroid Build Coastguard Worker "bpf/libbpf_version.h", 52*f7c14bbaSAndroid Build Coastguard Worker "bpf/nlattr.h", 53*f7c14bbaSAndroid Build Coastguard Worker "bpf/skel_internal.h", 54*f7c14bbaSAndroid Build Coastguard Worker "bpf/relo_core.h", 55*f7c14bbaSAndroid Build Coastguard Worker ], 56*f7c14bbaSAndroid Build Coastguard Worker} 57*f7c14bbaSAndroid Build Coastguard Worker 58*f7c14bbaSAndroid Build Coastguard Workercc_library_headers { 59*f7c14bbaSAndroid Build Coastguard Worker name: "libbpf_build_headers", 60*f7c14bbaSAndroid Build Coastguard Worker export_include_dirs: ["include"], 61*f7c14bbaSAndroid Build Coastguard Worker visibility: [ 62*f7c14bbaSAndroid Build Coastguard Worker "//external/rust/android-crates-io/crates/libbpf-sys", 63*f7c14bbaSAndroid Build Coastguard Worker ], 64*f7c14bbaSAndroid Build Coastguard Worker} 65*f7c14bbaSAndroid Build Coastguard Worker 66*f7c14bbaSAndroid Build Coastguard Workercc_library { 67*f7c14bbaSAndroid Build Coastguard Worker name: "libbpf", 68*f7c14bbaSAndroid Build Coastguard Worker defaults: ["elfutils_transitive_defaults"], 69*f7c14bbaSAndroid Build Coastguard Worker host_supported: true, 70*f7c14bbaSAndroid Build Coastguard Worker srcs: [ 71*f7c14bbaSAndroid Build Coastguard Worker "src/*.c", 72*f7c14bbaSAndroid Build Coastguard Worker ], 73*f7c14bbaSAndroid Build Coastguard Worker local_include_dirs: [ 74*f7c14bbaSAndroid Build Coastguard Worker "android", 75*f7c14bbaSAndroid Build Coastguard Worker "include", 76*f7c14bbaSAndroid Build Coastguard Worker ], 77*f7c14bbaSAndroid Build Coastguard Worker export_include_dirs: [ 78*f7c14bbaSAndroid Build Coastguard Worker "include/uapi", 79*f7c14bbaSAndroid Build Coastguard Worker ], 80*f7c14bbaSAndroid Build Coastguard Worker generated_headers: ["libbpf_headers"], 81*f7c14bbaSAndroid Build Coastguard Worker export_generated_headers: ["libbpf_headers"], 82*f7c14bbaSAndroid Build Coastguard Worker cflags: [ 83*f7c14bbaSAndroid Build Coastguard Worker "-DCOMPAT_NEED_REALLOCARRAY", 84*f7c14bbaSAndroid Build Coastguard Worker "-include android/android.h", 85*f7c14bbaSAndroid Build Coastguard Worker "-Wno-constant-conversion", 86*f7c14bbaSAndroid Build Coastguard Worker "-Wno-missing-field-initializers", 87*f7c14bbaSAndroid Build Coastguard Worker "-Wno-pointer-arith", 88*f7c14bbaSAndroid Build Coastguard Worker "-Wno-unused-parameter", 89*f7c14bbaSAndroid Build Coastguard Worker "-Wno-user-defined-warnings", 90*f7c14bbaSAndroid Build Coastguard Worker ], 91*f7c14bbaSAndroid Build Coastguard Worker static_libs: [ 92*f7c14bbaSAndroid Build Coastguard Worker "libelf", 93*f7c14bbaSAndroid Build Coastguard Worker "libz", 94*f7c14bbaSAndroid Build Coastguard Worker ], 95*f7c14bbaSAndroid Build Coastguard Worker visibility: [ 96*f7c14bbaSAndroid Build Coastguard Worker "//external/bpftool", 97*f7c14bbaSAndroid Build Coastguard Worker "//external/bcc/libbpf-tools", 98*f7c14bbaSAndroid Build Coastguard Worker "//external/dwarves", 99*f7c14bbaSAndroid Build Coastguard Worker "//external/rust/android-crates-io/crates/libbpf-rs", 100*f7c14bbaSAndroid Build Coastguard Worker "//external/rust/android-crates-io/crates/libbpf-sys", 101*f7c14bbaSAndroid Build Coastguard Worker "//external/stg", 102*f7c14bbaSAndroid Build Coastguard Worker "//hardware/interfaces/health/utils/libhealthloop", // For use in tests only. 103*f7c14bbaSAndroid Build Coastguard Worker ], 104*f7c14bbaSAndroid Build Coastguard Worker target: { 105*f7c14bbaSAndroid Build Coastguard Worker host: { 106*f7c14bbaSAndroid Build Coastguard Worker compile_multilib: "64", 107*f7c14bbaSAndroid Build Coastguard Worker }, 108*f7c14bbaSAndroid Build Coastguard Worker }, 109*f7c14bbaSAndroid Build Coastguard Worker} 110*f7c14bbaSAndroid Build Coastguard Worker 111*f7c14bbaSAndroid Build Coastguard Workercc_library { 112*f7c14bbaSAndroid Build Coastguard Worker name: "libbpf_minimal", 113*f7c14bbaSAndroid Build Coastguard Worker defaults: ["elfutils_transitive_defaults"], 114*f7c14bbaSAndroid Build Coastguard Worker vendor_available: true, 115*f7c14bbaSAndroid Build Coastguard Worker native_bridge_supported: true, 116*f7c14bbaSAndroid Build Coastguard Worker srcs: [ 117*f7c14bbaSAndroid Build Coastguard Worker "android/bpf_stub.c", 118*f7c14bbaSAndroid Build Coastguard Worker "src/bpf.c", 119*f7c14bbaSAndroid Build Coastguard Worker "src/libbpf_errno.c", 120*f7c14bbaSAndroid Build Coastguard Worker "src/netlink.c", 121*f7c14bbaSAndroid Build Coastguard Worker "src/nlattr.c", 122*f7c14bbaSAndroid Build Coastguard Worker "src/ringbuf.c", 123*f7c14bbaSAndroid Build Coastguard Worker ], 124*f7c14bbaSAndroid Build Coastguard Worker local_include_dirs: [ 125*f7c14bbaSAndroid Build Coastguard Worker "android", 126*f7c14bbaSAndroid Build Coastguard Worker "include", 127*f7c14bbaSAndroid Build Coastguard Worker ], 128*f7c14bbaSAndroid Build Coastguard Worker export_include_dirs: [ 129*f7c14bbaSAndroid Build Coastguard Worker "include/uapi", 130*f7c14bbaSAndroid Build Coastguard Worker ], 131*f7c14bbaSAndroid Build Coastguard Worker static_libs: [ 132*f7c14bbaSAndroid Build Coastguard Worker "libelf", 133*f7c14bbaSAndroid Build Coastguard Worker ], 134*f7c14bbaSAndroid Build Coastguard Worker generated_headers: ["libbpf_headers"], 135*f7c14bbaSAndroid Build Coastguard Worker export_generated_headers: ["libbpf_headers"], 136*f7c14bbaSAndroid Build Coastguard Worker cflags: [ 137*f7c14bbaSAndroid Build Coastguard Worker "-include android/android.h", 138*f7c14bbaSAndroid Build Coastguard Worker "-Wno-pointer-arith", 139*f7c14bbaSAndroid Build Coastguard Worker "-Wno-unused-parameter", 140*f7c14bbaSAndroid Build Coastguard Worker ], 141*f7c14bbaSAndroid Build Coastguard Worker} 142