]>
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 | |
40774c99 | 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} |
40774c99 | 30 | Version: 6.38 |
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 |
40774c99 | 36 | # Source0-md5: 0e5d9c85f6b78e7dff0c996e2900574b |
5b36c760 | 37 | Source1: %{pname}.init |
40774c99 | 38 | Patch0: kernel-4.17.patch |
bc9c8d01 | 39 | URL: http://ipset.netfilter.org/ |
6312651c | 40 | BuildRequires: autoconf >= 2.50 |
7e0de454 | 41 | BuildRequires: automake |
8aa8458e | 42 | BuildRequires: libmnl-devel >= 1 |
64473438 | 43 | BuildRequires: libltdl-devel >= 2:2.0 |
db888aec | 44 | BuildRequires: libtool >= 2:2.0 |
6312651c | 45 | %{?with_userspace:BuildRequires: linux-libc-headers >= 7:2.6.38.6} |
2bf78421 | 46 | BuildRequires: pkgconfig |
31575a1c JR |
47 | BuildRequires: rpmbuild(macros) >= 1.701 |
48 | %{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2}} | |
2a7f4757 | 49 | Suggests: kernel-net-ipset |
bc9c8d01 JK |
50 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
51 | ||
13648ed2 JK |
52 | # unresolved ipset_errcode, defined in the ipset binary |
53 | %define skip_post_check_so libipset\.so.* | |
54 | ||
bc9c8d01 JK |
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 | ||
00760b7e JR |
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 | |
13648ed2 JK |
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. | |
9e9bc01b | 69 | |
40d655f1 | 70 | %package devel |
e791bf9d | 71 | Summary: Header files for ipset interface |
cb832b79 | 72 | Summary(pl.UTF-8): Pliki nagłówkowe do interfejsu ipset |
f62f2152 | 73 | Group: Development/Libraries |
6312651c | 74 | Requires: %{name} = %{version}-%{release} |
8aa8458e | 75 | Requires: libmnl-devel >= 1 |
40d655f1 | 76 | |
77 | %description devel | |
3bc59268 | 78 | Header files for IPset interface. |
40d655f1 | 79 | |
00760b7e | 80 | %description devel -l pl.UTF-8 |
3bc59268 | 81 | Pliki nagłówkowe do interfejsu IPset. |
40d655f1 | 82 | |
13648ed2 JK |
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 | ||
12667538 | 95 | %package init |
a264566a JB |
96 | Summary: IPset init script |
97 | Summary(pl.UTF-8): Skrypt startowy IPset | |
12667538 | 98 | Group: Networking/Admin |
12667538 | 99 | Requires(post,preun): /sbin/chkconfig |
a264566a | 100 | Requires: %{pname} = %{version}-%{release} |
af1d549a | 101 | Requires: rc-scripts |
12667538 PS |
102 | |
103 | %description init | |
3bc59268 PS |
104 | IPset initialization script. |
105 | ||
a264566a JB |
106 | %description init -l pl.UTF-8 |
107 | Skrypt startowy IPset. | |
108 | ||
ab2b1724 JB |
109 | %package -n bash-completion-ipset |
110 | Summary: Bash completion for ipset command | |
111 | Summary(pl.UTF-8): Bashowe dopełnianie parametrów polecenia ipset | |
112 | Group: Applications/Shells | |
113 | Requires: %{pname} = %{version}-%{release} | |
114 | Requires: bash-completion >= 2.0 | |
115 | ||
116 | %description -n bash-completion-ipset | |
117 | Bash completion for ipset command. | |
118 | ||
119 | %description -n bash-completion-ipset -l pl.UTF-8 | |
120 | Bashowe dopełnianie parametrów polecenia ipset. | |
121 | ||
22898ccc JR |
122 | %define kernel_pkg()\ |
123 | %package -n kernel%{_alt_kernel}-net-ipset\ | |
124 | Summary: IPset kernel modules\ | |
125 | Summary(pl.UTF-8): Moduły jądra oferujące wsparcie dla zbiorów IP\ | |
126 | Release: %{rel}@%{_kernel_ver_str}\ | |
127 | Group: Base/Kernel\ | |
22898ccc | 128 | Requires(post,postun): /sbin/depmod\ |
31575a1c JR |
129 | %requires_releq_kernel\ |
130 | Requires(postun): %releq_kernel\ | |
22898ccc JR |
131 | \ |
132 | %description -n kernel%{_alt_kernel}-net-ipset\ | |
133 | IP sets are a framework inside the Linux 2.4.x and 2.6.x kernel, which\ | |
134 | can be administered by the ipset utility. Depending on the type,\ | |
135 | currently an IP set may store IP addresses, (TCP/UDP) port numbers or\ | |
136 | IP addresses with MAC addresses in a way, which ensures lightning\ | |
137 | speed when matching an entry against a set.\ | |
138 | \ | |
139 | This package contains kernel modules.\ | |
140 | \ | |
141 | %description -n kernel%{_alt_kernel}-net-ipset -l pl.UTF-8\ | |
142 | Zbiory IP to szkielet w jądrze Linuksa 2.4.x i 2.6.x, którym można\ | |
143 | administrować przy użyciu narzędzia ipset. W zależności od\ | |
144 | rodzaju aktualnie zbiór IP może przechowywać adresy IP, numery\ | |
145 | portów (TCP/UDP) lub adresy IP z adresami MAC - w sposób\ | |
146 | zapewniający maksymalną szybkość przy dopasowywaniu elementu do\ | |
147 | zbioru.\ | |
148 | \ | |
149 | Ten pakiet zawiera moduły jądra oferujące wsparcie dla zbiorów IP.\ | |
150 | \ | |
151 | %if %{with kernel}\ | |
152 | %files -n kernel%{_alt_kernel}-net-ipset\ | |
153 | %defattr(644,root,root,755)\ | |
154 | /lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/xt_*.ko*\ | |
155 | %dir /lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/ipset\ | |
156 | /lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/ipset/ip_set.ko*\ | |
157 | /lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/ipset/ip_set_*.ko*\ | |
158 | %endif\ | |
159 | \ | |
160 | %post -n kernel%{_alt_kernel}-net-ipset\ | |
161 | %depmod %{_kernel_ver}\ | |
162 | \ | |
163 | %postun -n kernel%{_alt_kernel}-net-ipset\ | |
164 | %depmod %{_kernel_ver}\ | |
165 | %{nil} | |
166 | ||
167 | %define build_kernel_pkg()\ | |
168 | %configure \\\ | |
169 | --disable-silent-rules \\\ | |
170 | --with-kmod=yes \\\ | |
171 | --with-kbuild=%{_kernelsrcdir} \\\ | |
172 | --with-settype-modules-list=all\ | |
173 | \ | |
174 | # a hack not to list all modules: list only ip_set, all other are build anyway\ | |
175 | %build_kernel_modules -C kernel/net/netfilter -m ipset/ip_set IP_SET_MAX=255 KDIR=$PWD/../..\ | |
176 | \ | |
177 | for drv in kernel/net/netfilter/ipset/ip_set*.ko ; do\ | |
178 | %install_kernel_modules -D installed -m ${drv%.ko} -d kernel/net/ipv4/netfilter/ipset\ | |
179 | done\ | |
180 | for drv in kernel/net/netfilter/xt_*.ko ; do\ | |
181 | %install_kernel_modules -D installed -m ${drv%.ko} -d kernel/net/ipv4/netfilter\ | |
182 | done\ | |
183 | %{nil} | |
184 | ||
31575a1c | 185 | %{?with_kernel:%{expand:%create_kernel_packages}} |
12667538 | 186 | |
bc9c8d01 | 187 | %prep |
5b36c760 | 188 | %setup -q -n %{pname}-%{version} |
40774c99 | 189 | %patch0 -p1 |
fffbab59 | 190 | |
bc9c8d01 | 191 | %build |
a62cbe33 JR |
192 | %{__aclocal} |
193 | %{__autoconf} | |
194 | %{__autoheader} | |
195 | %{__automake} | |
22898ccc | 196 | %if %{with userspace} |
ab2b1724 JB |
197 | install -d build-usr |
198 | cd build-usr | |
199 | ../%configure \ | |
200 | bashcompdir=%{bash_compdir} \ | |
201 | --enable-bashcompl \ | |
db888aec | 202 | --disable-silent-rules \ |
22898ccc | 203 | --with-kmod=no \ |
1e8acbaa | 204 | --with-settype-modules-list=all |
7e0de454 | 205 | |
13648ed2 | 206 | %{__make} |
ab2b1724 | 207 | cd .. |
3bc59268 PS |
208 | %endif |
209 | ||
31575a1c | 210 | %{?with_kernel:%{expand:%build_kernel_packages}} |
bc9c8d01 JK |
211 | |
212 | %install | |
213 | rm -rf $RPM_BUILD_ROOT | |
3bc59268 PS |
214 | |
215 | %if %{with userspace} | |
13648ed2 | 216 | install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_includedir}/libipset} |
bc9c8d01 | 217 | |
ab2b1724 | 218 | %{__make} -C build-usr install \ |
13648ed2 | 219 | DESTDIR=$RPM_BUILD_ROOT |
e791bf9d | 220 | |
fffbab59 | 221 | install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{pname} |
3bc59268 PS |
222 | %endif |
223 | ||
224 | %if %{with kernel} | |
22898ccc JR |
225 | install -d $RPM_BUILD_ROOT |
226 | cp -a installed/* $RPM_BUILD_ROOT | |
3bc59268 | 227 | %endif |
12667538 | 228 | |
bc9c8d01 JK |
229 | %clean |
230 | rm -rf $RPM_BUILD_ROOT | |
231 | ||
12667538 | 232 | %post init |
5b36c760 | 233 | /sbin/chkconfig --add %{pname} |
12667538 PS |
234 | |
235 | %preun init | |
236 | if [ "$1" = "0" ]; then | |
5b36c760 | 237 | /sbin/chkconfig --del %{pname} |
12667538 PS |
238 | fi |
239 | ||
3bc59268 | 240 | %if %{with userspace} |
bc9c8d01 JK |
241 | %files |
242 | %defattr(644,root,root,755) | |
13648ed2 | 243 | %doc ChangeLog ChangeLog.ippool README UPGRADE |
de6c94a7 | 244 | %attr(755,root,root) %{_sbindir}/ipset |
6312651c | 245 | %attr(755,root,root) %{_libdir}/libipset.so.*.*.* |
0bc16671 | 246 | %attr(755,root,root) %ghost %{_libdir}/libipset.so.11 |
de6c94a7 | 247 | %{_mandir}/man8/ipset.8* |
40d655f1 | 248 | |
249 | %files devel | |
250 | %defattr(644,root,root,755) | |
13648ed2 | 251 | %attr(755,root,root) %{_libdir}/libipset.so |
6312651c JB |
252 | %{_libdir}/libipset.la |
253 | %{_includedir}/libipset | |
1e8acbaa | 254 | %{_pkgconfigdir}/libipset.pc |
13648ed2 JK |
255 | |
256 | %files static | |
257 | %defattr(644,root,root,755) | |
258 | %{_libdir}/libipset.a | |
12667538 PS |
259 | |
260 | %files init | |
261 | %defattr(644,root,root,755) | |
a264566a | 262 | %attr(754,root,root) /etc/rc.d/init.d/ipset |
ab2b1724 JB |
263 | |
264 | %files -n bash-completion-ipset | |
265 | %defattr(644,root,root,755) | |
266 | %{bash_compdir}/ipset | |
3bc59268 | 267 | %endif |