xtables-addons: update to v2.1, fix compilation against Linux 3.7.2, refresh patches
[packages.git] / net / xtables-addons / Makefile
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
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=xtables-addons
12 ifeq ($(strip $(call CompareKernelPatchVer,$(KERNEL_PATCHVER),ge,3.7.0)),1)
13 PKG_VERSION:=2.1
14 PKG_RELEASE:=1
15 PKG_MD5SUM:=b624fc57bbda9e15c33a6471e4ec75e1
16 else
17 PKG_VERSION:=1.45
18 PKG_RELEASE:=3
19 PKG_MD5SUM:=802d2f556a5e545f44e4b69937bf8490
20 PATCH_DIR:=./patches-1.x
21 endif
22
23 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
24 PKG_SOURCE_URL:=@SF/xtables-addons
25 PKG_BUILD_DEPENDS:=iptables
26 PKG_INSTALL:=1
27 PKG_BUILD_PARALLEL:=1
28
29 PKG_FIXUP:=autoreconf
30
31 include $(INCLUDE_DIR)/package.mk
32
33 define Package/xtables-addons
34   SECTION:=net
35   CATEGORY:=Network
36   SUBMENU:=Firewall
37   TITLE:=Extensions not distributed in the main Xtables
38   URL:=http://xtables-addons.sourceforge.net/
39 endef
40
41 # uses GNU configure
42
43 CONFIGURE_ARGS+= \
44         --with-kbuild="$(LINUX_DIR)" \
45         --with-xtables="$(STAGING_DIR)/usr" \
46         --with-xtlibdir="/usr/lib/iptables" \
47
48 define Build/Compile
49         +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
50                 ARCH="$(LINUX_KARCH)" \
51                 CROSS_COMPILE="$(TARGET_CROSS)" \
52                 DESTDIR="$(PKG_INSTALL_DIR)" \
53                 DEPMOD="/bin/true" \
54                 all
55 endef
56
57 define Build/Install
58         $(MAKE) -C $(PKG_BUILD_DIR) \
59                 ARCH="$(LINUX_KARCH)" \
60                 CROSS_COMPILE="$(TARGET_CROSS)" \
61                 DESTDIR="$(PKG_INSTALL_DIR)" \
62                 DEPMOD="/bin/true" \
63                 install
64 endef
65
66 # 1: extension/module suffix used in package name
67 # 2: extension/module display name used in package title/description
68 # 3: list of extensions to package
69 # 4: list of modules to package
70 # 5: module load priority
71 # 6: module depends
72 define BuildTemplate
73
74  ifneq ($(3),)
75   define Package/iptables-mod-$(1)
76     $$(call Package/xtables-addons)
77     CATEGORY:=Network
78     TITLE:=$(2) iptables extension
79     DEPENDS:=iptables $(if $(4),+kmod-ipt-$(1))
80   endef
81
82   define Package/iptables-mod-$(1)/install
83         $(INSTALL_DIR) $$(1)/usr/lib/iptables
84         for m in $(3); do \
85                 $(CP) \
86                         $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so \
87                         $$(1)/usr/lib/iptables/ ; \
88         done
89   endef
90
91   $$(eval $$(call BuildPackage,iptables-mod-$(1)))
92  endif
93
94  ifneq ($(4),)
95   define KernelPackage/ipt-$(1)
96     SUBMENU:=Netfilter Extensions
97     TITLE:=$(2) netfilter module
98     DEPENDS:=kmod-ipt-core $(6)
99     KCONFIG:=$(7)
100     FILES:=$(foreach mod,$(4),$(PKG_BUILD_DIR)/extensions/$(mod).$(LINUX_KMOD_SUFFIX))
101     AUTOLOAD:=$(call AutoLoad,$(5),$(notdir $(4)))
102   endef
103
104   $$(eval $$(call KernelPackage,ipt-$(1)))
105  endif
106
107 endef
108
109
110 define Package/iptaccount
111   $(call Package/xtables-addons)
112   CATEGORY:=Network
113   TITLE:=iptables-mod-account control utility
114   DEPENDS:=iptables +iptables-mod-account
115 endef
116
117 define Package/iptaccount/install
118         $(INSTALL_DIR) $(1)/usr/lib
119         $(INSTALL_DIR) $(1)/usr/sbin
120         $(CP) \
121                 $(PKG_INSTALL_DIR)/usr/lib/libxt_ACCOUNT_cl.so* \
122                 $(1)/usr/lib/
123         $(CP) \
124                 $(PKG_INSTALL_DIR)/usr/sbin/iptaccount \
125                 $(1)/usr/sbin/
126 endef
127
128
129 #$(eval $(call BuildTemplate,SUFFIX,DESCRIPTION,EXTENSION,MODULE,PRIORITY,DEPENDS))
130
131 $(eval $(call BuildTemplate,compat-xtables,API compatibilty layer,,compat_xtables,45,,CONFIG_NF_CONNTRACK_MARK=y))
132 $(eval $(call BuildTemplate,rawpost,RAWPOST,,iptable_rawpost $(if $(CONFIG_IPV6),ip6table_rawpost),50,+kmod-ipt-compat-xtables +IPV6:kmod-ip6tables))
133 $(eval $(call BuildTemplate,nathelper-rtsp,RTSP Conntrack and NAT,,rtsp/nf_conntrack_rtsp rtsp/nf_nat_rtsp,46,+kmod-ipt-conntrack-extra))
134
135 $(eval $(call BuildTemplate,account,ACCOUNT,xt_ACCOUNT,ACCOUNT/xt_ACCOUNT,46,+kmod-ipt-compat-xtables))
136 $(eval $(call BuildTemplate,chaos,CHAOS,xt_CHAOS,xt_CHAOS,47,+kmod-ipt-compat-xtables +kmod-ipt-delude +kmod-ipt-tarpit))
137 $(eval $(call BuildTemplate,condition,Condition,xt_condition,xt_condition,46,))
138 $(eval $(call BuildTemplate,delude,DELUDE,xt_DELUDE,xt_DELUDE,46,+kmod-ipt-compat-xtables))
139 $(eval $(call BuildTemplate,dhcpmac,DHCPMAC,xt_DHCPMAC,xt_DHCPMAC,46,+kmod-ipt-compat-xtables))
140 $(eval $(call BuildTemplate,dnetmap,DNETMAP,xt_DNETMAP,xt_DNETMAP,46,+kmod-ipt-compat-xtables))
141 $(eval $(call BuildTemplate,fuzzy,fuzzy,xt_fuzzy,xt_fuzzy,46,))
142 $(eval $(call BuildTemplate,geoip,geoip,xt_geoip,xt_geoip,46,))
143 $(eval $(call BuildTemplate,iface,iface,xt_iface,xt_iface,46,))
144 $(eval $(call BuildTemplate,ipmark,IPMARK,xt_IPMARK,xt_IPMARK,46,+kmod-ipt-compat-xtables))
145 $(eval $(call BuildTemplate,ipp2p,IPP2P,xt_ipp2p,xt_ipp2p,46,+kmod-ipt-compat-xtables))
146 $(eval $(call BuildTemplate,ipv4options,ipv4options,xt_ipv4options,xt_ipv4options,46,))
147 $(eval $(call BuildTemplate,length2,length2,xt_length2,xt_length2,46,))
148 $(eval $(call BuildTemplate,logmark,LOGMARK,xt_LOGMARK,xt_LOGMARK,46,+kmod-ipt-compat-xtables))
149 $(eval $(call BuildTemplate,lscan,lscan,xt_lscan,xt_lscan,46,))
150 $(eval $(call BuildTemplate,lua,Lua PacketScript,xt_LUA,LUA/xt_LUA,46,+kmod-ipt-conntrack-extra))
151 $(eval $(call BuildTemplate,psd,psd,xt_psd,xt_psd,46,))
152 $(eval $(call BuildTemplate,quota2,quota2,xt_quota2,xt_quota2,46,))
153 $(eval $(call BuildTemplate,rawnat,RAWNAT,xt_RAWDNAT xt_RAWSNAT,xt_RAWNAT,46,+kmod-ipt-compat-xtables))
154 $(eval $(call BuildTemplate,steal,STEAL,xt_STEAL,xt_STEAL,46,+kmod-ipt-compat-xtables))
155 $(eval $(call BuildTemplate,sysrq,SYSRQ,xt_SYSRQ,xt_SYSRQ,46,+kmod-ipt-compat-xtables))
156 $(eval $(call BuildTemplate,tarpit,TARPIT,xt_TARPIT,xt_TARPIT,46,+kmod-ipt-compat-xtables))