- up to 2.4
[packages/xtables-addons.git] / xtables-addons.spec
CommitLineData
8bb72a08 1#
e2d21711
JR
2# UPDATE WARNING: xtables-addons 2.0 support only kernels 3.7+
3#
4#
2741a7bf
AM
5# Conditional build:
6%bcond_without dist_kernel # without distribution kernel
64731849 7%bcond_without kernel # don't build kernel modules
16932b07 8%bcond_without userspace # don't build userspace tools
0b25bb47 9%bcond_with verbose # verbose build (V=1)
64731849
TP
10
11%if %{without kernel}
12%undefine with_dist_kernel
13%endif
0b25bb47
JR
14
15# The goal here is to have main, userspace, package built once with
16# simple release number, and only rebuild kernel packages with kernel
17# version as part of release number, without the need to bump release
18# with every kernel change.
19%if 0%{?_pld_builder:1} && %{with kernel} && %{with userspace}
20%{error:kernel and userspace cannot be built at the same time on PLD builders}
21exit 1
22%endif
23
64731849 24%if "%{_alt_kernel}" != "%{nil}"
0b25bb47
JR
25%if 0%{?build_kernels:1}
26%{error:alt_kernel and build_kernels are mutually exclusive}
27exit 1
28%endif
64731849 29%undefine with_userspace
0b25bb47
JR
30%global _build_kernels %{alt_kernel}
31%else
32%global _build_kernels %{?build_kernels:,%{?build_kernels}}
64731849 33%endif
0b25bb47 34
64731849
TP
35%if %{without userspace}
36# nothing to be placed to debuginfo package
37%define _enable_debug_packages 0
38%endif
39
0b25bb47
JR
40%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)
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
e77b1719 44%define rel 1
e0de918a 45%define pname xtables-addons
fff03056
JB
46Summary: Additional extensions for xtables packet filtering system
47Summary(pl.UTF-8): Dodatkowe rozszerzenia do systemu filtrowania pakietów xtables
0b25bb47 48Name: %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel}
e77b1719 49Version: 2.4
0b25bb47 50Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}}
fff03056 51License: GPL v2
64731849 52Group: Networking/Admin
e0de918a 53Source0: http://downloads.sourceforge.net/xtables-addons/%{pname}-%{version}.tar.xz
e77b1719 54# Source0-md5: b2dfe9a37f328d3a3f6fe402e0596a2c
60cfc309 55URL: http://xtables-addons.sourceforge.net/
bec39f55 56BuildRequires: autoconf >= 2.65
13dd3c36 57BuildRequires: automake >= 1:1.11
84da2698 58BuildRequires: iptables-devel >= 1.4.5
0b25bb47 59%{?with_dist_kernel:%{expand:%kbrs}}
011c75bf 60BuildRequires: libtool
a88a87ac 61BuildRequires: pkgconfig >= 0.9.0
0b25bb47 62BuildRequires: rpmbuild(macros) >= 1.678
a88a87ac
TP
63BuildRequires: tar >= 1.22
64BuildRequires: xz
84da2698 65Requires: iptables >= 1.4.5
3a1015f9 66Obsoletes: iptables-ipp2p
e0de918a 67BuildRoot: %{tmpdir}/%{pname}-%{version}-root-%(id -u -n)
2741a7bf
AM
68
69%description
fff03056
JB
70xtables-addons is the proclaimed successor to patch-o-matic(-ng). It
71contains extensions that were not accepted in the main
72xtables/iptables package.
2741a7bf 73
fff03056 74For the tools to work, you should install kernel modules, which could
0b25bb47 75be found in kernel*-net-xtables-addons.
bcb7e0a4 76
2741a7bf 77%description -l pl.UTF-8
fff03056
JB
78xtables-addons to następca patch-o-matic(-ng). Zawiera rozszerzenia,
79które nie zostały zaakceptowane do głównego pakietu xtables/iptables.
2741a7bf 80
fff03056 81Aby narzędzia działały należy zainstalować moduły jądra, które można
0b25bb47
JR
82znaleźć w pakiecie kernel*-net-xtables-addons.
83
84%define kernel_pkg()\
85%package -n kernel%{_alt_kernel}-net-xtables-addons\
86Summary: Kernel modules for xtables addons\
87Summary(pl.UTF-8): Moudły jądra dla rozszerzeń z pakietu xtables-addons\
88Release: %{rel}@%{_kernel_ver_str}\
89Group: Base/Kernel\
90# VERSION only dependency is intentional, for allowing multiple kernel pkgs and\
91# single userspace package installs.\
92Requires: %{pname} = %{version}\
93Suggests: xtables-geoip\
94Conflicts: xtables-geoip < 20090901-2\
95Requires(post,postun): /sbin/depmod\
96%if %{with dist_kernel}\
97%requires_releq_kernel\
98Requires(postun): %releq_kernel\
99%endif\
100\
101%description -n kernel%{_alt_kernel}-net-xtables-addons\
102Kernel modules for xtables addons.\
103\
104%description -n kernel%{_alt_kernel}-net-xtables-addons -l pl.UTF-8\
105Moduły jądra dla rozszerzeń z pakietu xtables-addons.\
106\
107%files -n kernel%{_alt_kernel}-net-xtables-addons\
108%defattr(644,root,root,755)\
109# restricted permissions - may contain password\
110%attr(600,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/modprobe.d/xt_sysrq.conf\
0b25bb47
JR
111/lib/modules/%{_kernel_ver}/kernel/net/netfilter/compat_xtables.ko*\
112/lib/modules/%{_kernel_ver}/kernel/net/netfilter/xt_*.ko*\
113\
114%post -n kernel%{_alt_kernel}-net-xtables-addons\
115%depmod %{_kernel_ver}\
116\
117%postun -n kernel%{_alt_kernel}-net-xtables-addons\
118%depmod %{_kernel_ver}\
119%{nil}
120
121%define build_kernel_pkg()\
122srcdir=${PWD:-$(pwd)}\
123%build_kernel_modules XA_ABSTOPSRCDIR=$srcdir -C extensions -m compat_xtables\
0b25bb47
JR
124for drv in extensions/compat_xtables.ko extensions/{ACCOUNT/,pknock/,}xt_*.ko ; do\
125%install_kernel_modules -D installed -m ${drv%.ko} -d kernel/net/netfilter\
126done\
127%{nil}
128
129%{?with_kernel:%{expand:%kpkg}}
e3c9233c 130
2741a7bf 131%prep
69b400ea 132%setup -q -n %{pname}-%{version}
2741a7bf
AM
133
134%build
135%configure \
83cb19e1 136 --without-kbuild
7ad03426 137
0b25bb47 138%{?with_kernel:%{expand:%bkpkg}}
7ad03426 139
140%if %{with userspace}
60cfc309
JB
141%{__make} \
142 V=1
7ad03426 143%endif
2741a7bf
AM
144
145%install
146rm -rf $RPM_BUILD_ROOT
147
7ad03426 148%if %{with kernel}
329d0a27 149install -d $RPM_BUILD_ROOT/etc/modprobe.d
0b25bb47
JR
150
151cp -a installed/* $RPM_BUILD_ROOT
152
fd71b2e3 153cat <<'EOF' > $RPM_BUILD_ROOT/etc/modprobe.d/xt_sysrq.conf
fff03056 154# Set password at modprobe time. This file is secure if properly guarded,
fd71b2e3
ER
155# i.e only readable by root.
156#options xt_SYSRQ password=cookies
157
329d0a27
JR
158# The hash algorithm can also be specified as a module option, for example,
159# to use SHA-256 instead of the default SHA-1:
fd71b2e3
ER
160#options xt_SYSRQ hash=sha256
161EOF
60cfc309
JB
162%endif
163
164%if %{with userspace}
165%{__make} -C extensions install \
166 DESTDIR=$RPM_BUILD_ROOT
16932b07
JB
167%{__make} install-man \
168 DESTDIR=$RPM_BUILD_ROOT
60cfc309
JB
169
170%{__rm} $RPM_BUILD_ROOT%{_libdir}/libxt_ACCOUNT_cl.{la,so}
60cfc309 171%endif
fd71b2e3 172
2741a7bf
AM
173%clean
174rm -rf $RPM_BUILD_ROOT
175
a88a87ac 176%post -p /sbin/ldconfig
8f462252
AM
177%postun -p /sbin/ldconfig
178
64731849 179%if %{with userspace}
2741a7bf
AM
180%files
181%defattr(644,root,root,755)
83cb19e1 182%doc README doc/{README.psd,changelog.txt}
8f462252 183%attr(755,root,root) %{_sbindir}/iptaccount
60cfc309
JB
184%attr(755,root,root) %{_libdir}/libxt_ACCOUNT_cl.so.*.*.*
185%attr(755,root,root) %ghost %{_libdir}/libxt_ACCOUNT_cl.so.0
edb92c36 186%attr(755,root,root) %{_libdir}/xtables/libxt_*.so
32aaedb1 187%{_mandir}/man8/iptaccount.8*
8af0bca6 188%{_mandir}/man8/xtables-addons.8*
7ad03426 189%endif
This page took 0.186256 seconds and 4 git commands to generate.