]>
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 | |
c5b122e9 | 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) |
22898ccc JR |
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) | |
44 | ||
f4aca5b9 | 45 | %define rel 1 |
5b36c760 | 46 | %define pname ipset |
bc9c8d01 | 47 | Summary: IP sets utility |
cb832b79 | 48 | Summary(pl.UTF-8): Narzędzie do zarządzania zbiorami IP |
c5b122e9 | 49 | Name: %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel} |
f4aca5b9 | 50 | Version: 6.21.1 |
c5b122e9 | 51 | Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}} |
6312651c | 52 | License: GPL v2 |
bc9c8d01 | 53 | Group: Networking/Admin |
6312651c | 54 | #Source0Download: http://ipset.netfilter.org/install.html |
5b36c760 | 55 | Source0: http://ipset.netfilter.org/%{pname}-%{version}.tar.bz2 |
f4aca5b9 | 56 | # Source0-md5: 9c136fd51694eb0ef259cda085145da0 |
5b36c760 | 57 | Source1: %{pname}.init |
bc9c8d01 | 58 | URL: http://ipset.netfilter.org/ |
6312651c | 59 | BuildRequires: autoconf >= 2.50 |
7e0de454 | 60 | BuildRequires: automake |
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 |
c5b122e9 | 67 | %{?with_dist_kernel:%{expand:%kbrs}} |
2a7f4757 | 68 | Suggests: kernel-net-ipset |
bc9c8d01 JK |
69 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
70 | ||
13648ed2 JK |
71 | # unresolved ipset_errcode, defined in the ipset binary |
72 | %define skip_post_check_so libipset\.so.* | |
73 | ||
bc9c8d01 JK |
74 | %description |
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. | |
80 | ||
00760b7e JR |
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 | |
13648ed2 JK |
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 | |
87 | zbioru. | |
9e9bc01b | 88 | |
40d655f1 | 89 | %package devel |
e791bf9d | 90 | Summary: Header files for ipset interface |
cb832b79 | 91 | Summary(pl.UTF-8): Pliki nagłówkowe do interfejsu ipset |
f62f2152 | 92 | Group: Development/Libraries |
6312651c | 93 | Requires: %{name} = %{version}-%{release} |
8aa8458e | 94 | Requires: libmnl-devel >= 1 |
40d655f1 | 95 | |
96 | %description devel | |
3bc59268 | 97 | Header files for IPset interface. |
40d655f1 | 98 | |
00760b7e | 99 | %description devel -l pl.UTF-8 |
3bc59268 | 100 | Pliki nagłówkowe do interfejsu IPset. |
40d655f1 | 101 | |
13648ed2 JK |
102 | %package static |
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} | |
107 | ||
108 | %description static | |
109 | Static IPset interface library. | |
110 | ||
111 | %description static -l pl.UTF-8 | |
112 | Biblioteka statyczna interfejsu IPset. | |
113 | ||
12667538 | 114 | %package init |
a264566a JB |
115 | Summary: IPset init script |
116 | Summary(pl.UTF-8): Skrypt startowy IPset | |
12667538 | 117 | Group: Networking/Admin |
12667538 | 118 | Requires(post,preun): /sbin/chkconfig |
a264566a | 119 | Requires: %{pname} = %{version}-%{release} |
af1d549a | 120 | Requires: rc-scripts |
12667538 PS |
121 | |
122 | %description init | |
3bc59268 PS |
123 | IPset initialization script. |
124 | ||
a264566a JB |
125 | %description init -l pl.UTF-8 |
126 | Skrypt startowy IPset. | |
127 | ||
22898ccc JR |
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}\ | |
133 | Group: Base/Kernel\ | |
134 | %{?with_dist_kernel:%requires_releq_kernel}\ | |
135 | Requires(post,postun): /sbin/depmod\ | |
136 | \ | |
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.\ | |
143 | \ | |
144 | This package contains kernel modules.\ | |
145 | \ | |
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\ | |
152 | zbioru.\ | |
153 | \ | |
154 | Ten pakiet zawiera moduły jądra oferujące wsparcie dla zbiorów IP.\ | |
155 | \ | |
156 | %if %{with kernel}\ | |
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*\ | |
163 | %endif\ | |
164 | \ | |
165 | %post -n kernel%{_alt_kernel}-net-ipset\ | |
166 | %depmod %{_kernel_ver}\ | |
167 | \ | |
168 | %postun -n kernel%{_alt_kernel}-net-ipset\ | |
169 | %depmod %{_kernel_ver}\ | |
170 | %{nil} | |
171 | ||
172 | %define build_kernel_pkg()\ | |
173 | %configure \\\ | |
174 | --disable-silent-rules \\\ | |
175 | --with-kmod=yes \\\ | |
176 | --with-kbuild=%{_kernelsrcdir} \\\ | |
177 | --with-settype-modules-list=all\ | |
178 | \ | |
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/../..\ | |
181 | \ | |
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\ | |
184 | done\ | |
185 | for drv in kernel/net/netfilter/xt_*.ko ; do\ | |
186 | %install_kernel_modules -D installed -m ${drv%.ko} -d kernel/net/ipv4/netfilter\ | |
187 | done\ | |
188 | %{nil} | |
189 | ||
190 | %{?with_kernel:%{expand:%kpkg}} | |
12667538 | 191 | |
bc9c8d01 | 192 | %prep |
5b36c760 | 193 | %setup -q -n %{pname}-%{version} |
fffbab59 | 194 | |
bc9c8d01 | 195 | %build |
22898ccc | 196 | %if %{with userspace} |
7e0de454 | 197 | %configure \ |
db888aec | 198 | --disable-silent-rules \ |
22898ccc | 199 | --with-kmod=no \ |
1e8acbaa | 200 | --with-settype-modules-list=all |
7e0de454 | 201 | |
13648ed2 | 202 | %{__make} |
3bc59268 PS |
203 | %endif |
204 | ||
22898ccc | 205 | %{?with_kernel:%{expand:%bkpkg}} |
bc9c8d01 JK |
206 | |
207 | %install | |
208 | rm -rf $RPM_BUILD_ROOT | |
3bc59268 PS |
209 | |
210 | %if %{with userspace} | |
13648ed2 | 211 | install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_includedir}/libipset} |
bc9c8d01 | 212 | |
13648ed2 JK |
213 | %{__make} install \ |
214 | DESTDIR=$RPM_BUILD_ROOT | |
215 | cp include/libipset/*.h $RPM_BUILD_ROOT%{_includedir}/libipset | |
e791bf9d | 216 | |
fffbab59 | 217 | install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{pname} |
3bc59268 PS |
218 | %endif |
219 | ||
220 | %if %{with kernel} | |
22898ccc JR |
221 | install -d $RPM_BUILD_ROOT |
222 | cp -a installed/* $RPM_BUILD_ROOT | |
3bc59268 | 223 | %endif |
12667538 | 224 | |
bc9c8d01 JK |
225 | %clean |
226 | rm -rf $RPM_BUILD_ROOT | |
227 | ||
12667538 | 228 | %post init |
5b36c760 | 229 | /sbin/chkconfig --add %{pname} |
12667538 PS |
230 | |
231 | %preun init | |
232 | if [ "$1" = "0" ]; then | |
5b36c760 | 233 | /sbin/chkconfig --del %{pname} |
12667538 PS |
234 | fi |
235 | ||
3bc59268 | 236 | %if %{with userspace} |
bc9c8d01 JK |
237 | %files |
238 | %defattr(644,root,root,755) | |
13648ed2 | 239 | %doc ChangeLog ChangeLog.ippool README UPGRADE |
de6c94a7 | 240 | %attr(755,root,root) %{_sbindir}/ipset |
6312651c | 241 | %attr(755,root,root) %{_libdir}/libipset.so.*.*.* |
22898ccc | 242 | %attr(755,root,root) %ghost %{_libdir}/libipset.so.3 |
de6c94a7 | 243 | %{_mandir}/man8/ipset.8* |
40d655f1 | 244 | |
245 | %files devel | |
246 | %defattr(644,root,root,755) | |
13648ed2 | 247 | %attr(755,root,root) %{_libdir}/libipset.so |
6312651c JB |
248 | %{_libdir}/libipset.la |
249 | %{_includedir}/libipset | |
1e8acbaa | 250 | %{_pkgconfigdir}/libipset.pc |
13648ed2 JK |
251 | |
252 | %files static | |
253 | %defattr(644,root,root,755) | |
254 | %{_libdir}/libipset.a | |
12667538 PS |
255 | |
256 | %files init | |
257 | %defattr(644,root,root,755) | |
a264566a | 258 | %attr(754,root,root) /etc/rc.d/init.d/ipset |
3bc59268 | 259 | %endif |