3 # - patch our kernel to provide the needed API and update
4 # the dependencies here
7 %bcond_without dist_kernel # allow non-distribution kernel
8 %bcond_without kernel # don't build kernel modules
9 %bcond_without userspace # don't build userspace tools
10 %bcond_with verbose # verbose build (V=1)
13 %undefine with_dist_kernel
16 # The goal here is to have main, userspace, package built once with
17 # simple release number, and only rebuild kernel packages with kernel
18 # version as part of release number, without the need to bump release
19 # with every kernel change.
20 %if 0%{?_pld_builder:1} && %{with kernel} && %{with userspace}
21 %{error:kernel and userspace cannot be built at the same time on PLD builders}
25 %if "%{_alt_kernel}" != "%{nil}"
26 %if 0%{?build_kernels:1}
27 %{error:alt_kernel and build_kernels are mutually exclusive}
30 %undefine with_userspace
31 %global _build_kernels %{alt_kernel}
33 %global _build_kernels %{?build_kernels:,%{?build_kernels}}
36 %if %{without userspace}
37 # nothing to be placed to debuginfo package
38 %define _enable_debug_packages 0
41 %define kbrs %(echo %{_build_kernels} | tr , '\\n' | while read n ; do echo %%undefine alt_kernel ; [ -z "$n" ] || echo %%define alt_kernel $n ; echo "BuildRequires:kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2" ; done)
42 %define kpkg %(echo %{_build_kernels} | tr , '\\n' | while read n ; do echo %%undefine alt_kernel ; [ -z "$n" ] || echo %%define alt_kernel $n ; echo %%kernel_pkg ; done)
43 %define bkpkg %(echo %{_build_kernels} | tr , '\\n' | while read n ; do echo %%undefine alt_kernel ; [ -z "$n" ] || echo %%define alt_kernel $n ; echo %%build_kernel_pkg ; done)
47 Summary: IP sets utility
48 Summary(pl.UTF-8): Narzędzie do zarządzania zbiorami IP
49 Name: %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel}
51 Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}}
53 Group: Networking/Admin
54 #Source0Download: http://ipset.netfilter.org/install.html
55 Source0: http://ipset.netfilter.org/%{pname}-%{version}.tar.bz2
56 # Source0-md5: 8af741492752fbf24d3a28a9d1473d40
57 Source1: %{pname}.init
58 URL: http://ipset.netfilter.org/
59 BuildRequires: autoconf >= 2.50
60 BuildRequires: automake
61 BuildRequires: libmnl-devel >= 1
62 BuildRequires: libltdl-devel >= 2:2.0
63 BuildRequires: libtool >= 2:2.0
64 %{?with_userspace:BuildRequires: linux-libc-headers >= 7:2.6.38.6}
65 BuildRequires: pkgconfig
66 BuildRequires: rpmbuild(macros) >= 1.678
67 %{?with_dist_kernel:%{expand:%kbrs}}
68 Suggests: kernel-net-ipset
69 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
71 # unresolved ipset_errcode, defined in the ipset binary
72 %define skip_post_check_so libipset\.so.*
75 IP sets are a framework inside the Linux 2.4.x and 2.6.x kernel, which
76 can be administered by the ipset utility. Depending on the type,
77 currently an IP set may store IP addresses, (TCP/UDP) port numbers or
78 IP addresses with MAC addresses in a way, which ensures lightning
79 speed when matching an entry against a set.
81 %description -l pl.UTF-8
82 Zbiory IP to szkielet w jądrze Linuksa 2.4.x i 2.6.x, którym można
83 administrować przy użyciu narzędzia ipset. W zależności od
84 rodzaju aktualnie zbiór IP może przechowywać adresy IP, numery
85 portów (TCP/UDP) lub adresy IP z adresami MAC - w sposób
86 zapewniający maksymalną szybkość przy dopasowywaniu elementu do
90 Summary: Header files for ipset interface
91 Summary(pl.UTF-8): Pliki nagłówkowe do interfejsu ipset
92 Group: Development/Libraries
93 Requires: %{name} = %{version}-%{release}
94 Requires: libmnl-devel >= 1
97 Header files for IPset interface.
99 %description devel -l pl.UTF-8
100 Pliki nagłówkowe do interfejsu IPset.
103 Summary: Static ipset interface library
104 Summary(pl.UTF-8): Biblioteka statyczna interfejsu ipset
105 Group: Development/Libraries
106 Requires: %{name}-devel = %{version}-%{release}
109 Static IPset interface library.
111 %description static -l pl.UTF-8
112 Biblioteka statyczna interfejsu IPset.
115 Summary: IPset init script
116 Summary(pl.UTF-8): Skrypt startowy IPset
117 Group: Networking/Admin
118 Requires(post,preun): /sbin/chkconfig
119 Requires: %{pname} = %{version}-%{release}
123 IPset initialization script.
125 %description init -l pl.UTF-8
126 Skrypt startowy IPset.
128 %define kernel_pkg()\
129 %package -n kernel%{_alt_kernel}-net-ipset\
130 Summary: IPset kernel modules\
131 Summary(pl.UTF-8): Moduły jądra oferujące wsparcie dla zbiorów IP\
132 Release: %{rel}@%{_kernel_ver_str}\
134 %{?with_dist_kernel:%requires_releq_kernel}\
135 Requires(post,postun): /sbin/depmod\
137 %description -n kernel%{_alt_kernel}-net-ipset\
138 IP sets are a framework inside the Linux 2.4.x and 2.6.x kernel, which\
139 can be administered by the ipset utility. Depending on the type,\
140 currently an IP set may store IP addresses, (TCP/UDP) port numbers or\
141 IP addresses with MAC addresses in a way, which ensures lightning\
142 speed when matching an entry against a set.\
144 This package contains kernel modules.\
146 %description -n kernel%{_alt_kernel}-net-ipset -l pl.UTF-8\
147 Zbiory IP to szkielet w jądrze Linuksa 2.4.x i 2.6.x, którym można\
148 administrować przy użyciu narzędzia ipset. W zależności od\
149 rodzaju aktualnie zbiór IP może przechowywać adresy IP, numery\
150 portów (TCP/UDP) lub adresy IP z adresami MAC - w sposób\
151 zapewniający maksymalną szybkość przy dopasowywaniu elementu do\
154 Ten pakiet zawiera moduły jądra oferujące wsparcie dla zbiorów IP.\
157 %files -n kernel%{_alt_kernel}-net-ipset\
158 %defattr(644,root,root,755)\
159 /lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/xt_*.ko*\
160 %dir /lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/ipset\
161 /lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/ipset/ip_set.ko*\
162 /lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/ipset/ip_set_*.ko*\
165 %post -n kernel%{_alt_kernel}-net-ipset\
166 %depmod %{_kernel_ver}\
168 %postun -n kernel%{_alt_kernel}-net-ipset\
169 %depmod %{_kernel_ver}\
172 %define build_kernel_pkg()\
174 --disable-silent-rules \\\
176 --with-kbuild=%{_kernelsrcdir} \\\
177 --with-settype-modules-list=all\
179 # a hack not to list all modules: list only ip_set, all other are build anyway\
180 %build_kernel_modules -C kernel/net/netfilter -m ipset/ip_set IP_SET_MAX=255 KDIR=$PWD/../..\
182 for drv in kernel/net/netfilter/ipset/ip_set*.ko ; do\
183 %install_kernel_modules -D installed -m ${drv%.ko} -d kernel/net/ipv4/netfilter/ipset\
185 for drv in kernel/net/netfilter/xt_*.ko ; do\
186 %install_kernel_modules -D installed -m ${drv%.ko} -d kernel/net/ipv4/netfilter\
190 %{?with_kernel:%{expand:%kpkg}}
193 %setup -q -n %{pname}-%{version}
196 %if %{with userspace}
198 --disable-silent-rules \
200 --with-settype-modules-list=all
205 %{?with_kernel:%{expand:%bkpkg}}
208 rm -rf $RPM_BUILD_ROOT
210 %if %{with userspace}
211 install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_includedir}/libipset}
214 DESTDIR=$RPM_BUILD_ROOT
215 cp include/libipset/*.h $RPM_BUILD_ROOT%{_includedir}/libipset
217 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{pname}
221 install -d $RPM_BUILD_ROOT
222 cp -a installed/* $RPM_BUILD_ROOT
226 rm -rf $RPM_BUILD_ROOT
229 /sbin/chkconfig --add %{pname}
232 if [ "$1" = "0" ]; then
233 /sbin/chkconfig --del %{pname}
236 %if %{with userspace}
238 %defattr(644,root,root,755)
239 %doc ChangeLog ChangeLog.ippool README UPGRADE
240 %attr(755,root,root) %{_sbindir}/ipset
241 %attr(755,root,root) %{_libdir}/libipset.so.*.*.*
242 %attr(755,root,root) %ghost %{_libdir}/libipset.so.3
243 %{_mandir}/man8/ipset.8*
246 %defattr(644,root,root,755)
247 %attr(755,root,root) %{_libdir}/libipset.so
248 %{_libdir}/libipset.la
249 %{_includedir}/libipset
250 %{_pkgconfigdir}/libipset.pc
253 %defattr(644,root,root,755)
254 %{_libdir}/libipset.a
257 %defattr(644,root,root,755)
258 %attr(754,root,root) /etc/rc.d/init.d/ipset