Makefile 4.8 KB

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