3 # - patch our kernel to provide the needed API and update
4 # the dependencies here
7 %bcond_without kernel # don't build kernel modules
8 %bcond_without userspace # don't build userspace tools
9 %bcond_with verbose # verbose build (V=1)
11 # The goal here is to have main, userspace, package built once with
12 # simple release number, and only rebuild kernel packages with kernel
13 # version as part of release number, without the need to bump release
14 # with every kernel change.
15 %if 0%{?_pld_builder:1} && %{with kernel} && %{with userspace}
16 %{error:kernel and userspace cannot be built at the same time on PLD builders}
20 %if %{without userspace}
21 # nothing to be placed to debuginfo package
22 %define _enable_debug_packages 0
27 Summary: IP sets utility
28 Summary(pl.UTF-8): Narzędzie do zarządzania zbiorami IP
29 Name: %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel}
31 Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}}
33 Group: Networking/Admin
34 #Source0Download: http://ipset.netfilter.org/install.html
35 Source0: http://ipset.netfilter.org/%{pname}-%{version}.tar.bz2
36 # Source0-md5: 857a5c6a6d645196865a82bf6fd7f567
37 Source1: %{pname}.init
38 Patch0: linux-4.10.patch
39 Patch1: linux-4.12.patch
40 URL: http://ipset.netfilter.org/
41 BuildRequires: autoconf >= 2.50
42 BuildRequires: automake
43 BuildRequires: libmnl-devel >= 1
44 BuildRequires: libltdl-devel >= 2:2.0
45 BuildRequires: libtool >= 2:2.0
46 %{?with_userspace:BuildRequires: linux-libc-headers >= 7:2.6.38.6}
47 BuildRequires: pkgconfig
48 BuildRequires: rpmbuild(macros) >= 1.701
49 %{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2}}
50 Suggests: kernel-net-ipset
51 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
53 # unresolved ipset_errcode, defined in the ipset binary
54 %define skip_post_check_so libipset\.so.*
57 IP sets are a framework inside the Linux 2.4.x and 2.6.x kernel, which
58 can be administered by the ipset utility. Depending on the type,
59 currently an IP set may store IP addresses, (TCP/UDP) port numbers or
60 IP addresses with MAC addresses in a way, which ensures lightning
61 speed when matching an entry against a set.
63 %description -l pl.UTF-8
64 Zbiory IP to szkielet w jądrze Linuksa 2.4.x i 2.6.x, którym można
65 administrować przy użyciu narzędzia ipset. W zależności od
66 rodzaju aktualnie zbiór IP może przechowywać adresy IP, numery
67 portów (TCP/UDP) lub adresy IP z adresami MAC - w sposób
68 zapewniający maksymalną szybkość przy dopasowywaniu elementu do
72 Summary: Header files for ipset interface
73 Summary(pl.UTF-8): Pliki nagłówkowe do interfejsu ipset
74 Group: Development/Libraries
75 Requires: %{name} = %{version}-%{release}
76 Requires: libmnl-devel >= 1
79 Header files for IPset interface.
81 %description devel -l pl.UTF-8
82 Pliki nagłówkowe do interfejsu IPset.
85 Summary: Static ipset interface library
86 Summary(pl.UTF-8): Biblioteka statyczna interfejsu ipset
87 Group: Development/Libraries
88 Requires: %{name}-devel = %{version}-%{release}
91 Static IPset interface library.
93 %description static -l pl.UTF-8
94 Biblioteka statyczna interfejsu IPset.
97 Summary: IPset init script
98 Summary(pl.UTF-8): Skrypt startowy IPset
99 Group: Networking/Admin
100 Requires(post,preun): /sbin/chkconfig
101 Requires: %{pname} = %{version}-%{release}
105 IPset initialization script.
107 %description init -l pl.UTF-8
108 Skrypt startowy IPset.
110 %package -n bash-completion-ipset
111 Summary: Bash completion for ipset command
112 Summary(pl.UTF-8): Bashowe dopełnianie parametrów polecenia ipset
113 Group: Applications/Shells
114 Requires: %{pname} = %{version}-%{release}
115 Requires: bash-completion >= 2.0
117 %description -n bash-completion-ipset
118 Bash completion for ipset command.
120 %description -n bash-completion-ipset -l pl.UTF-8
121 Bashowe dopełnianie parametrów polecenia ipset.
123 %define kernel_pkg()\
124 %package -n kernel%{_alt_kernel}-net-ipset\
125 Summary: IPset kernel modules\
126 Summary(pl.UTF-8): Moduły jądra oferujące wsparcie dla zbiorów IP\
127 Release: %{rel}@%{_kernel_ver_str}\
129 Requires(post,postun): /sbin/depmod\
130 %requires_releq_kernel\
131 Requires(postun): %releq_kernel\
133 %description -n kernel%{_alt_kernel}-net-ipset\
134 IP sets are a framework inside the Linux 2.4.x and 2.6.x kernel, which\
135 can be administered by the ipset utility. Depending on the type,\
136 currently an IP set may store IP addresses, (TCP/UDP) port numbers or\
137 IP addresses with MAC addresses in a way, which ensures lightning\
138 speed when matching an entry against a set.\
140 This package contains kernel modules.\
142 %description -n kernel%{_alt_kernel}-net-ipset -l pl.UTF-8\
143 Zbiory IP to szkielet w jądrze Linuksa 2.4.x i 2.6.x, którym można\
144 administrować przy użyciu narzędzia ipset. W zależności od\
145 rodzaju aktualnie zbiór IP może przechowywać adresy IP, numery\
146 portów (TCP/UDP) lub adresy IP z adresami MAC - w sposób\
147 zapewniający maksymalną szybkość przy dopasowywaniu elementu do\
150 Ten pakiet zawiera moduły jądra oferujące wsparcie dla zbiorów IP.\
153 %files -n kernel%{_alt_kernel}-net-ipset\
154 %defattr(644,root,root,755)\
155 /lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/xt_*.ko*\
156 %dir /lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/ipset\
157 /lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/ipset/ip_set.ko*\
158 /lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/ipset/ip_set_*.ko*\
161 %post -n kernel%{_alt_kernel}-net-ipset\
162 %depmod %{_kernel_ver}\
164 %postun -n kernel%{_alt_kernel}-net-ipset\
165 %depmod %{_kernel_ver}\
168 %define build_kernel_pkg()\
170 --disable-silent-rules \\\
172 --with-kbuild=%{_kernelsrcdir} \\\
173 --with-settype-modules-list=all\
175 # a hack not to list all modules: list only ip_set, all other are build anyway\
176 %build_kernel_modules -C kernel/net/netfilter -m ipset/ip_set IP_SET_MAX=255 KDIR=$PWD/../..\
178 for drv in kernel/net/netfilter/ipset/ip_set*.ko ; do\
179 %install_kernel_modules -D installed -m ${drv%.ko} -d kernel/net/ipv4/netfilter/ipset\
181 for drv in kernel/net/netfilter/xt_*.ko ; do\
182 %install_kernel_modules -D installed -m ${drv%.ko} -d kernel/net/ipv4/netfilter\
186 %{?with_kernel:%{expand:%create_kernel_packages}}
189 %setup -q -n %{pname}-%{version}
198 %if %{with userspace}
202 bashcompdir=%{bash_compdir} \
204 --disable-silent-rules \
206 --with-settype-modules-list=all
212 %{?with_kernel:%{expand:%build_kernel_packages}}
215 rm -rf $RPM_BUILD_ROOT
217 %if %{with userspace}
218 install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_includedir}/libipset}
220 %{__make} -C build-usr install \
221 DESTDIR=$RPM_BUILD_ROOT
223 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{pname}
227 install -d $RPM_BUILD_ROOT
228 cp -a installed/* $RPM_BUILD_ROOT
232 rm -rf $RPM_BUILD_ROOT
235 /sbin/chkconfig --add %{pname}
238 if [ "$1" = "0" ]; then
239 /sbin/chkconfig --del %{pname}
242 %if %{with userspace}
244 %defattr(644,root,root,755)
245 %doc ChangeLog ChangeLog.ippool README UPGRADE
246 %attr(755,root,root) %{_sbindir}/ipset
247 %attr(755,root,root) %{_libdir}/libipset.so.*.*.*
248 %attr(755,root,root) %ghost %{_libdir}/libipset.so.3
249 %{_mandir}/man8/ipset.8*
252 %defattr(644,root,root,755)
253 %attr(755,root,root) %{_libdir}/libipset.so
254 %{_libdir}/libipset.la
255 %{_includedir}/libipset
256 %{_pkgconfigdir}/libipset.pc
259 %defattr(644,root,root,755)
260 %{_libdir}/libipset.a
263 %defattr(644,root,root,755)
264 %attr(754,root,root) /etc/rc.d/init.d/ipset
266 %files -n bash-completion-ipset
267 %defattr(644,root,root,755)
268 %{bash_compdir}/ipset