]> git.pld-linux.org Git - packages/ipset.git/blobdiff - ipset.spec
- release 5
[packages/ipset.git] / ipset.spec
index 28b40432d165c718e2e0ed74a9bfdaf34dd29cd7..17a8c812b009d051c9b8278f34a9561a23b78102 100644 (file)
@@ -1,22 +1,39 @@
 #
-# TODO:
-#      - Requires and BuildRequires with proper versions
-#
-%define                version_base    2.3.0
-%define                version_tstamp  20070828
+# Conditional build:
+%bcond_without dist_kernel     # allow non-distribution kernel
+%bcond_without kernel          # don't build kernel modules
+%bcond_without userspace       # don't build userspace tools
+%bcond_with    verbose         # verbose build (V=1)
+
+%if %{without kernel}
+%undefine      with_dist_kernel
+%endif
+%if "%{_alt_kernel}" != "%{nil}"
+%undefine      with_userspace
+%endif
+%if %{without userspace}
+# nothing to be placed to debuginfo package
+%define                _enable_debug_packages  0
+%endif
+
+%define                rel     5
+%define                pname   ipset
 Summary:       IP sets utility
 Summary(pl.UTF-8):     Narzędzie do zarządzania zbiorami IP
-Name:          ipset
-Version:       %{version_base}_%{version_tstamp}
-Release:       1
+Name:          %{pname}%{_alt_kernel}
+Version:       4.4
+Release:       %{rel}
 License:       GPL
 Group:         Networking/Admin
-Source0:       http://ipset.netfilter.org/%{name}-%{version_base}-%{version_tstamp}.tar.bz2
-# Source0-md5: 9e17798dfd8ed87c63a1f3498f9fe64d
-Source1:       %{name}.init
-Patch0:                %{name}-no_kernel_headers.patch
+Source0:       http://ipset.netfilter.org/%{pname}-%{version}.tar.bz2
+# Source0-md5: e21e9d9dfb8a01fc0122323ff1d6cbdb
+Source1:       %{pname}.init
+Patch0:                shadow-args.patch
 URL:           http://ipset.netfilter.org/
-BuildRequires: linux-libc-headers >= 7:2.6.22.1-2
+%{?with_dist_kernel:BuildRequires:     kernel%{_alt_kernel}-module-build >= 3:2.6.20.2}
+%{?with_userspace:BuildRequires:       linux-libc-headers >= 7:2.6.22.1-2}
+BuildRequires: rpmbuild(macros) >= 1.379
+Suggests:      kernel-net-ipset
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -39,71 +56,150 @@ Summary(pl.UTF-8): Pliki nagłówkowe do interfejsu ipset
 Group:         Development/Libraries
 
 %description devel
-Header files for ipset interface.
+Header files for IPset interface.
 
 %description devel -l pl.UTF-8
-Pliki nagłówkowe do interfejsu ipset.
+Pliki nagłówkowe do interfejsu IPset.
 
 %package init
-Summary:       Ipset init (RedHat style)
+Summary:       IPset init script
+Summary(pl.UTF-8):     Skrypt startowy IPset
 Group:         Networking/Admin
 Requires(post,preun):  /sbin/chkconfig
-Requires:      %{name}
+Requires:      %{pname} = %{version}-%{release}
 Requires:      rc-scripts
 
 %description init
-Ipset initialization script.
+IPset initialization script.
+
+%description init -l pl.UTF-8
+Skrypt startowy IPset.
+
+%package -n kernel%{_alt_kernel}-net-ipset
+Summary:       IPset kernel modules
+Summary(pl.UTF-8):     Moduły jądra oferujące wsparcie dla zbiorów IP
+Release:       %{rel}@%{_kernel_ver_str}
+Group:         Base/Kernel
+%{?with_dist_kernel:%requires_releq_kernel}
+Requires(post,postun): /sbin/depmod
+
+%description -n kernel%{_alt_kernel}-net-ipset
+IP sets are a framework inside the Linux 2.4.x and 2.6.x kernel, which
+can be administered by the ipset utility. Depending on the type,
+currently an IP set may store IP addresses, (TCP/UDP) port numbers or
+IP addresses with MAC addresses in a way, which ensures lightning
+speed when matching an entry against a set.
+
+This package contains kernel modules.
+
+%description -n kernel%{_alt_kernel}-net-ipset -l pl.UTF-8
+Zbiory IP to szkielet w jądrze Linuksa 2.4.x i 2.6.x, którym można
+administrować przy użyciu narzędzia ipset. W zależności od rodzaju
+aktualnie zbiór IP może przechowywać adresy IP, numery portów
+(TCP/UDP) lub adresy IP z adresami MAC - w sposób zapewniający
+maksymalną szybkość przy dopasowywaniu elementu do zbioru.
+
+Ten pakiet zawiera moduły jądra oferujące wsparcie dla zbiorów IP.
 
 %prep
