Package kernel-modules-madwifi-ovz-rhel: Specfile

%define module_name	madwifi
%define module_version	0.9.4
%define module_release	alt6

%define kversion	2.6.18
%define krelease	alt13.M51.42
%define flavour		ovz-rhel

%define norm_version	%kversion

%define module_dir /lib/modules/%kversion-%flavour-%krelease/net

Summary: Modules for Atheros-based WiFi .11a/b/g adapters
Name: kernel-modules-%module_name-%flavour
Version: %module_version
Release: %module_release.132626.13.M51.42
Serial: 2
License: Dual: GPL or BSD
Group: System/Kernel and hardware

Packager: Kernel Maintainer Team <kernel@packages.altlinux.org>

ExclusiveOS: Linux
Url: http://www.kernel.org/
BuildRequires: perl sharutils
BuildRequires(pre): rpm-build-kernel
BuildRequires: kernel-source-%module_name = %module_version
BuildRequires: kernel-headers-modules-%flavour = %kversion-%krelease

Provides:  kernel-modules-%module_name-%kversion-%flavour-%krelease = %version-%release
Conflicts: kernel-modules-%module_name-%kversion-%flavour-%krelease < %version-%release
Conflicts: kernel-modules-%module_name-%kversion-%flavour-%krelease > %version-%release

PreReq: coreutils
PreReq: kernel-image-%flavour = %kversion-%krelease
Requires(postun): kernel-image-%flavour = %kversion-%krelease
ExclusiveArch: %ix86 x86_64
Patch1: madwifi-kernel-2.6.27.patch
Patch2: madwifi-kernel-2.6.18-ovz-rhel.patch
%if "%flavour" == "ovz-rhel"
Patch3: madwifi-kernel-2.6.18-ovz-rhel-ath-netdev.patch
%endif

%description
This software contains a Linux kernel driver for Atheros-based
Wireless LAN devices.  The driver supports both station and AP modes
of operation.  The driver is actually a port of the BSD Atheros
driver and includes a port of the 802.11 link layer code originally
found in NetBSD.

A full list of product solutions utilizing Atheros chips can be found
at http://www.atheros.com/partners/solutions.html

%prep
rm -rf kernel-source-%module_name-%module_version

tar -jxvf %kernel_src/kernel-source-%module_name-%module_version.tar.bz2

%setup -D -T -n kernel-source-%module_name-%module_version
%if "%kversion" >= "2.6.27"
%patch1 -p1
%endif
%patch2 -p0
%if "%flavour" == "ovz-rhel"
%patch3 -p1
%endif
%build
. %_usrsrc/linux-%kversion-%flavour/gcc_version.inc
make CC="gcc-$GCC_VERSION" \
%ifarch %ix86
     CC="gcc-$GCC_VERSION -m32" \
%endif
     TARGET=%base_arch-elf TOOLPREFIX= \
     KERNELRELEASE=%kversion-%flavour-%krelease \
     KERNELPATH=%_usrsrc/linux-%kversion-%flavour \
     MODULEPATH=%module_dir 

%install
mkdir -p $RPM_BUILD_ROOT%module_dir/

. %_usrsrc/linux-%kversion-%flavour/gcc_version.inc
make CC=gcc-$GCC_VERSION \
        TARGET=%base_arch-elf TOOLPREFIX= \
	KERNELRELEASE=%kversion-%flavour-%krelease \
	KERNELPATH=%_usrsrc/linux-%kversion-%flavour \
	MODULEPATH=%module_dir \
	DESTDIR=$RPM_BUILD_ROOT install

%post
%post_kernel_modules %kversion-%flavour-%krelease

%postun
%postun_kernel_modules %kversion-%flavour-%krelease

%files
%module_dir

%changelog
* Sat Jun 13 2015 Gleb F-Malinovskiy <glebfm@altlinux.org> 2:0.9.4-alt6.132626.13.M51.42
- Build for kernel-image-ovz-rhel-2.6.18-alt13.M51.42.

* Fri Jan 28 2011 Anton Protopopov <aspsk@altlinux.org> 2:0.9.4-alt6
- Do not apply previous patch to other kernels than ovz-rhel

* Fri Jan 28 2011 Anton Protopopov <aspsk@altlinux.org> 2:0.9.4-alt5
- Fix build with ovz-rhel-alt13.M51.21

* Thu May 21 2009 Anton Protopopov <aspsk@altlinux.org> 2:0.9.4-alt4
- Fix build on ovz-rhel kernel

* Mon Mar 02 2009 Anton Protopopov <aspsk@altlinux.org> 2:0.9.4-alt3
- Fake release

* Sat Mar 08 2008 L.A. Kostis <lakostis@altlinux.ru> 2:0.9.4-alt1
- 0.9.4.

* Sun Nov 04 2007 L.A. Kostis <lakostis@altlinux.ru> 2:0.9.3.3-alt1
- 0.9.3.3.

