• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2021 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/ohos.gni")
15import("//build/ohos/ndk/ndk.gni")
16
17THIRDPARTY_LIBBPF_SUBSYS_NAME = "thirdparty"
18THIRDPARTY_LIBBPF_PART_NAME = "libbpf"
19
20config("libbpf_config") {
21  cflags = [
22    "-Wno-incompatible-pointer-types",
23    "-Wimplicit-function-declaration",
24    "-Wno-tautological-constant-out-of-range-compare",
25    "-Wno-constant-conversion",
26    "-Wno-unknown-attributes",
27    "-Wno-bitwise-op-parentheses",
28    "-Wno-shift-op-parentheses",
29    "-Wno-sign-compare",
30    "-Wno-unused-function",
31    "-fno-omit-frame-pointer",
32    "-mno-omit-leaf-frame-pointer",
33    "-fno-inline",
34    "-fno-optimize-sibling-calls",
35    "-ferror-limit=0",
36    "-Wno-unused-variable",
37    "-Wno-uninitialized",
38  ]
39  defines = [ "HAVE_ELFIO" ]
40}
41
42config("libbpf_public_config") {
43  include_dirs = [
44    "./src",
45    "./include",
46    "./include/uapi",
47    "//third_party/zlib",
48    "//third_party/elfio/c_wrapper",
49    "//third_party/elfio/elfio",
50  ]
51}
52
53ohos_shared_library("libbpf") {
54  branch_protector_ret = "pac_ret"
55  deps = [
56    "//third_party/elfio:elfio",
57    "//third_party/zlib:libz",
58  ]
59  sources = [
60    "./src/bpf.c",
61    "./src/bpf.h",
62    "./src/bpf_core_read.h",
63    "./src/bpf_endian.h",
64    "./src/bpf_gen_internal.h",
65    "./src/bpf_helper_defs.h",
66    "./src/bpf_helpers.h",
67    "./src/bpf_prog_linfo.c",
68    "./src/bpf_tracing.h",
69    "./src/btf.c",
70    "./src/btf.h",
71    "./src/btf_dump.c",
72    "./src/elf.c",
73    "./src/gen_loader.c",
74    "./src/hashmap.c",
75    "./src/hashmap.h",
76    "./src/libbpf.c",
77    "./src/libbpf.h",
78    "./src/libbpf_common.h",
79    "./src/libbpf_errno.c",
80    "./src/libbpf_internal.h",
81    "./src/libbpf_legacy.h",
82    "./src/libbpf_probes.c",
83    "./src/libbpf_version.h",
84    "./src/netlink.c",
85    "./src/nlattr.c",
86    "./src/nlattr.h",
87    "./src/relo_core.c",
88    "./src/relo_core.h",
89    "./src/ringbuf.c",
90    "./src/skel_internal.h",
91    "./src/str_error.c",
92    "./src/str_error.h",
93    "./src/strset.c",
94    "./src/strset.h",
95    "./src/zip.c",
96  ]
97  configs = [ ":libbpf_config" ]
98  public_configs = [ ":libbpf_public_config" ]
99  output_extension = "so"
100  subsystem_name = "${THIRDPARTY_LIBBPF_SUBSYS_NAME}"
101  part_name = "${THIRDPARTY_LIBBPF_PART_NAME}"
102  install_enable = true
103  license_file = "LICENSE.BSD-2-Clause"
104}
105