fwknop: init script improvements
[feed/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 PKG_VERSION:=3.7
13 PKG_RELEASE:=2
14 PKG_HASH:=045ee3fcfe5d6edb95483cf49e2446ff8cab4bb79411018b18354138b70c5eb5
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 PKG_ASLR_PIE:=0
28
29 include $(INCLUDE_DIR)/package.mk
30
31 define Package/xtables-addons
32 SECTION:=net
33 CATEGORY:=Network
34 SUBMENU:=Firewall
35 TITLE:=Extensions not distributed in the main Xtables
36 URL:=http://xtables-addons.sourceforge.net/
37 endef
38
39 # uses GNU configure
40
41 CONFIGURE_ARGS+= \
42 --with-kbuild="$(LINUX_DIR)" \
43 --with-xtlibdir="/usr/lib/iptables"
44
45 ifdef CONFIG_EXTERNAL_TOOLCHAIN
46 MAKE_FLAGS:= \
47 $(patsubst ARCH=%,ARCH=$(LINUX_KARCH),$(MAKE_FLAGS)) \
48 DEPMOD="/bin/true"
49
50 MAKE_INSTALL_FLAGS:= \
51 $(patsubst ARCH=%,ARCH=$(LINUX_KARCH),$(MAKE_FLAGS)) \
52 DEPMOD="/bin/true"
53 else
54 define Build/Compile
55 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
56 $(KERNEL_MAKE_FLAGS) \
57 DESTDIR="$(PKG_INSTALL_DIR)" \
58 DEPMOD="/bin/true" \
59 all
60 endef
61
62 define Build/Install
63 $(MAKE) -C $(PKG_BUILD_DIR) \
64 $(KERNEL_MAKE_FLAGS) \
65 DESTDIR="$(PKG_INSTALL_DIR)" \
66 DEPMOD="/bin/true" \
67 install
68 endef
69 endif
70
71 # 1: extension/module suffix used in package name
72 # 2: extension/module display name used in package title/description
73 # 3: list of extensions to package
74 # 4: list of modules to package
75 # 5: module load priority
76 # 6: module depends
77 define BuildTemplate
78
79 ifneq ($(3),)
80 define Package/iptables-mod-$(1)
81 $$(call Package/xtables-addons)
82 CATEGORY:=Network
83 TITLE:=$(2) iptables extension
84 DEPENDS:=iptables $(if $(4),+kmod-ipt-$(1))
85 endef
86
87 define Package/iptables-mod-$(1)/install
88 $(INSTALL_DIR) $$(1)/usr/lib/iptables
89 for m in $(3); do \
90 $(CP) \
91 $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so \
92 $$(1)/usr/lib/iptables/ ; \
93 done
94 endef
95
96 $$(eval $$(call BuildPackage,iptables-mod-$(1)))
97 endif
98
99 ifneq ($(4),)
100 define KernelPackage/ipt-$(1)
101 SUBMENU:=Netfilter Extensions
102 TITLE:=$(2) netfilter module
103 DEPENDS:=+kmod-ipt-core $(5)
104 FILES:=$(foreach mod,$(4),$(PKG_BUILD_DIR)/extensions/$(mod).$(LINUX_KMOD_SUFFIX))
105 AUTOLOAD:=$(call AutoProbe,$(notdir $(4)))
106 endef
107
108 $$(eval $$(call KernelPackage,ipt-$(1)))
109 endif
110
111 endef
112
113
114 define Package/iptaccount
115 $(call Package/xtables-addons)
116 CATEGORY:=Network
117 TITLE:=iptables-mod-account control utility
118 DEPENDS:=iptables +iptables-mod-account
119 endef
120
121 define Package/iptaccount/install
122 $(INSTALL_DIR) $(1)/usr/lib
123 $(INSTALL_DIR) $(1)/usr/sbin
124 $(CP) \
125 $(PKG_INSTALL_DIR)/usr/lib/libxt_ACCOUNT_cl.so* \
126 $(1)/usr/lib/
127 $(CP) \
128 $(PKG_INSTALL_DIR)/usr/sbin/iptaccount \
129 $(1)/usr/sbin/
130 endef
131
132
133 define Package/iptgeoip
134 $(call Package/xtables-addons)
135 CATEGORY:=Network
136 TITLE:=iptables-mod-geoip support scripts for MaxMind GeoIP databases
137 # we could also use wget-nossl but that's more complicated than our
138 # syntax of dependencies permits...
139 DEPENDS:=iptables +iptables-mod-geoip \
140 +perl +perlbase-getopt +perlbase-io +perl-text-csv_xs \
141 +!BUSYBOX_CONFIG_WGET:wget +!BUSYBOX_CONFIG_GZIP:gzip +!BUSYBOX_CONFIG_UNZIP:unzip
142 endef
143
144 define Package/iptgeoip/install
145 $(INSTALL_DIR) $(1)/usr/lib/xtables-addons
146 $(CP) \
147 $(PKG_INSTALL_DIR)/usr/lib/xtables-addons/xt_geoip_{build,dl} \
148 $(1)/usr/lib/xtables-addons/
149 $(INSTALL_DIR) $(1)/usr/share/xt_geoip
150 endef
151
152
153 #$(eval $(call BuildTemplate,SUFFIX,DESCRIPTION,EXTENSION,MODULE,PRIORITY,DEPENDS))
154
155 $(eval $(call BuildTemplate,compat-xtables,API compatibilty layer,,compat_xtables,+IPV6:kmod-ip6tables))
156 $(eval $(call BuildTemplate,nathelper-rtsp,RTSP Conntrack and NAT,,rtsp/nf_conntrack_rtsp rtsp/nf_nat_rtsp,+kmod-ipt-conntrack-extra +kmod-ipt-nat))
157
158 $(eval $(call BuildTemplate,account,ACCOUNT,xt_ACCOUNT,ACCOUNT/xt_ACCOUNT,+kmod-ipt-compat-xtables))
159 $(eval $(call BuildTemplate,chaos,CHAOS,xt_CHAOS,xt_CHAOS,+kmod-ipt-compat-xtables +kmod-ipt-delude +kmod-ipt-tarpit))
160 $(eval $(call BuildTemplate,condition,Condition,xt_condition,xt_condition,))
161 $(eval $(call BuildTemplate,delude,DELUDE,xt_DELUDE,xt_DELUDE,+kmod-ipt-compat-xtables))
162 $(eval $(call BuildTemplate,dhcpmac,DHCPMAC,xt_DHCPMAC,xt_DHCPMAC,+kmod-ipt-compat-xtables))
163 $(eval $(call BuildTemplate,dnetmap,DNETMAP,xt_DNETMAP,xt_DNETMAP,+kmod-ipt-compat-xtables +kmod-ipt-nat))
164 $(eval $(call BuildTemplate,fuzzy,fuzzy,xt_fuzzy,xt_fuzzy,))
165 $(eval $(call BuildTemplate,geoip,geoip,xt_geoip,xt_geoip,))
166 $(eval $(call BuildTemplate,iface,iface,xt_iface,xt_iface,))
167 $(eval $(call BuildTemplate,ipmark,IPMARK,xt_IPMARK,xt_IPMARK,+kmod-ipt-compat-xtables))
168 $(eval $(call BuildTemplate,ipp2p,IPP2P,xt_ipp2p,xt_ipp2p,+kmod-ipt-compat-xtables))
169 $(eval $(call BuildTemplate,ipv4options,ipv4options,xt_ipv4options,xt_ipv4options,))
170 $(eval $(call BuildTemplate,length2,length2,xt_length2,xt_length2,+kmod-ipt-compat-xtables))
171 $(eval $(call BuildTemplate,logmark,LOGMARK,xt_LOGMARK,xt_LOGMARK,+kmod-ipt-compat-xtables))
172 $(eval $(call BuildTemplate,lscan,lscan,xt_lscan,xt_lscan,))
173 $(eval $(call BuildTemplate,lua,Lua PacketScript,xt_LUA,LUA/xt_LUA,+kmod-ipt-conntrack-extra))
174 $(eval $(call BuildTemplate,proto,PROTO,xt_PROTO,xt_PROTO,))
175 $(eval $(call BuildTemplate,psd,psd,xt_psd,xt_psd,))
176 $(eval $(call BuildTemplate,quota2,quota2,xt_quota2,xt_quota2,))
177 $(eval $(call BuildTemplate,sysrq,SYSRQ,xt_SYSRQ,xt_SYSRQ,+kmod-ipt-compat-xtables +kmod-crypto-hash))
178 $(eval $(call BuildTemplate,tarpit,TARPIT,xt_TARPIT,xt_TARPIT,+kmod-ipt-compat-xtables))
179
180 $(eval $(call BuildPackage,iptaccount))
181 $(eval $(call BuildPackage,iptgeoip))