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