* Fri Aug 03 2007 L.A. Kostis <lakostis@altlinux.ru> 2:0.9.3.1-alt2
- rebuild with new kernel-source.

* Wed May 23 2007 L.A. Kostis <lakostis@altlinux.ru> 2:0.9.3.1-alt1
- version 0.9.3.1.

* Fri May 11 2007 L.A. Kostis <lakostis@altlinux.ru> 2:0.9.3-alt1
- version 0.9.3.

* Mon Jan 29 2007 Sergey Vlasov <vsu@altlinux.ru> 2:0.9.2-alt3
- Removed unneeded "Prereq: modutils".

* Fri Oct 27 2006 L.A. Kostis <lakostis@altlinux.org> 2:0.9.2-alt2
- add hack for %%ix86 cross-build on x86_64 host.

* Sat Sep 02 2006 Alexei Takaseev <taf@altlinux.ru> 2:0.9.2-alt1
- 0.9.2 release
- Transition to the official name of versions

* Wed Feb 01 2006 Alexei Takaseev <taf@altlinux.ru> 1:0.9.4.5-alt1
- 20060201 snapshot

* Sun Dec 11 2005 Alexei Takaseev <taf@altlinux.ru> 1:0.9.4.5-alt1
- madwifi-ng

* Sun Dec 04 2005 Sergey Vlasov <vsu@altlinux.ru> 0.9.14.9-alt2
- Enabled build for x86_64.

* Sat May 21 2005 Alexei Takaseev <taf@altlinux.ru> 0.9.14.9-alt1
- Version 0.9.14.9

* Wed Dec 29 2004 Sergey Vlasov <vsu@altlinux.ru> 0.9.4.12-alt1
- Version 0.9.4.12.
- Dropped obsolete compat patch.
- Fixed %%prep and %%install.

* Sun Dec 26 2004 Sergey Vlasov <vsu@altlinux.ru> 0.8.5.4-alt7
- Rebuild for kernel 2.4.28.

* Sun Oct 17 2004 Sergey Vlasov <vsu@altlinux.ru> 0.8.5.4-alt6
- Rebuild for kernel 2.4.27.

* Wed Aug 18 2004 Sergey Vlasov <vsu@altlinux.ru> 0.8.5.4-alt5
- Fixed build with kernel 2.6.8.

* Tue Aug 17 2004 Sergey Vlasov <vsu@altlinux.ru> 0.8.5.4-alt4
- Added patch:
  + madwifi-0.8.5.4-2.6.8-compat.patch: compatibility with the sysctl API
    change in 2.6.8

* Tue Aug 03 2004 Sergey Vlasov <vsu@altlinux.ru> 0.8.5.4-alt3
- Use %%post_kernel_modules and %%postun_kernel_modules macros in scripts.

* Thu May 13 2004 Sergey Vlasov <vsu@altlinux.ru> 0.8.5.4-alt2
- Rebuild for kernel 2.4.26.

* Wed Apr 14 2004 Alexander Bokovoy <ab@altlinux.ru> 0.8.5.4-alt1
- 0.8.5.4

* Fri Feb 27 2004 Sergey Vlasov <vsu@altlinux.ru> 0.8.3.2-alt9
- Updated for the new compiler version selection scheme (GCC_VERSION).

* Fri Nov 28 2003 Sergey Vlasov <vsu@altlinux.ru> 0.8.3.2-alt8
- Added Provides/Conflicts to make sure that only one version of the package
  can be installed for each kernel version.

* Tue Nov 18 2003 Sergey Vlasov <vsu@altlinux.ru> 0.8.3.2-alt7
- Fixed spec file name.
- Fixed %%module_dir definition.
- Avoid %%postun failure when this package is removed after
  kernel-image-%%flavour (currently rpm cannot prevent this).

* Fri Sep 26 2003 Sergey Vlasov <vsu@altlinux.ru> 0.8.3.2-alt6
- replaced %%{_usrsrc}/kernel/sources with %%kernel_src
- fixed BuildRequires

* Thu Sep 18 2003 Alexander Bokovoy <ab@altlinux.ru> 0.8.3.2-alt5
- Rebuild against kernel-sources-madwifi-0.8.3.2-alt3

* Tue Sep 09 2003 Anton Farygin <rider@altlinux.ru> 0.8.3.2-alt4
- defined norm_version

* Fri Sep 05 2003 Alexander Bokovoy <ab@altlinux.ru> 0.8.3.2-alt3
- Imported into ALT Linux Kernel CVS

* Fri Aug 22 2003 Alexander Bokovoy <ab@altlinux.ru> 0.8.3.2-alt2
- Rebuild for 2.4.21rel-std-up-alt13

* Sat Aug 16 2003 Alexander Bokovoy <ab@altlinux.ru> 0.8.3.2-alt1
- Initial release