[package] iptables: install libxtables.so and libiptc.so into staging dir
[openwrt.git] / package / iptables / Makefile
1 #
2 # Copyright (C) 2006-2008 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:=iptables
12
13 PKG_VERSION:=1.4.3.2
14 PKG_RELEASE:=1
15 PKG_MD5SUM:=545698693b636cfc844aafc6729fd48a
16
17 PKG_VERSION?=<IPTABLES_VERSION>
18
19 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
20 PKG_SOURCE_URL:=http://www.netfilter.org/projects/iptables/files \
21 ftp://ftp.be.netfilter.org/pub/netfilter/iptables/ \
22 ftp://ftp.de.netfilter.org/pub/netfilter/iptables/ \
23 ftp://ftp.no.netfilter.org/pub/netfilter/iptables/
24
25 PATCH_DIR:=./patches/$(PKG_VERSION)
26
27 include $(INCLUDE_DIR)/package.mk
28 ifeq ($(DUMP),)
29 -include $(LINUX_DIR)/.config
30 include $(INCLUDE_DIR)/netfilter.mk
31 STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell grep 'NETFILTER' $(LINUX_DIR)/.config | md5s)
32 endif
33
34
35 define Package/libiptc
36 SECTION:=libs
37 CATEGORY:=Libraries
38 URL:=http://netfilter.org/
39 TITLE:=IPv4/IPv6 firewall - shared libiptc library
40 endef
41
42 define Package/libxtables
43 SECTION:=libs
44 CATEGORY:=Libraries
45 URL:=http://netfilter.org/
46 TITLE:=IPv4/IPv6 firewall - shared xtables library
47 endef
48
49
50 define Package/iptables/Default
51 SECTION:=net
52 CATEGORY:=Base system
53 URL:=http://netfilter.org/
54 DEPENDS:=+libiptc +libxtables
55 endef
56
57 define Package/iptables/Module
58 $(call Package/iptables/Default)
59 DEPENDS:=iptables $(1)
60 endef
61
62 define Package/iptables
63 $(call Package/iptables/Default)
64 TITLE:=IPv4 firewall administration tool
65 MENU:=1
66 DEPENDS+= +kmod-ipt-core
67 endef
68
69 define Package/iptables/description
70 IPv4 firewall administration tool.
71 Includes support for:
72 - limit
73 - LOG
74 - mac
75 - multiport
76 - REJECT
77 - TCPMSS
78 endef
79
80 define Package/iptables-mod-conntrack
81 $(call Package/iptables/Module, +kmod-ipt-conntrack)
82 TITLE:=Basic connection tracking extensions
83 endef
84
85 define Package/iptables-mod-conntrack/description
86 Basic iptables extensions for connection tracking.
87 Includes:
88 - state
89 endef
90
91 define Package/iptables-mod-conntrack-extra
92 $(call Package/iptables/Module, +kmod-ipt-conntrack-extra)
93 TITLE:=Extra connection tracking extensions
94 endef
95
96 define Package/iptables-mod-conntrack-extra/description
97 Extra iptables extensions for connection tracking.
98 Includes:
99 - libipt_conntrack
100 - libipt_helper
101 - libipt_connmark/CONNMARK
102 endef
103
104 define Package/iptables-mod-filter
105 $(call Package/iptables/Module, +kmod-ipt-filter)
106 TITLE:=Content inspection extensions
107 endef
108
109 define Package/iptables-mod-filter/description
110 iptables extensions for packet content inspection.
111 Includes:
112 - libipt_string
113 - libipt_layer7
114 endef
115
116 define Package/iptables-mod-imq
117 $(call Package/iptables/Module, +kmod-ipt-imq)
118 TITLE:=IMQ support
119 endef
120
121 define Package/iptables-mod-imq/description
122 iptables extension for IMQ support.
123 Includes:
124 - libipt_IMQ
125 endef
126
127 define Package/iptables-mod-ipopt
128 $(call Package/iptables/Module, +kmod-ipt-ipopt)
129 TITLE:=IP/Packet option extensions
130 endef
131
132 define Package/iptables-mod-ipopt/description
133 iptables extensions for matching/changing IP packet options.
134 Includes:
135 - libipt_CLASSIFY
136 - libipt_dscp/DSCP
137 - libipt_ecn/ECN
138 - libipt_length
139 - libipt_mac
140 - libipt_mark/MARK
141 - libipt_statistic
142 - libipt_tcpmms
143 - libipt_tos/TOS
144 - libipt_ttl/TTL
145 - libipt_unclean
146 endef
147
148 define Package/iptables-mod-ipsec
149 $(call Package/iptables/Module, +kmod-ipt-ipsec)
150 TITLE:=IPsec extensions
151 endef
152
153 define Package/iptables-mod-ipsec/description
154 iptables extensions for matching ipsec traffic.
155 Includes:
156 - libipt_ah
157 - libipt_esp
158 - libipt_policy
159 endef
160
161 define Package/iptables-mod-nat
162 $(call Package/iptables/Module, +kmod-ipt-nat)
163 TITLE:=Basic NAT extensions
164 endef
165
166 define Package/iptables-mod-nat/description
167 iptables extensions for basic NAT targets.
168 Includes:
169 - MASQUERADE
170 - SNAT
171 - DNAT
172 endef
173
174 define Package/iptables-mod-nat-extra
175 $(call Package/iptables/Module, +kmod-ipt-nat-extra)
176 TITLE:=Extra NAT extensions
177 endef
178
179 define Package/iptables-mod-nat-extra/description
180 iptables extensions for extra NAT targets.
181 Includes:
182 - REDIRECT
183 endef
184
185 define Package/iptables-mod-ulog
186 $(call Package/iptables/Module, +kmod-ipt-ulog)
187 TITLE:=user-space packet logging
188 endef
189
190 define Package/iptables-mod-ulog/description
191 iptables extensions for user-space packet logging.
192 Includes:
193 - libipt_ULOG
194 endef
195
196 define Package/iptables-mod-iprange
197 $(call Package/iptables/Module, +kmod-ipt-iprange)
198 TITLE:=IP range extension
199 endef
200
201 define Package/iptables-mod-iprange/description
202 iptables extensions for matching ip ranges.
203 Includes:
204 - libipt_iprange
205 endef
206
207 define Package/iptables-mod-extra
208 $(call Package/iptables/Module, +kmod-ipt-extra)
209 TITLE:=Other extra iptables extensions
210 endef
211
212 define Package/iptables-mod-extra/description
213 other extra iptables extensions.
214 Includes:
215 - libipt_owner
216 - libipt_physdev
217 - libipt_pkttype
218 - libipt_recent
219 - iptable_raw
220 - libipt_NOTRACK
221 endef
222
223 define Package/iptables-mod-ipset
224 $(call Package/iptables/Module, +kmod-ipt-ipset)
225 TITLE:=IPset extension
226 endef
227
228 define Package/iptables-utils
229 $(call Package/iptables/Module, )
230 TITLE:=iptables save and restore utilities
231 endef
232
233 define Package/ip6tables
234 $(call Package/iptables/Default)
235 DEPENDS:=+kmod-ip6tables
236 CATEGORY:=IPv6
237 TITLE:=IPv6 firewall administration tool
238 MENU:=1
239 endef
240
241 define Package/ip6tables-utils
242 $(call Package/iptables/Default)
243 DEPENDS:=ip6tables
244 CATEGORY:=IPv6
245 TITLE:=ip6tables save and restore utilities
246 endef
247
248 define Build/Prepare
249 $(call Build/Prepare/Default)
250 endef
251
252 TARGET_CPPFLAGS := -I$(PKG_BUILD_DIR)/include $(TARGET_CPPFLAGS)
253 TARGET_CFLAGS += $(FPIC)
254 CONFIGURE_ARGS += \
255 --enable-devel \
256 --with-kernel="$(LINUX_DIR)" \
257 --with-xtlibdir=/usr/lib/iptables
258
259 define Build/Compile
260 mkdir -p $(PKG_INSTALL_DIR)
261 $(MAKE) -C $(PKG_BUILD_DIR) \
262 $(TARGET_CONFIGURE_OPTS) \
263 COPT_FLAGS="$(TARGET_CFLAGS)" \
264 LDFLAGS="-rdynamic -static-libgcc" \
265 KERNEL_DIR="$(LINUX_DIR)" PREFIX=/usr \
266 KBUILD_OUTPUT="$(LINUX_DIR)" \
267 DESTDIR="$(PKG_INSTALL_DIR)" \
268 all install $(MAKE_TARGETS)
269 endef
270
271 define Build/InstallDev
272 $(INSTALL_DIR) $(1)/usr/lib
273 $(CP) $(PKG_BUILD_DIR)/.libs/libxtables.so* $(1)/usr/lib
274 $(CP) $(PKG_BUILD_DIR)/libiptc/.libs/libiptc.so* $(1)/usr/lib
275 $(CP) $(PKG_BUILD_DIR)/include $(1)/usr
276 endef
277
278 define Package/iptables/install
279 $(INSTALL_DIR) $(1)/usr/sbin
280 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/iptables $(1)/usr/sbin/
281 $(INSTALL_DIR) $(1)/usr/lib/iptables
282 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
283 for m in $(patsubst xt_%,ipt_%,$(IPT_BUILTIN)) $(patsubst ipt_%,xt_%,$(IPT_BUILTIN)); do \
284 if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m}.so ]; then \
285 $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m}.so $(1)/usr/lib/iptables/ ;\
286 fi; \
287 done \
288 )
289 endef
290
291
292 define Package/libiptc/install
293 $(INSTALL_DIR) $(1)/usr/lib
294 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libiptc.so.0 $(1)/usr/lib/
295 endef
296
297 define Package/libxtables/install
298 $(INSTALL_DIR) $(1)/usr/lib
299 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libxtables.so.2 $(1)/usr/lib/
300 endef
301
302
303 define Package/iptables-utils/install
304 $(INSTALL_DIR) $(1)/usr/sbin
305 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/iptables-{save,restore} $(1)/usr/sbin/
306 endef
307
308 define Package/ip6tables/install
309 $(INSTALL_DIR) $(1)/usr/sbin
310 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables $(1)/usr/sbin/
311 $(INSTALL_DIR) $(1)/usr/lib/iptables
312 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
313 $(CP) libip6t_*.so $(1)/usr/lib/iptables/ \
314 )
315 endef
316
317 define Package/ip6tables-utils/install
318 $(INSTALL_DIR) $(1)/usr/sbin
319 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables-{save,restore} $(1)/usr/sbin/
320 endef
321
322 define BuildPlugin
323 define Package/$(1)/install
324 $(INSTALL_DIR) $$(1)/usr/lib/iptables
325 for m in $(patsubst xt_%,ipt_%,$(2)) $(patsubst ipt_%,xt_%,$(2)); do \
326 if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so ]; then \
327 $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so $$(1)/usr/lib/iptables/ ; \
328 fi; \
329 done
330 $(3)
331 endef
332
333 $$(eval $$(call BuildPackage,$(1)))
334 endef
335
336 L7_INSTALL:=\
337 $(INSTALL_DIR) $$(1)/etc/l7-protocols; \
338 $(CP) files/l7/*.pat $$(1)/etc/l7-protocols/
339
340
341 $(eval $(call BuildPackage,libiptc))
342 $(eval $(call BuildPackage,libxtables))
343
344 $(eval $(call BuildPackage,iptables))
345 $(eval $(call BuildPackage,iptables-utils))
346 $(eval $(call BuildPlugin,iptables-mod-conntrack,$(IPT_CONNTRACK-m)))
347 $(eval $(call BuildPlugin,iptables-mod-conntrack-extra,$(IPT_CONNTRACK_EXTRA-m)))
348 $(eval $(call BuildPlugin,iptables-mod-extra,$(IPT_EXTRA-m)))
349 $(eval $(call BuildPlugin,iptables-mod-ipset,$(IPT_IPSET-m)))
350 $(eval $(call BuildPlugin,iptables-mod-filter,$(IPT_FILTER-m),$(L7_INSTALL)))
351 $(eval $(call BuildPlugin,iptables-mod-imq,$(IPT_IMQ-m)))
352 $(eval $(call BuildPlugin,iptables-mod-ipopt,$(IPT_IPOPT-m)))
353 $(eval $(call BuildPlugin,iptables-mod-ipsec,$(IPT_IPSEC-m)))
354 $(eval $(call BuildPlugin,iptables-mod-nat,$(IPT_NAT-m)))
355 $(eval $(call BuildPlugin,iptables-mod-nat-extra,$(IPT_NAT_EXTRA-m)))
356 $(eval $(call BuildPlugin,iptables-mod-iprange,$(IPT_IPRANGE-m)))
357 $(eval $(call BuildPlugin,iptables-mod-ulog,$(IPT_ULOG-m)))
358 $(eval $(call BuildPackage,ip6tables))
359 $(eval $(call BuildPackage,ip6tables-utils))
This page took 0.051137 seconds and 5 git commands to generate.