-%define _kernel_ver %(grep UTS_RELEASE %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | cut -d'"' -f2)
-%define _kernel_ver_str %(echo %{_kernel_ver} | sed s/-/_/g)
-%define smpstr %{?_with_smp:-smp}
-%define smp %{?_with_smp:1}%{!?_with_smp:0}
+#
-Summary: CVSFS
-Summary(pl): CVSFS
+%define no_install_post_compress_modules 1
+
+Summary: CVSFS - CVS filesystem
+Summary(pl): CVSFS - system plikowy CVS
Name: cvsfs
-Version: 1.0.4
-Release: 1
+Version: 1.1.4
+%define _rel 2
+Release: %{_rel}
License: GPL
-Group: Networking/Daemons
-Group(de): Netzwerkwesen/Server
-Group(pl): Sieciowe/Serwery
-Source0: http://prdownloads.sourceforge.net/%{name}/%{name}-%{version}.zip
-Patch0: %{name}-config.patch
+Group: Tools
+Source0: ftp://download.sourceforge.net/pub/sourceforge/%{name}/%{name}-%{version}.tar.gz
+Patch0: cvsfs-Makefile.am.patch
+URL: http://sourceforge.net/projects/cvsfs/
+BuildRequires: autoconf
+BuildRequires: automake
+BuildRequires: libstdc++-devel
+BuildRequires: gcc-c++
+%{!?_without_dist_kernel:BuildRequires: kernel-headers}
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-%define _sysconfdir /etc
-
%description
+CVS FS tools.
%description -l pl
+Narzêdzia do obs³ugi CVS FS.
+
+%package -n kernel-cvsfs
+Summary: CVSFS kernel module
+Summary(pl): Modu³ j±dra CVSFS
+Release: %{_rel}@%{_kernel_ver_str}
+Group: Base/Kernel
+Prereq: /sbin/depmod
+Requires: cvsfs
+%{!?_without_dist_kernel:%requires_releq_kernel_up}
+
+%description -n kernel-cvsfs
+CVS FS module.
-%package -n kernel%{smpstr}-cvsfs
+%description -n kernel-cvsfs -l pl
+Modó³ CVS FS.
+
+%package -n kernel-smp-cvsfs
Summary: CVSFS kernel module
Summary(pl): Modu³ j±dra CVSFS
-Release: %{release}@%{_kernel_ver_str}
+Release: %{_rel}@%{_kernel_ver_str}
Group: Base/Kernel
-Group(de): Grundsätzlich/Kern
-Group(pl): Podstawowe/J±dro
Prereq: /sbin/depmod
+Requires: cvsfs
+%{!?_without_dist_kernel:%requires_releq_kernel_smp}
-%description -n kernel%{smpstr}-cvsfs
+%description -n kernel-smp-cvsfs
+CVS FS module for SMP kernel.
-%description -n kernel%{smpstr}-cvsfs -l pl
+%description -n kernel-smp-cvsfs -l pl
+Modó³ CVS FS fla kernela SMP.
%prep
%setup -q
%patch0 -p0
%build
-%{__make} \
-%if %{smp}
- CFLAGS+=" -D__KERNEL_SMP=1"
-%endif
+%{__aclocal}
+%{__automake} --gnu --add-missing
+%{__autoconf}
+%configure
+
+CXXFLAGS="-DMODULES -D__SMP__ -D__KERNEL_SMP=1" %{__make}
+
+mv cvsfs/cvsfs.o cvsfs/cvsfs-smp.o
+
+%{__make}
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}} \
- $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/fs
+install -d \
+ $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/fs \
+ $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/fs \
+ $RPM_BUILD_ROOT%{_sbindir}
+
+install cvsmnt/cvsmnt $RPM_BUILD_ROOT%{_sbindir}
+install cvsmount/cvsmount $RPM_BUILD_ROOT%{_sbindir}
+install cvsumount/cvsumount $RPM_BUILD_ROOT%{_sbindir}
-install cvsmnt/cvsmnt $RPM_BUILD_ROOT%{_bindir}
-install cvsmount/cvsmount $RPM_BUILD_ROOT%{_bindir}
-install cvsmount/mount.cvsfs $RPM_BUILD_ROOT%{_bindir}
-install cvsumount/cvsmount $RPM_BUILD_ROOT%{_bindir}
install cvsfs/cvsfs.o $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/fs
-gzip -9nf ChangeLog README INSTALL
+install cvsfs/cvsfs-smp.o $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/fs/cvsfs.o
%clean
rm -rf $RPM_BUILD_ROOT
-%post -n kernel%{smpstr}-cvsfs
+%post -n kernel-cvsfs
+/sbin/depmod -a
+
+%postun -n kernel-cvsfs
/sbin/depmod -a
-%postun -n kernel%{smpstr}-cvsfs
+%post -n kernel-smp-cvsfs
+/sbin/depmod -a
+
+%postun -n kernel-smp-cvsfs
/sbin/depmod -a
%files
%defattr(644,root,root,755)
-%doc ChangeLog.gz README.gz
-%attr(755,root,root) %{_bindir}/*
+%doc ChangeLog README
+%attr(755,root,root) %{_sbindir}/*
+
+%files -n kernel-cvsfs
+%defattr(644,root,root,755)
+%attr(600,root,root) /lib/modules/%{_kernel_ver}/fs/cvsfs.o
-%files -n kernel%{smpstr}-cvsfs
+%files -n kernel-smp-cvsfs
%defattr(644,root,root,755)
-%attr(600,root,root) /lib/modules/*/fs/cvsfs.o
+%attr(600,root,root) /lib/modules/%{_kernel_ver}smp/fs/cvsfs.o