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