Makefile 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #
  2. # Copyright (C) 2020-2024 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:=bpftool
  9. PKG_VERSION:=7.5.0
  10. PKG_RELEASE:=1
  11. PKG_SOURCE_URL:=https://github.com/libbpf/bpftool
  12. PKG_MIRROR_HASH:=1da7c08959e7819772145774322ffd876f3180065be1c3759336dca98ac9f666
  13. PKG_SOURCE_PROTO:=git
  14. PKG_SOURCE_VERSION:=v$(PKG_VERSION)
  15. PKG_MAINTAINER:=Tony Ambardar <[email protected]>
  16. PKG_BUILD_FLAGS:=no-mips16 gc-sections lto
  17. PKG_BUILD_PARALLEL:=1
  18. PKG_INSTALL:=1
  19. HOST_BUILD_PARALLEL:=1
  20. include $(INCLUDE_DIR)/package.mk
  21. include $(INCLUDE_DIR)/nls.mk
  22. include $(INCLUDE_DIR)/host-build.mk
  23. define Package/bpftool/Default
  24. SECTION:=net
  25. CATEGORY:=Network
  26. TITLE:=bpftool - eBPF subsystem utility
  27. LICENSE:=GPL-2.0-only OR BSD-2-Clause
  28. URL:=http://www.kernel.org
  29. DEPENDS:=+libelf
  30. endef
  31. define Package/bpftool-minimal
  32. $(call Package/bpftool/Default)
  33. TITLE+= (Minimal)
  34. VARIANT:=minimal
  35. DEFAULT_VARIANT:=1
  36. PROVIDES:=bpftool
  37. ALTERNATIVES:=200:/usr/sbin/bpftool:/usr/libexec/bpftool-minimal
  38. endef
  39. define Package/bpftool-full
  40. $(call Package/bpftool/Default)
  41. TITLE+= (Full)
  42. VARIANT:=full
  43. PROVIDES:=bpftool
  44. ALTERNATIVES:=300:/usr/sbin/bpftool:/usr/libexec/bpftool-full
  45. DEPENDS+= +libbfd +libopcodes
  46. endef
  47. define Package/bpftool-minimal/description
  48. A tool for inspection and simple manipulation of eBPF programs and maps.
  49. endef
  50. define Package/bpftool-full/description
  51. A tool for inspection and simple manipulation of eBPF programs and maps.
  52. This full version uses libbfd and libopcodes to support disassembly of
  53. eBPF programs and jited code.
  54. endef
  55. ifeq ($(BUILD_VARIANT),full)
  56. full:=1
  57. else
  58. full:=0
  59. endif
  60. MAKE_FLAGS += \
  61. OUTPUT="$(PKG_BUILD_DIR)/" \
  62. prefix="/usr" \
  63. $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
  64. check_feat=0 \
  65. feature-clang-bpf-co-re=0 \
  66. feature-libbfd=$(full) \
  67. feature-llvm=0 \
  68. feature-libcap=0 \
  69. feature-disassembler-four-args=1 \
  70. feature-disassembler-init-styled=1
  71. MAKE_PATH = src
  72. define Package/bpftool-$(BUILD_VARIANT)/install
  73. $(INSTALL_DIR) $(1)/usr/libexec
  74. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/bpftool \
  75. $(1)/usr/libexec/bpftool-$(BUILD_VARIANT)
  76. endef
  77. HOST_MAKE_FLAGS += \
  78. OUTPUT="$(HOST_BUILD_DIR)/" \
  79. prefix="/usr" \
  80. $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
  81. check_feat=0 \
  82. feature-clang-bpf-co-re=0 \
  83. feature-libbfd=0 \
  84. feature-llvm=0 \
  85. feature-libcap=0 \
  86. feature-disassembler-four-args=1 \
  87. feature-disassembler-init-styled=1
  88. HOST_MAKE_PATH = src
  89. define Host/Install
  90. $(INSTALL_DIR) $(STAGING_DIR_HOST)/usr/sbin
  91. $(INSTALL_BIN) $(HOST_BUILD_DIR)/bpftool \
  92. $(STAGING_DIR_HOST)/usr/sbin/bpftool
  93. endef
  94. define Host/Clean
  95. rm -f $(STAGING_DIR_HOST)/usr/sbin/bpftool
  96. endef
  97. $(eval $(call BuildPackage,bpftool-full))
  98. $(eval $(call BuildPackage,bpftool-minimal))
  99. $(eval $(call HostBuild))