Makefile 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. #
  2. # Copyright (C) 2009-2017 OpenWrt.org
  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. include $(INCLUDE_DIR)/kernel.mk
  9. PKG_NAME:=xtables-addons
  10. PKG_VERSION:=2.12
  11. PKG_RELEASE:=1
  12. PKG_MD5SUM:=aed5ce0873709ac243f1177fc81ff452
  13. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  14. PKG_SOURCE_URL:=@SF/xtables-addons
  15. PKG_BUILD_DEPENDS:=iptables
  16. PKG_INSTALL:=1
  17. PKG_BUILD_PARALLEL:=1
  18. PKG_LICENSE:=GPL-2.0
  19. include $(INCLUDE_DIR)/package.mk
  20. define Package/xtables-addons
  21. SECTION:=net
  22. CATEGORY:=Network
  23. SUBMENU:=Firewall
  24. TITLE:=Extensions not distributed in the main Xtables
  25. URL:=http://xtables-addons.sourceforge.net/
  26. endef
  27. # uses GNU configure
  28. CONFIGURE_ARGS+= \
  29. --with-kbuild="$(LINUX_DIR)" \
  30. --with-xtlibdir="/usr/lib/iptables" \
  31. define Build/Compile
  32. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  33. ARCH="$(LINUX_KARCH)" \
  34. CROSS_COMPILE="$(TARGET_CROSS)" \
  35. DESTDIR="$(PKG_INSTALL_DIR)" \
  36. DEPMOD="/bin/true" \
  37. all
  38. endef
  39. define Build/Install
  40. $(MAKE) -C $(PKG_BUILD_DIR) \
  41. ARCH="$(LINUX_KARCH)" \
  42. CROSS_COMPILE="$(TARGET_CROSS)" \
  43. DESTDIR="$(PKG_INSTALL_DIR)" \
  44. DEPMOD="/bin/true" \
  45. install
  46. endef
  47. # 1: extension/module suffix used in package name
  48. # 2: extension/module display name used in package title/description
  49. # 3: list of extensions to package
  50. # 4: list of modules to package
  51. # 5: module load priority
  52. # 6: module depends
  53. define BuildTemplate
  54. ifneq ($(3),)
  55. define Package/iptables-mod-$(1)
  56. $$(call Package/xtables-addons)
  57. CATEGORY:=Network
  58. TITLE:=$(2) iptables extension
  59. DEPENDS:=iptables $(if $(4),+kmod-ipt-$(1))
  60. endef
  61. define Package/iptables-mod-$(1)/install
  62. $(INSTALL_DIR) $$(1)/usr/lib/iptables
  63. for m in $(3); do \
  64. $(CP) \
  65. $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so \
  66. $$(1)/usr/lib/iptables/ ; \
  67. done
  68. endef
  69. $$(eval $$(call BuildPackage,iptables-mod-$(1)))
  70. endif
  71. ifneq ($(4),)
  72. define KernelPackage/ipt-$(1)
  73. SUBMENU:=Netfilter Extensions
  74. TITLE:=$(2) netfilter module
  75. DEPENDS:=+kmod-ipt-core $(5)
  76. KCONFIG:=$(6)
  77. FILES:=$(foreach mod,$(4),$(PKG_BUILD_DIR)/extensions/$(mod).$(LINUX_KMOD_SUFFIX))
  78. AUTOLOAD:=$(call AutoProbe,$(notdir $(4)))
  79. endef
  80. $$(eval $$(call KernelPackage,ipt-$(1)))
  81. endif
  82. endef
  83. define Package/iptaccount
  84. $(call Package/xtables-addons)
  85. CATEGORY:=Network
  86. TITLE:=iptables-mod-account control utility
  87. DEPENDS:=iptables +iptables-mod-account
  88. endef
  89. define Package/iptaccount/install
  90. $(INSTALL_DIR) $(1)/usr/lib
  91. $(INSTALL_DIR) $(1)/usr/sbin
  92. $(CP) \
  93. $(PKG_INSTALL_DIR)/usr/lib/libxt_ACCOUNT_cl.so* \
  94. $(1)/usr/lib/
  95. $(CP) \
  96. $(PKG_INSTALL_DIR)/usr/sbin/iptaccount \
  97. $(1)/usr/sbin/
  98. endef
  99. #$(eval $(call BuildTemplate,SUFFIX,DESCRIPTION,EXTENSION,MODULE,PRIORITY,DEPENDS))
  100. $(eval $(call BuildTemplate,compat-xtables,API compatibilty layer,,compat_xtables,+IPV6:kmod-ip6tables,CONFIG_NF_CONNTRACK_MARK=y))
  101. $(eval $(call BuildTemplate,nathelper-rtsp,RTSP Conntrack and NAT,,rtsp/nf_conntrack_rtsp rtsp/nf_nat_rtsp,+kmod-ipt-conntrack-extra +kmod-ipt-nat))
  102. $(eval $(call BuildTemplate,account,ACCOUNT,xt_ACCOUNT,ACCOUNT/xt_ACCOUNT,+kmod-ipt-compat-xtables))
  103. $(eval $(call BuildTemplate,chaos,CHAOS,xt_CHAOS,xt_CHAOS,+kmod-ipt-compat-xtables +kmod-ipt-delude +kmod-ipt-tarpit))
  104. $(eval $(call BuildTemplate,condition,Condition,xt_condition,xt_condition,))
  105. $(eval $(call BuildTemplate,delude,DELUDE,xt_DELUDE,xt_DELUDE,+kmod-ipt-compat-xtables))
  106. $(eval $(call BuildTemplate,dhcpmac,DHCPMAC,xt_DHCPMAC,xt_DHCPMAC,+kmod-ipt-compat-xtables))
  107. $(eval $(call BuildTemplate,dnetmap,DNETMAP,xt_DNETMAP,xt_DNETMAP,+kmod-ipt-compat-xtables +kmod-ipt-nat))
  108. $(eval $(call BuildTemplate,fuzzy,fuzzy,xt_fuzzy,xt_fuzzy,))
  109. $(eval $(call BuildTemplate,geoip,geoip,xt_geoip,xt_geoip,))
  110. $(eval $(call BuildTemplate,iface,iface,xt_iface,xt_iface,))
  111. $(eval $(call BuildTemplate,ipmark,IPMARK,xt_IPMARK,xt_IPMARK,+kmod-ipt-compat-xtables))
  112. $(eval $(call BuildTemplate,ipp2p,IPP2P,xt_ipp2p,xt_ipp2p,+kmod-ipt-compat-xtables))
  113. $(eval $(call BuildTemplate,ipv4options,ipv4options,xt_ipv4options,xt_ipv4options,))
  114. $(eval $(call BuildTemplate,length2,length2,xt_length2,xt_length2,+kmod-ipt-compat-xtables))
  115. $(eval $(call BuildTemplate,logmark,LOGMARK,xt_LOGMARK,xt_LOGMARK,+kmod-ipt-compat-xtables))
  116. $(eval $(call BuildTemplate,lscan,lscan,xt_lscan,xt_lscan,))
  117. $(eval $(call BuildTemplate,lua,Lua PacketScript,xt_LUA,LUA/xt_LUA,+kmod-ipt-conntrack-extra))
  118. $(eval $(call BuildTemplate,psd,psd,xt_psd,xt_psd,))
  119. $(eval $(call BuildTemplate,quota2,quota2,xt_quota2,xt_quota2,))
  120. $(eval $(call BuildTemplate,sysrq,SYSRQ,xt_SYSRQ,xt_SYSRQ,+kmod-ipt-compat-xtables +kmod-crypto-hash))
  121. $(eval $(call BuildTemplate,tarpit,TARPIT,xt_TARPIT,xt_TARPIT,+kmod-ipt-compat-xtables))
  122. $(eval $(call BuildPackage,iptaccount))