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