2022-11-17 13:47:08 +00:00
|
|
|
# Copyright (C) 2021 Huawei Device Co., Ltd.
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
import("//build/ohos.gni")
|
|
|
|
import("//build/ohos/ndk/ndk.gni")
|
2023-06-05 06:25:17 +00:00
|
|
|
|
|
|
|
THIRDPARTY_LIBBPF_SUBSYS_NAME = "thirdparty"
|
|
|
|
THIRDPARTY_LIBBPF_PART_NAME = "libbpf"
|
|
|
|
|
2022-11-17 13:47:08 +00:00
|
|
|
config("libbpf_config") {
|
|
|
|
cflags = [
|
|
|
|
"-Wno-incompatible-pointer-types",
|
|
|
|
"-Wimplicit-function-declaration",
|
|
|
|
"-Wno-tautological-constant-out-of-range-compare",
|
|
|
|
"-Wno-constant-conversion",
|
|
|
|
"-Wno-unknown-attributes",
|
|
|
|
"-Wno-bitwise-op-parentheses",
|
|
|
|
"-Wno-shift-op-parentheses",
|
|
|
|
"-Wno-sign-compare",
|
|
|
|
"-Wno-unused-function",
|
|
|
|
"-fno-omit-frame-pointer",
|
|
|
|
"-mno-omit-leaf-frame-pointer",
|
|
|
|
"-fno-inline",
|
|
|
|
"-fno-optimize-sibling-calls",
|
|
|
|
"-ferror-limit=0",
|
|
|
|
"-Wno-unused-variable",
|
|
|
|
"-Wno-uninitialized",
|
|
|
|
]
|
2022-12-07 03:02:16 +00:00
|
|
|
defines = [ "HAVE_ELFIO" ]
|
2022-11-17 13:47:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
config("libbpf_public_config") {
|
|
|
|
include_dirs = [
|
|
|
|
"./src",
|
|
|
|
"./include",
|
|
|
|
"./include/uapi",
|
|
|
|
"//third_party/zlib",
|
|
|
|
"//third_party/elfio/c_wrapper",
|
|
|
|
"//third_party/elfio/elfio",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
ohos_shared_library("libbpf") {
|
2024-09-09 12:07:13 +00:00
|
|
|
branch_protector_ret = "pac_ret"
|
2022-11-17 13:47:08 +00:00
|
|
|
deps = [
|
|
|
|
"//third_party/elfio:elfio",
|
|
|
|
"//third_party/zlib:libz",
|
|
|
|
]
|
|
|
|
sources = [
|
|
|
|
"./src/bpf.c",
|
2022-12-07 03:02:16 +00:00
|
|
|
"./src/bpf.h",
|
2022-11-17 13:47:08 +00:00
|
|
|
"./src/bpf_core_read.h",
|
|
|
|
"./src/bpf_endian.h",
|
|
|
|
"./src/bpf_gen_internal.h",
|
|
|
|
"./src/bpf_helper_defs.h",
|
|
|
|
"./src/bpf_helpers.h",
|
|
|
|
"./src/bpf_prog_linfo.c",
|
|
|
|
"./src/bpf_tracing.h",
|
|
|
|
"./src/btf.c",
|
|
|
|
"./src/btf.h",
|
2022-12-07 03:02:16 +00:00
|
|
|
"./src/btf_dump.c",
|
2024-05-20 08:04:08 +00:00
|
|
|
"./src/elf.c",
|
2022-11-17 13:47:08 +00:00
|
|
|
"./src/gen_loader.c",
|
|
|
|
"./src/hashmap.c",
|
|
|
|
"./src/hashmap.h",
|
|
|
|
"./src/libbpf.c",
|
2022-12-07 03:02:16 +00:00
|
|
|
"./src/libbpf.h",
|
2022-11-17 13:47:08 +00:00
|
|
|
"./src/libbpf_common.h",
|
|
|
|
"./src/libbpf_errno.c",
|
|
|
|
"./src/libbpf_internal.h",
|
|
|
|
"./src/libbpf_legacy.h",
|
|
|
|
"./src/libbpf_probes.c",
|
|
|
|
"./src/libbpf_version.h",
|
|
|
|
"./src/netlink.c",
|
|
|
|
"./src/nlattr.c",
|
|
|
|
"./src/nlattr.h",
|
|
|
|
"./src/relo_core.c",
|
|
|
|
"./src/relo_core.h",
|
|
|
|
"./src/ringbuf.c",
|
|
|
|
"./src/skel_internal.h",
|
|
|
|
"./src/str_error.c",
|
|
|
|
"./src/str_error.h",
|
|
|
|
"./src/strset.c",
|
|
|
|
"./src/strset.h",
|
2024-05-20 08:04:08 +00:00
|
|
|
"./src/zip.c",
|
2022-11-17 13:47:08 +00:00
|
|
|
]
|
|
|
|
configs = [ ":libbpf_config" ]
|
|
|
|
public_configs = [ ":libbpf_public_config" ]
|
2022-12-07 03:02:16 +00:00
|
|
|
output_extension = "so"
|
2023-06-05 06:25:17 +00:00
|
|
|
subsystem_name = "${THIRDPARTY_LIBBPF_SUBSYS_NAME}"
|
|
|
|
part_name = "${THIRDPARTY_LIBBPF_PART_NAME}"
|
2022-11-17 13:47:08 +00:00
|
|
|
install_enable = true
|
2022-11-23 04:57:36 +00:00
|
|
|
license_file = "LICENSE.BSD-2-Clause"
|
2022-11-17 13:47:08 +00:00
|
|
|
}
|