%define build_kmod 1
%define kversion %(uname -r)
%define kver    %(uname -r | sed -e 's/-/_/g')
%define kflavor %(uname -r | sed -e 's/.*vl.//')
%if "%kflavor" == ""
%undefine kflavor
%endif
%define kmod	kernel-module%{?kflavor:-%{kflavor}}

%define name	alsa-driver
%define ver	1.0.22.1
%define rel	1%{?_dist_release}

Summary:        Advanced Linux Sound Archtecture (ALSA) Drivers
Name:		%{name}
Version:	%{ver}
Release: 	%{rel}
Source0:	ftp://ftp.alsa-project.org/pub/driver/%{name}-%{version}.tar.bz2

License:	GPLv2
Group:		System Environment/Kernel
URL:            http://alsa-project.org/
Vendor:         Project Vine
Distribution:   Vine Linux

BuildRequires:	kernel-devel
BuildRoot:	%{_tmppath}/%{name}-%{version}-root


%description
This package contains the newest ALSA %{version} drivers.

%description -l ja
このパッケージには最新の ALSA ドライババージョン %{version} が
収録されています。


%package -n %{kmod}-%{name}
Summary:        Collection of recent wireless drivers backported
Version:	%{ver}_%{kver}
License:	GPLv2
Group:		System Environment/Kernel
Requires:	kernel = %{kversion}
PreReq:		kernel = %{kversion}
Provides:       alsa-driver = %{ver}

%description -n %{kmod}-%{name}
This package contains the newest ALSA %{version} drivers
explicitly built for kernel%{?kflavor:-%{kflavor}}-%{kversion}

%description -l ja -n %{kmod}-%{name}
このパッケージには、kernel%{?kflavor:-%{kflavor}}-%{kversion} 用にビルドされた
最新の ALSA ドライババージョン %{ver} が収録されています。


%prep
%setup -q


%build
%if %{build_kmod}
%configure \
  --with-cards=all --with-redhat=auto \
  --with-moddir=/lib/modules/%{kversion}%{?kflavor:%{kflavor}}/updates/alsa
%__make
%endif


%install
%__rm -rf %{buildroot}

%if %{build_kmod}
%__make DESTDIR=%{buildroot} install-modules
%endif


%clean
%__rm -rf %{buildroot}


%post -n %{kmod}-%{name}
/sbin/depmod -a -F /boot/System.map-%{kversion} %{kversion}


%if %{build_kmod}
%files -n %{kmod}-%{name}
%defattr(-,root,root)
%doc COPYING FAQ README TODO
%doc CARDS-STATUS INSTALL SUPPORTED_KERNELS WARNING
/lib/modules/%{kversion}%{?kflavor:%{kflavor}}/updates/alsa
%endif


%changelog
* Wed Dec 30 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.22-1
- new upstream release

* Fri Oct  9 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.0.21-2
- kernel-module-alsa-driver now Provides: alsa-driver

* Thu Oct  8 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.0.21-1
- new upstream release 1.0.21

* Fri Jul  3 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.0.20-2
- slight changes on Japanese description

* Thu Jul  2 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.0.20-1
- new upstream release 1.0.20
- now alsa-driver is back as a kernel-module package
  (to make backporting much easier for maintenance)
