avoid includes that aren't required for current target (make download)
[openwrt.git] / package / iptables / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4 include $(INCLUDE_DIR)/kernel.mk
5
6 PKG_NAME:=iptables
7 PKG_VERSION:=1.3.5
8 PKG_RELEASE:=1
9
10 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
11 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
12 PKG_SOURCE_URL:=http://www.netfilter.org/projects/iptables/files \
13 ftp://ftp.be.netfilter.org/pub/netfilter/iptables/ \
14 ftp://ftp.de.netfilter.org/pub/netfilter/iptables/ \
15 ftp://ftp.no.netfilter.org/pub/netfilter/iptables/
16 PKG_MD5SUM:=00fb916fa8040ca992a5ace56d905ea5
17 PKG_CAT:=bzcat
18
19 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
20
21 PKG_MENU:=IPv4 / IPv6 firewall administration
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Package/iptables
26 SECTION:=net
27 CATEGORY:=Base system
28 MENU:=1
29 DEFAULT:=y
30 TITLE:=IPv4 firewall administration tool
31 URL:=http://netfilter.org/
32 endef
33
34 define Package/iptables/conffiles
35 /etc/config/firewall
36 /etc/firewall.user
37 endef
38
39 define Package/iptables-mod-conntrack
40 SECTION:=net
41 CATEGORY:=Base system
42 DEPENDS:=iptables
43 TITLE:=connection tracking modules
44 DESCRIPTION:=iptables extensions for connection tracking \\\
45 Includes: \\\
46 * libipt_conntrack \\\
47 * libipt_helper \\\
48 * libipt_connmark/CONNMARK
49 endef
50
51 define Package/iptables-mod-filter
52 SECTION:=net
53 CATEGORY:=Base system
54 DEPENDS:=iptables
55 TITLE:=filter modules
56 DESCRIPTION:=iptables extensions for packet content inspection\\\
57 Includes: \\\
58 * libipt_ipp2p \\\
59 * libipt_layer7
60 endef
61
62 define Package/iptables-mod-imq
63 SECTION:=net
64 CATEGORY:=Base system
65 DEPENDS:=iptables
66 TITLE:=IMQ support
67 DESCRIPTION:=iptables extension for IMQ support\\\
68 Includes: \\\
69 * libipt_IMQ
70 endef
71
72 define Package/iptables-mod-ipopt
73 SECTION:=net
74 CATEGORY:=Base system
75 DEPENDS:=iptables
76 TITLE:=IP/Packet option modules
77 DESCRIPTION:=iptables extensions for matching/changing IP packet options\\\
78 Includes: \\\
79 * libipt_dscp/DSCP \\\
80 * libipt_ecn/ECN \\\
81 * libipt_length \\\
82 * libipt_mac \\\
83 * libipt_tos/TOS \\\
84 * libipt_tcpmms \\\
85 * libipt_ttl/TTL \\\
86 * libipt_unclean
87 endef
88
89 define Package/iptables-mod-ipsec
90 SECTION:=net
91 CATEGORY:=Base system
92 DEPENDS:=iptables
93 TITLE:=IPSec extensions
94 DESCRIPTION:=iptables extensions for matching ipsec traffic\\\
95 Includes: \\\
96 * libipt_ah \\\
97 * libipt_esp
98 endef
99
100 define Package/iptables-mod-nat
101 SECTION:=net
102 CATEGORY:=Base system
103 DEPENDS:=iptables
104 TITLE:=extra NAT targets
105 DESCRIPTION:=iptables extensions for different NAT targets\\\
106 Includes: \\\
107 * libipt_REDIRECT
108 endef
109
110 define Package/iptables-mod-ulog
111 SECTION:=net
112 CATEGORY:=Base system
113 DEPENDS:=iptables
114 TITLE:=user-space packet logging
115 DESCRIPTION:=iptables extensions for user-space packet logging\\\
116 Includes: \\\
117 * libipt_ULOG
118 endef
119
120 define Package/iptables-mod-extra
121 SECTION:=net
122 CATEGORY:=Base system
123 DEPENDS:=iptables
124 TITLE:=other extra iptables extensions
125 DESCRIPTION:=other extra iptables extensions\\\
126 Includes: \\\
127 * libipt_limit \\\
128 * libipt_owner \\\
129 * libipt_physdev \\\
130 * libipt_pkttype \\\
131 * libipt_recent
132 endef
133
134 define Package/iptables-utils
135 SECTION:=net
136 CATEGORY:=Base system
137 DEPENDS:=iptables
138 TITLE:=iptables save and restore utilities
139 endef
140
141 define Package/ip6tables
142 SECTION:=net
143 CATEGORY:=Base system
144 TITLE:=IPv6 firewall administration tool
145 endef
146
147
148 define Build/Configure
149 endef
150
151 define Build/Compile
152 chmod a+x $(PKG_BUILD_DIR)/extensions/.*-test*
153 mkdir -p $(PKG_INSTALL_DIR)
154 $(MAKE) -C $(PKG_BUILD_DIR) \
155 $(TARGET_CONFIGURE_OPTS) \
156 CC=$(TARGET_CC) COPT_FLAGS="$(TARGET_CFLAGS)" \
157 KERNEL_DIR=$(LINUX_DIR) PREFIX=/usr \
158 DESTDIR="$(PKG_INSTALL_DIR)" \
159 all install install-devel
160 endef
161
162
163 define Build/InstallDev
164 $(MAKE) -C $(PKG_BUILD_DIR) \
165 $(TARGET_CONFIGURE_OPTS) \
166 CC=$(TARGET_CC) COPT_FLAGS="$(TARGET_CFLAGS)" \
167 KERNEL_DIR=$(LINUX_DIR) PREFIX=/usr \
168 DESTDIR="$(STAGING_DIR)" \
169 install install-devel
170 endef
171
172 define Build/UninstallDev
173 rm -rf $(STAGING_DIR)/usr/include/libipq.h
174 rm -rf $(STAGING_DIR)/usr/lib/libipq.a
175 endef
176
177
178 define Package/iptables/install
179 install -d -m0755 $(1)/etc/config
180 install -m0644 ./files/firewall.config $(1)/etc/config/firewall
181 install -d -m0755 $(1)/etc/init.d
182 install -m0755 ./files/firewall.init $(1)/etc/init.d/S45firewall
183 install -m0755 ./files/firewall.user $(1)/etc/
184 install -d -m0755 $(1)/usr/lib
185 install -m0644 ./files/firewall.awk $(1)/usr/lib
186 install -d -m0755 $(1)/usr/sbin
187 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables $(1)/usr/sbin/
188 install -d -m0755 $(1)/usr/lib/iptables
189 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
190 $(CP) $(patsubst %,lib%.so,$(IPT_BUILTIN:xt_%=ipt_%)) $(1)/usr/lib/iptables/ \
191 )
192 $(RSTRIP) $(1)
193 endef
194
195 define Package/iptables-utils/install
196 install -d -m0755 $(1)/usr/sbin
197 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables-{save,restore} $(1)/usr/sbin/
198 $(RSTRIP) $(1)
199 endef
200
201 define Package/ip6tables/install
202 install -d -m0755 $(1)/usr/sbin
203 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables $(1)/usr/sbin/
204 install -d -m0755 $(1)/usr/lib/iptables
205 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
206 $(CP) libip6t_*.so $(1)/usr/lib/iptables/ \
207 )
208 $(RSTRIP) $(1)
209 endef
210
211 define BuildPlugin
212 include $(LINUX_DIR)/.config
213 include $(INCLUDE_DIR)/netfilter.mk
214
215 define Package/$(1)/install
216 install -m0755 -d $$(1)/usr/lib/iptables
217 for m in $$(patsubst xt_%,ipt_%,$(2)); do \
218 $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so $$(1)/usr/lib/iptables/ ; \
219 done
220 $(3)
221 $(RSTRIP) $$(1)
222 endef
223
224 $$(eval $$(call BuildPackage,$(1)))
225 endef
226
227 L7_INSTALL:=mkdir -p $$(1)/etc/l7-protocols; \
228 $(CP) files/l7/*.pat $$(1)/etc/l7-protocols/
229
230 $(eval $(call BuildPackage,iptables))
231 $(eval $(call BuildPackage,iptables-utils))
232 $(eval $(call BuildPlugin,iptables-mod-conntrack,$(IPT_CONNTRACK-m)))
233 $(eval $(call BuildPlugin,iptables-mod-extra,$(IPT_EXTRA-m)))
234 $(eval $(call BuildPlugin,iptables-mod-filter,$(IPT_FILTER-m),$(L7_INSTALL)))
235 $(eval $(call BuildPlugin,iptables-mod-imq,$(IPT_IMQ-m)))
236 $(eval $(call BuildPlugin,iptables-mod-ipopt,$(IPT_IPOPT-m)))
237 $(eval $(call BuildPlugin,iptables-mod-ipsec,$(IPT_IPSEC-m)))
238 $(eval $(call BuildPlugin,iptables-mod-nat,$(IPT_NAT-m)))
239 $(eval $(call BuildPlugin,iptables-mod-ulog,$(IPT_ULOG-m)))
240 $(eval $(call BuildPackage,ip6tables))
This page took 0.05803 seconds and 5 git commands to generate.