]> git.pld-linux.org Git - packages/ipset.git/blob - ipset.spec
- updated kernel build macro magic
[packages/ipset.git] / ipset.spec
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  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
12 %if %{without kernel}
13 %undefine       with_dist_kernel
14 %endif
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
25 %if "%{_alt_kernel}" != "%{nil}"
26 %if 0%{?build_kernels:1}
27 %{error:alt_kernel and build_kernels are mutually exclusive}
28 exit 1
29 %endif
30 %undefine       with_userspace
31 %global         _build_kernels          %{alt_kernel}
32 %else
33 %global         _build_kernels          %{?build_kernels:,%{?build_kernels}}
34 %endif
35
36 %if %{without userspace}
37 # nothing to be placed to debuginfo package
38 %define         _enable_debug_packages  0
39 %endif
40
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)
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
45 %define         rel     2
46 %define         pname   ipset
47 Summary:        IP sets utility
48 Summary(pl.UTF-8):      Narzędzie do zarządzania zbiorami IP
49 Name:           %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel}
50 Version:        6.20.1
51 Release:        %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}}
52 License:        GPL v2
53 Group:          Networking/Admin
54 #Source0Download: http://ipset.netfilter.org/install.html
55 Source0:        http://ipset.netfilter.org/%{pname}-%{version}.tar.bz2
56 # Source0-md5:  8af741492752fbf24d3a28a9d1473d40
57 Source1:        %{pname}.init
58 URL:            http://ipset.netfilter.org/
59 BuildRequires:  autoconf >= 2.50
60 BuildRequires:  automake
61 BuildRequires:  libmnl-devel >= 1
62 BuildRequires:  libltdl-devel >= 2:2.0
63 BuildRequires:  libtool >= 2:2.0
64 %{?with_userspace:BuildRequires:        linux-libc-headers >= 7:2.6.38.6}
65 BuildRequires:  pkgconfig
66 BuildRequires:  rpmbuild(macros) >= 1.678
67 %{?with_dist_kernel:%{expand:%kbrs}}
68 Suggests:       kernel-net-ipset
69 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
70
71 # unresolved ipset_errcode, defined in the ipset binary
72 %define         skip_post_check_so      libipset\.so.*
73
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
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
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.
88
89 %package devel
90 Summary:        Header files for ipset interface
91 Summary(pl.UTF-8):      Pliki nagłówkowe do interfejsu ipset
92 Group:          Development/Libraries
93 Requires:       %{name} = %{version}-%{release}
94 Requires:       libmnl-devel >= 1
95
96 %description devel
97 Header files for IPset interface.
98
99 %description devel -l pl.UTF-8
100 Pliki nagłówkowe do interfejsu IPset.
101
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
114 %package init
115 Summary:        IPset init script
116 Summary(pl.UTF-8):      Skrypt startowy IPset
117 Group:          Networking/Admin
118 Requires(post,preun):   /sbin/chkconfig
119 Requires:       %{pname} = %{version}-%{release}
120 Requires:       rc-scripts
121
122 %description init
123 IPset initialization script.
124
125 %description init -l pl.UTF-8
126 Skrypt startowy IPset.
127
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}}
191
192 %prep
193 %setup -q -n %{pname}-%{version}
194
195 %build
196 %if %{with userspace}
197 %configure \
198         --disable-silent-rules \
199         --with-kmod=no \
200         --with-settype-modules-list=all
201
202 %{__make}
203 %endif
204
205 %{?with_kernel:%{expand:%bkpkg}}
206
207 %install
208 rm -rf $RPM_BUILD_ROOT
209
210 %if %{with userspace}
211 install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_includedir}/libipset}
212
213 %{__make} install \
214         DESTDIR=$RPM_BUILD_ROOT
215 cp include/libipset/*.h $RPM_BUILD_ROOT%{_includedir}/libipset
216
217 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{pname}
218 %endif
219
220 %if %{with kernel}
221 install -d $RPM_BUILD_ROOT
222 cp -a installed/* $RPM_BUILD_ROOT
223 %endif
224
225 %clean
226 rm -rf $RPM_BUILD_ROOT
227
228 %post init
229 /sbin/chkconfig --add %{pname}
230
231 %preun init
232 if [ "$1" = "0" ]; then
233         /sbin/chkconfig --del %{pname}
234 fi
235
236 %if %{with userspace}
237 %files
238 %defattr(644,root,root,755)
239 %doc ChangeLog ChangeLog.ippool README UPGRADE
240 %attr(755,root,root) %{_sbindir}/ipset
241 %attr(755,root,root) %{_libdir}/libipset.so.*.*.*
242 %attr(755,root,root) %ghost %{_libdir}/libipset.so.3
243 %{_mandir}/man8/ipset.8*
244
245 %files devel
246 %defattr(644,root,root,755)
247 %attr(755,root,root) %{_libdir}/libipset.so
248 %{_libdir}/libipset.la
249 %{_includedir}/libipset
250 %{_pkgconfigdir}/libipset.pc
251
252 %files static
253 %defattr(644,root,root,755)
254 %{_libdir}/libipset.a
255
256 %files init
257 %defattr(644,root,root,755)
258 %attr(754,root,root) /etc/rc.d/init.d/ipset
259 %endif
This page took 0.085108 seconds and 4 git commands to generate.