]>
Commit | Line | Data |
---|---|---|
1 | # | |
2 | # TODO: | |
3 | # - patch our kernel to provide the needed API and update | |
4 | # the dependencies here | |
5 | # | |
6 | # Conditional build: | |
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) | |
10 | ||
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} | |
17 | exit 1 | |
18 | %endif | |
19 | ||
20 | %if %{without userspace} | |
21 | # nothing to be placed to debuginfo package | |
22 | %define _enable_debug_packages 0 | |
23 | %endif | |
24 | ||
25 | %define rel 2 | |
26 | %define pname ipset | |
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} | |
30 | Version: 6.29 | |
31 | Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}} | |
32 | License: GPL v2 | |
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: fd8ea35997115c5c630eee22f0beecec | |
37 | Source1: %{pname}.init | |
38 | Patch0: %{pname}-Backports-for-the-nla_put_net64-API-changes.patch | |
39 | URL: http://ipset.netfilter.org/ | |
40 | BuildRequires: autoconf >= 2.50 | |
41 | BuildRequires: automake | |
42 | BuildRequires: libmnl-devel >= 1 | |
43 | BuildRequires: libltdl-devel >= 2:2.0 | |
44 | BuildRequires: libtool >= 2:2.0 | |
45 | %{?with_userspace:BuildRequires: linux-libc-headers >= 7:2.6.38.6} | |
46 | BuildRequires: pkgconfig | |
47 | BuildRequires: rpmbuild(macros) >= 1.701 | |
48 | %{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2}} | |
49 | Suggests: kernel-net-ipset | |
50 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
51 | ||
52 | # unresolved ipset_errcode, defined in the ipset binary | |
53 | %define skip_post_check_so libipset\.so.* | |
54 | ||
55 | %description | |
56 | IP sets are a framework inside the Linux 2.4.x and 2.6.x kernel, which | |
57 | can be administered by the ipset utility. Depending on the type, | |
58 | currently an IP set may store IP addresses, (TCP/UDP) port numbers or | |
59 | IP addresses with MAC addresses in a way, which ensures lightning | |
60 | speed when matching an entry against a set. | |
61 | ||
62 | %description -l pl.UTF-8 | |
63 | Zbiory IP to szkielet w jądrze Linuksa 2.4.x i 2.6.x, którym można | |
64 | administrować przy użyciu narzędzia ipset. W zależności od | |
65 | rodzaju aktualnie zbiór IP może przechowywać adresy IP, numery | |
66 | portów (TCP/UDP) lub adresy IP z adresami MAC - w sposób | |
67 | zapewniający maksymalną szybkość przy dopasowywaniu elementu do | |
68 | zbioru. | |
69 | ||
70 | %package devel | |
71 | Summary: Header files for ipset interface | |
72 | Summary(pl.UTF-8): Pliki nagłówkowe do interfejsu ipset | |
73 | Group: Development/Libraries | |
74 | Requires: %{name} = %{version}-%{release} | |
75 | Requires: libmnl-devel >= 1 | |
76 | ||
77 | %description devel | |
78 | Header files for IPset interface. | |
79 | ||
80 | %description devel -l pl.UTF-8 | |
81 | Pliki nagłówkowe do interfejsu IPset. | |
82 | ||
83 | %package static | |
84 | Summary: Static ipset interface library | |
85 | Summary(pl.UTF-8): Biblioteka statyczna interfejsu ipset | |
86 | Group: Development/Libraries | |
87 | Requires: %{name}-devel = %{version}-%{release} | |
88 | ||
89 | %description static | |
90 | Static IPset interface library. | |
91 | ||
92 | %description static -l pl.UTF-8 | |
93 | Biblioteka statyczna interfejsu IPset. | |
94 | ||
95 | %package init | |
96 | Summary: IPset init script | |
97 | Summary(pl.UTF-8): Skrypt startowy IPset | |
98 | Group: Networking/Admin | |
99 | Requires(post,preun): /sbin/chkconfig | |
100 | Requires: %{pname} = %{version}-%{release} | |
101 | Requires: rc-scripts | |
102 | ||
103 | %description init | |
104 | IPset initialization script. | |
105 | ||
106 | %description init -l pl.UTF-8 | |
107 | Skrypt startowy IPset. | |
108 | ||
109 | %define kernel_pkg()\ | |
110 | %package -n kernel%{_alt_kernel}-net-ipset\ | |
111 | Summary: IPset kernel modules\ | |
112 | Summary(pl.UTF-8): Moduły jądra oferujące wsparcie dla zbiorów IP\ | |
113 | Release: %{rel}@%{_kernel_ver_str}\ | |
114 | Group: Base/Kernel\ | |
115 | Requires(post,postun): /sbin/depmod\ | |
116 | %requires_releq_kernel\ | |
117 | Requires(postun): %releq_kernel\ | |
118 | \ | |
119 | %description -n kernel%{_alt_kernel}-net-ipset\ | |
120 | IP sets are a framework inside the Linux 2.4.x and 2.6.x kernel, which\ | |
121 | can be administered by the ipset utility. Depending on the type,\ | |
122 | currently an IP set may store IP addresses, (TCP/UDP) port numbers or\ | |
123 | IP addresses with MAC addresses in a way, which ensures lightning\ | |
124 | speed when matching an entry against a set.\ | |
125 | \ | |
126 | This package contains kernel modules.\ | |
127 | \ | |
128 | %description -n kernel%{_alt_kernel}-net-ipset -l pl.UTF-8\ | |
129 | Zbiory IP to szkielet w jądrze Linuksa 2.4.x i 2.6.x, którym można\ | |
130 | administrować przy użyciu narzędzia ipset. W zależności od\ | |
131 | rodzaju aktualnie zbiór IP może przechowywać adresy IP, numery\ | |
132 | portów (TCP/UDP) lub adresy IP z adresami MAC - w sposób\ | |
133 | zapewniający maksymalną szybkość przy dopasowywaniu elementu do\ | |
134 | zbioru.\ | |
135 | \ | |
136 | Ten pakiet zawiera moduły jądra oferujące wsparcie dla zbiorów IP.\ | |
137 | \ | |
138 | %if %{with kernel}\ | |
139 | %files -n kernel%{_alt_kernel}-net-ipset\ | |
140 | %defattr(644,root,root,755)\ | |
141 | /lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/xt_*.ko*\ | |
142 | %dir /lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/ipset\ | |
143 | /lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/ipset/ip_set.ko*\ | |
144 | /lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/ipset/ip_set_*.ko*\ | |
145 | %endif\ | |
146 | \ | |
147 | %post -n kernel%{_alt_kernel}-net-ipset\ | |
148 | %depmod %{_kernel_ver}\ | |
149 | \ | |
150 | %postun -n kernel%{_alt_kernel}-net-ipset\ | |
151 | %depmod %{_kernel_ver}\ | |
152 | %{nil} | |
153 | ||
154 | %define build_kernel_pkg()\ | |
155 | %configure \\\ | |
156 | --disable-silent-rules \\\ | |
157 | --with-kmod=yes \\\ | |
158 | --with-kbuild=%{_kernelsrcdir} \\\ | |
159 | --with-settype-modules-list=all\ | |
160 | \ | |
161 | # a hack not to list all modules: list only ip_set, all other are build anyway\ | |
162 | %build_kernel_modules -C kernel/net/netfilter -m ipset/ip_set IP_SET_MAX=255 KDIR=$PWD/../..\ | |
163 | \ | |
164 | for drv in kernel/net/netfilter/ipset/ip_set*.ko ; do\ | |
165 | %install_kernel_modules -D installed -m ${drv%.ko} -d kernel/net/ipv4/netfilter/ipset\ | |
166 | done\ | |
167 | for drv in kernel/net/netfilter/xt_*.ko ; do\ | |
168 | %install_kernel_modules -D installed -m ${drv%.ko} -d kernel/net/ipv4/netfilter\ | |
169 | done\ | |
170 | %{nil} | |
171 | ||
172 | %{?with_kernel:%{expand:%create_kernel_packages}} | |
173 | ||
174 | %prep | |
175 | %setup -q -n %{pname}-%{version} | |
176 | %patch0 -p1 | |
177 | ||
178 | %build | |
179 | %{__aclocal} | |
180 | %{__autoconf} | |
181 | %{__autoheader} | |
182 | %{__automake} | |
183 | %if %{with userspace} | |
184 | %configure \ | |
185 | --disable-silent-rules \ | |
186 | --with-kmod=no \ | |
187 | --with-settype-modules-list=all | |
188 | ||
189 | %{__make} | |
190 | %endif | |
191 | ||
192 | %{?with_kernel:%{expand:%build_kernel_packages}} | |
193 | ||
194 | %install | |
195 | rm -rf $RPM_BUILD_ROOT | |
196 | ||
197 | %if %{with userspace} | |
198 | install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_includedir}/libipset} | |
199 | ||
200 | %{__make} install \ | |
201 | DESTDIR=$RPM_BUILD_ROOT | |
202 | cp include/libipset/*.h $RPM_BUILD_ROOT%{_includedir}/libipset | |
203 | ||
204 | install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{pname} | |
205 | %endif | |
206 | ||
207 | %if %{with kernel} | |
208 | install -d $RPM_BUILD_ROOT | |
209 | cp -a installed/* $RPM_BUILD_ROOT | |
210 | %endif | |
211 | ||
212 | %clean | |
213 | rm -rf $RPM_BUILD_ROOT | |
214 | ||
215 | %post init | |
216 | /sbin/chkconfig --add %{pname} | |
217 | ||
218 | %preun init | |
219 | if [ "$1" = "0" ]; then | |
220 | /sbin/chkconfig --del %{pname} | |
221 | fi | |
222 | ||
223 | %if %{with userspace} | |
224 | %files | |
225 | %defattr(644,root,root,755) | |
226 | %doc ChangeLog ChangeLog.ippool README UPGRADE | |
227 | %attr(755,root,root) %{_sbindir}/ipset | |
228 | %attr(755,root,root) %{_libdir}/libipset.so.*.*.* | |
229 | %attr(755,root,root) %ghost %{_libdir}/libipset.so.3 | |
230 | %{_mandir}/man8/ipset.8* | |
231 | ||
232 | %files devel | |
233 | %defattr(644,root,root,755) | |
234 | %attr(755,root,root) %{_libdir}/libipset.so | |
235 | %{_libdir}/libipset.la | |
236 | %{_includedir}/libipset | |
237 | %{_pkgconfigdir}/libipset.pc | |
238 | ||
239 | %files static | |
240 | %defattr(644,root,root,755) | |
241 | %{_libdir}/libipset.a | |
242 | ||
243 | %files init | |
244 | %defattr(644,root,root,755) | |
245 | %attr(754,root,root) /etc/rc.d/init.d/ipset | |
246 | %endif |