2 # Copyright (C) 2020 Tony Ambardar <itugrok@yahoo.com>
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
13 PKG_SOURCE_URL
:=https
://github.com
/libbpf
/bpftool
15 PKG_SOURCE_DATE
:=7.1.0
16 PKG_SOURCE_VERSION
:=b01941c8f7890489f09713348a7d89567538504b
17 PKG_MIRROR_HASH
:=641fb337342e25ae784a3efe72c71d8c88600a326300d8d5834e26be21547015
18 PKG_ABI_VERSION
:=$(call abi_version_str
,$(PKG_SOURCE_DATE
))
20 PKG_MAINTAINER
:=Tony Ambardar
<itugrok@yahoo.com
>
26 include $(INCLUDE_DIR
)/package.mk
27 include $(INCLUDE_DIR
)/nls.mk
29 define Package
/bpftool
/Default
32 TITLE
:=bpftool
- eBPF subsystem utility
33 LICENSE
:=GPL-2.0
-only OR BSD-2-Clause
34 URL
:=http
://www.kernel.org
38 define Package
/bpftool-minimal
39 $(call Package
/bpftool
/Default
)
44 ALTERNATIVES
:=200:/usr
/sbin
/bpftool
:/usr
/libexec
/bpftool-minimal
47 define Package
/bpftool-full
48 $(call Package
/bpftool
/Default
)
52 ALTERNATIVES
:=300:/usr
/sbin
/bpftool
:/usr
/libexec
/bpftool-full
53 DEPENDS
+= +libbfd
+libopcodes
56 define Package
/bpftool-minimal
/description
57 A tool for inspection and simple manipulation of eBPF programs and maps.
60 define Package
/bpftool-full
/description
61 A tool for inspection and simple manipulation of eBPF programs and maps.
62 This full version uses libbfd and libopcodes to support disassembly of
63 eBPF programs and jited code.
69 TITLE
:=libbpf
- eBPF helper library
71 LICENSE
:=LGPL-2.1 OR BSD-2-Clause
72 ABI_VERSION
:=$(PKG_ABI_VERSION
)
73 URL
:=http
://www.kernel.org
77 define Package
/libbpf
/description
78 libbpf is a library for loading eBPF programs and reading and manipulating eBPF objects from user-space.
82 # LTO not compatible with DSO using PIC
83 ifneq ($(BUILD_VARIANT
),lib
)
84 TARGET_CFLAGS
+= -ffunction-sections
-fdata-sections
-flto
85 TARGET_LDFLAGS
+= -Wl
,--gc-sections
-flto
88 ifeq ($(BUILD_VARIANT
),full
)
95 EXTRA_CFLAGS
="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
96 LDFLAGS
="$(TARGET_LDFLAGS)"
99 OUTPUT
="$(PKG_BUILD_DIR)/" \
101 $(if
$(findstring c
,$(OPENWRT_VERBOSE
)),V
=1,V
='') \
104 feature-clang-bpf-co-re
=0 \
105 feature-libbfd
=$(full
) \
108 feature-disassembler-four-args
=1 \
109 feature-disassembler-init-styled
=0
111 ifeq ($(BUILD_VARIANT
),lib
)
112 MAKE_PATH
= libbpf
/src
117 define Build
/InstallDev
/libbpf
118 $(INSTALL_DIR
) $(1)/usr
/include/bpf
119 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/bpf
/*.h
$(1)/usr
/include/bpf
/
120 $(INSTALL_DIR
) $(1)/usr
/lib
121 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libbpf.
{a
,so
*} \
123 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
124 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/libbpf.
pc \
125 $(1)/usr
/lib
/pkgconfig
/
126 $(SED
) 's,/usr/include,$$$${prefix}/include,g' \
127 $(1)/usr
/lib
/pkgconfig
/libbpf.
pc
128 $(SED
) 's,/usr/lib,$$$${exec_prefix}/lib,g' \
129 $(1)/usr
/lib
/pkgconfig
/libbpf.
pc
132 ifeq ($(BUILD_VARIANT
),lib
)
133 Build
/InstallDev
=$(Build
/InstallDev
/libbpf
)
136 define Package
/bpftool-
$(BUILD_VARIANT
)/install
137 $(INSTALL_DIR
) $(1)/usr
/libexec
138 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/bpftool \
139 $(1)/usr
/libexec
/bpftool-
$(BUILD_VARIANT
)
142 define Package
/libbpf
/install
143 $(INSTALL_DIR
) $(1)/usr
/lib
144 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libbpf.so.
* $(1)/usr
/lib
/
147 $(eval
$(call BuildPackage
,libbpf
))
148 $(eval
$(call BuildPackage
,bpftool-full
))
149 $(eval
$(call BuildPackage
,bpftool-minimal
))