[package] add ipset v4.1
[openwrt.git] / package / ipset / Makefile
1
2 # Copyright (C) 2009 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:=ipset
12 PKG_VERSION:=4.1
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=http://ipset.netfilter.org
17 PKG_MD5SUM:=d104007fdf5ea64fef774c22b1c0a97b
18
19 include $(INCLUDE_DIR)/package.mk
20
21 define Package/ipset
22   SECTION:=net
23   CATEGORY:=Network
24   DEPENDS:= @LINUX_2_6 +iptables-mod-ipset +kmod-ipt-ipset
25   TITLE:=IPset administration utility
26   URL:=http://ipset.netfilter.org/
27 endef
28
29 include $(INCLUDE_DIR)/kernel-defaults.mk
30
31 IPSET_MAKEOPTS:= -C $(PKG_BUILD_DIR) \
32         $(TARGET_CONFIGURE_OPTS) \
33         COPT_FLAGS="$(TARGET_CFLAGS)" \
34         LDFLAGS="-rdynamic -static-libgcc" \
35         NO_EXTRA_WARN_FLAGS=yes \
36         KERNEL_DIR="$(LINUX_DIR)" \
37         PREFIX=/usr \
38
39 IPSET_MODULES:= \
40         ip_set \
41         ip_set_iphash \
42         ip_set_ipmap \
43         ip_set_ipporthash \
44         ip_set_ipportiphash \
45         ip_set_ipportnethash \
46         ip_set_iptree \
47         ip_set_iptreemap \
48         ip_set_macipmap \
49         ip_set_nethash \
50         ip_set_portmap \
51         ip_set_setlist \
52         ipt_set \
53         ipt_SET \
54
55 define Build/Compile
56         mkdir -p $(PKG_INSTALL_DIR)
57         $(MAKE) $(IPSET_MAKEOPTS) binaries
58         $(MAKE) $(KERNEL_MAKEOPTS) M="$(PKG_BUILD_DIR)/kernel" IP_NF_SET_MAX="256" IP_NF_SET_HASHSIZE="1024" modules
59         $(MAKE) $(IPSET_MAKEOPTS) DESTDIR="$(PKG_INSTALL_DIR)" binaries_install
60 endef
61
62 define Package/ipset/install
63         $(INSTALL_DIR) $(1)/usr/sbin
64         $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ipset $(1)/usr/sbin/
65         $(INSTALL_DIR) $(1)/usr/lib/ipset
66         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipset/libipset*.so $(1)/usr/lib/ipset/
67 endef
68
69 define KernelPackage/ipt-ipset
70   SUBMENU:=Netfilter Extensions
71   TITLE:=IPset netfilter modules
72   DEPENDS:= @LINUX_2_6 kmod-ipt-core
73   FILES:=$(foreach mod,$(IPSET_MODULES),$(PKG_BUILD_DIR)/kernel/$(mod).ko)
74   AUTOLOAD:=$(call AutoLoad,46,$(IPSET_MODULES))
75 endef
76
77 $(eval $(call BuildPackage,ipset))
78 $(eval $(call KernelPackage,ipt-ipset))