bpftools: update, split off bpftool and libbpf packages
[openwrt/openwrt.git] / package / libs / libbpf / Makefile
1 #
2 # Copyright (C) 2020-2023 Tony Ambardar <itugrok@yahoo.com>
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=libbpf
11 PKG_VERSION:=1.2.0
12 PKG_RELEASE:=1
13
14 PKG_SOURCE_URL:=https://github.com/libbpf/libbpf
15 PKG_SOURCE_PROTO:=git
16 PKG_SOURCE_VERSION:=fbd60dbff51c870f5e80a17c4f2fd639eb80af90
17 PKG_MIRROR_HASH:=80a80dfba71576e017b596fb28068e2a92de629e426f063e4b37314c8d576336
18 PKG_ABI_VERSION:=$(firstword $(subst .,$(space),$(PKG_VERSION)))
19
20 PKG_MAINTAINER:=Tony Ambardar <itugrok@yahoo.com>
21
22 PKG_BUILD_FLAGS:=no-mips16
23 PKG_BUILD_PARALLEL:=1
24 PKG_INSTALL:=1
25
26 include $(INCLUDE_DIR)/package.mk
27 include $(INCLUDE_DIR)/nls.mk
28
29 define Package/libbpf
30 SECTION:=libs
31 CATEGORY:=Libraries
32 TITLE:=libbpf - eBPF helper library
33 LICENSE:=LGPL-2.1 OR BSD-2-Clause
34 ABI_VERSION:=$(PKG_ABI_VERSION)
35 URL:=http://www.kernel.org
36 DEPENDS:=+libelf
37 endef
38
39 define Package/libbpf/description
40 libbpf is a library for loading eBPF programs and reading and manipulating eBPF objects from user-space.
41 endef
42
43 MAKE_VARS = \
44 EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
45 LDFLAGS="$(TARGET_LDFLAGS)"
46
47 MAKE_FLAGS += \
48 $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
49 LIBSUBDIR=lib
50
51 MAKE_PATH = src
52
53 define Build/InstallDev/libbpf
54 $(INSTALL_DIR) $(1)/usr/include/bpf
55 $(CP) $(PKG_INSTALL_DIR)/usr/include/bpf/*.h $(1)/usr/include/bpf/
56 $(INSTALL_DIR) $(1)/usr/lib
57 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libbpf.{a,so*} \
58 $(1)/usr/lib/
59 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
60 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libbpf.pc \
61 $(1)/usr/lib/pkgconfig/
62 $(SED) 's,/usr/include,$$$${prefix}/include,g' \
63 $(1)/usr/lib/pkgconfig/libbpf.pc
64 $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' \
65 $(1)/usr/lib/pkgconfig/libbpf.pc
66 endef
67
68 Build/InstallDev=$(Build/InstallDev/libbpf)
69
70 define Package/libbpf/install
71 $(INSTALL_DIR) $(1)/usr/lib
72 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libbpf.so.* $(1)/usr/lib/
73 endef
74
75 $(eval $(call BuildPackage,libbpf))