Makefile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #
  2. # Copyright (C) 2020-2023 Tony Ambardar <[email protected]>
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=bpftools
  9. PKG_VERSION:=7.2.0
  10. PKG_RELEASE:=1
  11. PKG_SOURCE_URL:=https://github.com/libbpf/bpftool
  12. PKG_SOURCE_PROTO:=git
  13. PKG_SOURCE_VERSION:=19ff0564980a7429e730f6987a0b0bf418b3c676
  14. PKG_MIRROR_HASH:=f9b9871f64986dd2e5dab7060bb919398256ba93964da49c62efaf0e6bc9bbc4
  15. PKG_MAINTAINER:=Tony Ambardar <[email protected]>
  16. PKG_BUILD_FLAGS:=no-mips16
  17. PKG_BUILD_PARALLEL:=1
  18. PKG_INSTALL:=1
  19. include $(INCLUDE_DIR)/package.mk
  20. include $(INCLUDE_DIR)/nls.mk
  21. define Package/bpftool/Default
  22. SECTION:=net
  23. CATEGORY:=Network
  24. TITLE:=bpftool - eBPF subsystem utility
  25. LICENSE:=GPL-2.0-only OR BSD-2-Clause
  26. URL:=http://www.kernel.org
  27. DEPENDS:=+libelf
  28. endef
  29. define Package/bpftool-minimal
  30. $(call Package/bpftool/Default)
  31. TITLE+= (Minimal)
  32. VARIANT:=minimal
  33. DEFAULT_VARIANT:=1
  34. PROVIDES:=bpftool
  35. ALTERNATIVES:=200:/usr/sbin/bpftool:/usr/libexec/bpftool-minimal
  36. endef
  37. define Package/bpftool-full
  38. $(call Package/bpftool/Default)
  39. TITLE+= (Full)
  40. VARIANT:=full
  41. PROVIDES:=bpftool
  42. ALTERNATIVES:=300:/usr/sbin/bpftool:/usr/libexec/bpftool-full
  43. DEPENDS+= +libbfd +libopcodes
  44. endef
  45. define Package/bpftool-minimal/description
  46. A tool for inspection and simple manipulation of eBPF programs and maps.
  47. endef
  48. define Package/bpftool-full/description
  49. A tool for inspection and simple manipulation of eBPF programs and maps.
  50. This full version uses libbfd and libopcodes to support disassembly of
  51. eBPF programs and jited code.
  52. endef
  53. TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
  54. TARGET_LDFLAGS += -Wl,--gc-sections -flto
  55. ifeq ($(BUILD_VARIANT),full)
  56. full:=1
  57. else
  58. full:=0
  59. endif
  60. MAKE_VARS = \
  61. EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
  62. LDFLAGS="$(TARGET_LDFLAGS)"
  63. MAKE_FLAGS += \
  64. OUTPUT="$(PKG_BUILD_DIR)/" \
  65. prefix="/usr" \
  66. $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
  67. check_feat=0 \
  68. feature-clang-bpf-co-re=0 \
  69. feature-libbfd=$(full) \
  70. feature-llvm=0 \
  71. feature-libcap=0 \
  72. feature-disassembler-four-args=1 \
  73. feature-disassembler-init-styled=1
  74. MAKE_PATH = src
  75. define Package/bpftool-$(BUILD_VARIANT)/install
  76. $(INSTALL_DIR) $(1)/usr/libexec
  77. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/bpftool \
  78. $(1)/usr/libexec/bpftool-$(BUILD_VARIANT)
  79. endef
  80. $(eval $(call BuildPackage,bpftool-full))
  81. $(eval $(call BuildPackage,bpftool-minimal))