]>
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 | 6 | # Conditional build: |
3bc59268 PS |
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 | ||
22898ccc JR |
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 | ||
d33761e1 ER |
20 | %if %{without userspace} |
21 | # nothing to be placed to debuginfo package | |
22 | %define _enable_debug_packages 0 | |
23 | %endif | |
3bc59268 | 24 | |
5e8a0f55 | 25 | %define rel 1 |
5b36c760 | 26 | %define pname ipset |
bc9c8d01 | 27 | Summary: IP sets utility |
cb832b79 | 28 | Summary(pl.UTF-8): Narzędzie do zarządzania zbiorami IP |
c5b122e9 | 29 | Name: %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel} |
5e8a0f55 | 30 | Version: 7.3 |
c5b122e9 | 31 | Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}} |
6312651c | 32 | License: GPL v2 |
bc9c8d01 | 33 | Group: Networking/Admin |
6312651c | 34 | #Source0Download: http://ipset.netfilter.org/install.html |
5b36c760 | 35 | Source0: http://ipset.netfilter.org/%{pname}-%{version}.tar.bz2 |
5e8a0f55 | 36 | # Source0-md5: a041d186097a23f1f87208f11144907e |
5b36c760 | 37 | Source1: %{pname}.init |
4fbe6bda | 38 | Patch0: kernel-5.0.patch |
7ee29dfc | 39 | Patch1: kernel-5.1.patch |
bc9c8d01 | 40 | URL: http://ipset.netfilter.org/ |
6312651c | 41 | BuildRequires: autoconf >= 2.50 |
7e0de454 | 42 | BuildRequires: automake |
8aa8458e | 43 | BuildRequires: libmnl-devel >= 1 |
64473438 | 44 | BuildRequires: libltdl-devel >= 2:2.0 |
db888aec | 45 | BuildRequires: libtool >= 2:2.0 |
6312651c | 46 | %{?with_userspace:BuildRequires: linux-libc-headers >= 7:2.6.38.6} |
2bf78421 | 47 | BuildRequires: pkgconfig |
31575a1c | 48 | BuildRequires: rpmbuild(macros) >= 1.701 |
d2abbe0b | 49 | %{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:2.6.24}} |
2a7f4757 | 50 | Suggests: kernel-net-ipset |
bc9c8d01 JK |
51 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
52 | ||
13648ed2 JK |
53 | # unresolved ipset_errcode, defined in the ipset binary |
54 | %define skip_post_check_so libipset\.so.* | |
55 | ||
bc9c8d01 JK |
56 | %description |
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. | |
62 | ||
00760b7e JR |
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 | |
13648ed2 JK |
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 | |
69 | zbioru. | |
9e9bc01b | 70 | |
40d655f1 | 71 | %package devel |
e791bf9d | 72 | Summary: Header files for ipset interface |
cb832b79 | 73 | Summary(pl.UTF-8): Pliki nagłówkowe do interfejsu ipset |
f62f2152 | 74 | Group: Development/Libraries |
6312651c | 75 | Requires: %{name} = %{version}-%{release} |
8aa8458e | 76 | Requires: libmnl-devel >= 1 |
40d655f1 | 77 | |
78 | %description devel | |
3bc59268 | 79 | Header files for IPset interface. |
40d655f1 | 80 | |
00760b7e | 81 | %description devel -l pl.UTF-8 |
3bc59268 | 82 | Pliki nagłówkowe do interfejsu IPset. |
40d655f1 | 83 | |
13648ed2 JK |
84 | %package static |
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} | |
89 | ||
90 | %description static | |
91 | Static IPset interface library. | |
92 | ||
93 | %description static -l pl.UTF-8 | |
94 | Biblioteka statyczna interfejsu IPset. | |
95 | ||
12667538 | 96 | %package init |
a264566a JB |
97 | Summary: IPset init script |
98 | Summary(pl.UTF-8): Skrypt startowy IPset | |
12667538 | 99 | Group: Networking/Admin |
12667538 | 100 | Requires(post,preun): /sbin/chkconfig |
a264566a | 101 | Requires: %{pname} = %{version}-%{release} |
af1d549a | 102 | Requires: rc-scripts |
12667538 PS |
103 | |
104 | %description init | |
3bc59268 PS |
105 | IPset initialization script. |
106 | ||
a264566a JB |
107 | %description init -l pl.UTF-8 |
108 | Skrypt startowy IPset. | |
109 | ||
ab2b1724 JB |
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 | |
116 | ||
117 | %description -n bash-completion-ipset | |
118 | Bash completion for ipset command. | |
119 | ||
120 | %description -n bash-completion-ipset -l pl.UTF-8 | |
121 | Bashowe dopełnianie parametrów polecenia ipset. | |
122 | ||
22898ccc JR |
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}\ | |
128 | Group: Base/Kernel\ | |
22898ccc | 129 | Requires(post,postun): /sbin/depmod\ |
31575a1c JR |
130 | %requires_releq_kernel\ |
131 | Requires(postun): %releq_kernel\ | |
22898ccc JR |
132 | \ |
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.\ | |
139 | \ | |
140 | This package contains kernel modules.\ | |
141 | \ | |
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\ | |
148 | zbioru.\ | |
149 | \ | |
150 | Ten pakiet zawiera moduły jądra oferujące wsparcie dla zbiorów IP.\ | |
151 | \ | |
152 | %if %{with kernel}\ | |
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*\ | |
159 | %endif\ | |
160 | \ | |
161 | %post -n kernel%{_alt_kernel}-net-ipset\ | |
162 | %depmod %{_kernel_ver}\ | |
163 | \ | |
164 | %postun -n kernel%{_alt_kernel}-net-ipset\ | |
165 | %depmod %{_kernel_ver}\ | |
166 | %{nil} | |
167 | ||
168 | %define build_kernel_pkg()\ | |
169 | %configure \\\ | |
170 | --disable-silent-rules \\\ | |
171 | --with-kmod=yes \\\ | |
172 | --with-kbuild=%{_kernelsrcdir} \\\ | |
173 | --with-settype-modules-list=all\ | |
174 | \ | |
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/../..\ | |
177 | \ | |
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\ | |
180 | done\ | |
181 | for drv in kernel/net/netfilter/xt_*.ko ; do\ | |
182 | %install_kernel_modules -D installed -m ${drv%.ko} -d kernel/net/ipv4/netfilter\ | |
183 | done\ | |
184 | %{nil} | |
185 | ||
31575a1c | 186 | %{?with_kernel:%{expand:%create_kernel_packages}} |
12667538 | 187 | |
bc9c8d01 | 188 | %prep |
5b36c760 | 189 | %setup -q -n %{pname}-%{version} |
4fbe6bda | 190 | %patch0 -p1 |
7ee29dfc | 191 | %patch1 -p1 |
fffbab59 | 192 | |
bc9c8d01 | 193 | %build |
a62cbe33 JR |
194 | %{__aclocal} |
195 | %{__autoconf} | |
196 | %{__autoheader} | |
197 | %{__automake} | |
22898ccc | 198 | %if %{with userspace} |
ab2b1724 JB |
199 | install -d build-usr |
200 | cd build-usr | |
201 | ../%configure \ | |
202 | bashcompdir=%{bash_compdir} \ | |
203 | --enable-bashcompl \ | |
db888aec | 204 | --disable-silent-rules \ |
22898ccc | 205 | --with-kmod=no \ |
1e8acbaa | 206 | --with-settype-modules-list=all |
7e0de454 | 207 | |
13648ed2 | 208 | %{__make} |
ab2b1724 | 209 | cd .. |
3bc59268 PS |
210 | %endif |
211 | ||
31575a1c | 212 | %{?with_kernel:%{expand:%build_kernel_packages}} |
bc9c8d01 JK |
213 | |
214 | %install | |
215 | rm -rf $RPM_BUILD_ROOT | |
3bc59268 PS |
216 | |
217 | %if %{with userspace} | |
13648ed2 | 218 | install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_includedir}/libipset} |
bc9c8d01 | 219 | |
ab2b1724 | 220 | %{__make} -C build-usr install \ |
13648ed2 | 221 | DESTDIR=$RPM_BUILD_ROOT |
e791bf9d | 222 | |
fffbab59 | 223 | install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{pname} |
3bc59268 PS |
224 | %endif |
225 | ||
226 | %if %{with kernel} | |
22898ccc JR |
227 | install -d $RPM_BUILD_ROOT |
228 | cp -a installed/* $RPM_BUILD_ROOT | |
3bc59268 | 229 | %endif |
12667538 | 230 | |
bc9c8d01 JK |
231 | %clean |
232 | rm -rf $RPM_BUILD_ROOT | |
233 | ||
12667538 | 234 | %post init |
5b36c760 | 235 | /sbin/chkconfig --add %{pname} |
12667538 PS |
236 | |
237 | %preun init | |
238 | if [ "$1" = "0" ]; then | |
5b36c760 | 239 | /sbin/chkconfig --del %{pname} |
12667538 PS |
240 | fi |
241 | ||
3bc59268 | 242 | %if %{with userspace} |
bc9c8d01 JK |
243 | %files |
244 | %defattr(644,root,root,755) | |
13648ed2 | 245 | %doc ChangeLog ChangeLog.ippool README UPGRADE |
de6c94a7 | 246 | %attr(755,root,root) %{_sbindir}/ipset |
6312651c | 247 | %attr(755,root,root) %{_libdir}/libipset.so.*.*.* |
21871c33 AG |
248 | %attr(755,root,root) %ghost %{_libdir}/libipset.so.13 |
249 | %{_mandir}/man3/libipset.3* | |
de6c94a7 | 250 | %{_mandir}/man8/ipset.8* |
40d655f1 | 251 | |
252 | %files devel | |
253 | %defattr(644,root,root,755) | |
13648ed2 | 254 | %attr(755,root,root) %{_libdir}/libipset.so |
6312651c JB |
255 | %{_libdir}/libipset.la |
256 | %{_includedir}/libipset | |
1e8acbaa | 257 | %{_pkgconfigdir}/libipset.pc |
13648ed2 JK |
258 | |
259 | %files static | |
260 | %defattr(644,root,root,755) | |
261 | %{_libdir}/libipset.a | |
12667538 PS |
262 | |
263 | %files init | |
264 | %defattr(644,root,root,755) | |
a264566a | 265 | %attr(754,root,root) /etc/rc.d/init.d/ipset |
ab2b1724 JB |
266 | |
267 | %files -n bash-completion-ipset | |
268 | %defattr(644,root,root,755) | |
269 | %{bash_compdir}/ipset | |
3bc59268 | 270 | %endif |