-%setup -qn %{name}-%{version_base}
+%setup -q -n %{pname}-%{version}
 %patch0 -p1
+mv kernel/{Kbuild,Makefile}
+
+# these options can be overriden by module parameters.
+# maximum number of ipsets.
+%{__sed} -i 's:$(IP_NF_SET_MAX):256:' kernel/Makefile
+# hash size for bindings of IP sets.
+%{__sed} -i 's:$(IP_NF_SET_HASHSIZE):1024:' kernel/Makefile
+
+%if "%{cc_version}" < "3.4"
+%{__sed} -i -e 's/-Wextra//' Makefile
+%{__sed} -i -e 's/-Winit-self//' Makefile
+%{__sed} -i -e 's/-Wold-style-definition//' Makefile
+%{__sed} -i -e 's/-Wno-missing-field-initializers//' Makefile
+%endif
 
 %build
-%{__make} \
+%if %{with userspace}
+%{__make} binaries \
+       CC="%{__cc}" \
        PREFIX="%{_prefix}" \
        LIBDIR="%{_libdir}" \
        MANDIR="%{_mandir}" \
        BINDIR="%{_sbindir}" \
        COPT_FLAGS:="%{rpmcflags}"
+%endif
+
+%if %{with kernel}
+# ugly hack for satisfy rpm build macro. in fact all modules will be built.
+%build_kernel_modules -C kernel -m ip_set
+%endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
+
+%if %{with userspace}
 install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_includedir}}
 
-%{__make} install \
+%{__make} binaries_install \
        DESTDIR="$RPM_BUILD_ROOT" \
        PREFIX="%{_prefix}" \
        LIBDIR="%{_libdir}" \
        MANDIR="%{_mandir}" \
        BINDIR="%{_sbindir}"
 
-install *.h $RPM_BUILD_ROOT%{_includedir}
+cp -a *.h $RPM_BUILD_ROOT%{_includedir}
+install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{pname}
+%endif
 
-install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+%if %{with kernel}
+cd kernel
+%install_kernel_modules -m ip_set -d kernel/net/ipv4/netfilter
+install -p ip_set_*.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter
+install -p ipt_*.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter
+cd -
+%endif
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %post init
-/sbin/chkconfig --add %{name}
+/sbin/chkconfig --add %{pname}
 
 %preun init
 if [ "$1" = "0" ]; then
-       /sbin/chkconfig --del %{name}
+       /sbin/chkconfig --del %{pname}
 fi
 
+%post  -n kernel%{_alt_kernel}-net-ipset
+%depmod %{_kernel_ver}
+
+%postun        -n kernel%{_alt_kernel}-net-ipset
+%depmod %{_kernel_ver}
+
+%if %{with userspace}
 %files
 %defattr(644,root,root,755)
 %doc ChangeLog ChangeLog.ippool TODO
-%attr(755,root,root) %{_sbindir}/*
+%attr(755,root,root) %{_sbindir}/ipset
 %dir %{_libdir}/ipset
-%attr(755,root,root) %{_libdir}/ipset/*.so
-%{_mandir}/man8/*
+%attr(755,root,root) %{_libdir}/ipset/libipset_*.so
+%{_mandir}/man8/ipset.8*
 
 %files devel
 %defattr(644,root,root,755)
-%{_includedir}/*.h
+%{_includedir}/ipset.h
+%{_includedir}/libipt_set.h
 
 %files init
 %defattr(644,root,root,755)
-%attr(754,root,root) /etc/rc.d/init.d/*
+%attr(754,root,root) /etc/rc.d/init.d/ipset
+%endif
+
+%if %{with kernel}
+%files -n kernel%{_alt_kernel}-net-ipset
+%defattr(644,root,root,755)
+/lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/ip_set*.ko*
+/lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/ipt_set*.ko*
+/lib/modules/%{_kernel_ver}/kernel/net/ipv4/netfilter/ipt_SET*.ko*
+%endif
This page took 0.070783 seconds and 4 git commands to generate.