+# TODO:
+# - add firmware download?
#
# Conditional build:
-# _without_dist_kernel without distribution kernel
+%bcond_without dist_kernel # without distribution kernel
#
-# TODO:
-# - UP/SMP scheme, pass CC and CFLAGS
-%define _orig_name acx100_pci
-
-Summary: Linux driver for WLAN card base on ACX100
-Summary(pl): Sterownik dla Linuksa do kart bezprzewodowych na uk³adzie ACX100
-Name: kernel-net-acx100
-Version: 0.2.0pre4
-%define _rel 0.4
-Release: %{_rel}@%{_kernel_ver_str}
-License: GPL
+Summary: Linux driver for WLAN card base on ACX100/ACX111
+Summary(pl.UTF-8): Sterownik dla Linuksa do kart bezprzewodowych na układzie ACX100/ACX111
+Name: acx
+Version: 20070101
+%define _rel 4
+Release: %{_rel}
+License: MPL or GPL
Group: Base/Kernel
-Source0: http://rhlx01.fht-esslingen.de/~andi/acx100/acx100-%{version}.tar.bz2
-# Source0-md5: cc4e97d866116af36f24b1c52db8e4a8
-URL: http://acx100.sourcefroge.net/index.html
-%{!?_without_dist_kernel:BuildRequires: kernel-headers >= 2.4.0}}
-BuildRequires: rpmbuild(macros) >= 1.118
-%{!?_without_dist_kernel:%requires_releq_kernel_up}
-Requires(post,postun): /sbin/depmod
-Obsoletes: kernel-net-acx100
+Source0: http://www.cmartin.tk/acx/%{name}-%{version}.tar.bz2
+# Source0-md5: ec6322b9c82781897a9433ef0cefda6f
+Patch0: %{name}-skb.patch
+# based on https://dev.openwrt.org/browser/trunk/package/acx/patches/003-2.6.24-compat.diff?rev=10425&format=txt
+Patch1: %{name}-2.6.24.patch
+Patch2: %{name}-2.6.29.patch
+Patch3: %{name}-2.6.30.patch
+URL: http://acx100.sourceforge.net/
+%{?with_dist_kernel:BuildRequires: kernel%{_alt_kernel}-module-build >= 3:2.6.20.2}
+BuildRequires: rpmbuild(macros) >= 1.379
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
-This is driver for WLAN card based on ACX100 for Linux.
+This is driver for WLAN card based on ACX100/ACX111 for Linux.
-%description -l pl
-Sterownik dla Linuksa do kart WLAN opartych o uk³ad ACX100.
+%description -l pl.UTF-8
+Sterownik dla Linuksa do kart WLAN opartych o układ ACX100/ACX111.
+
+%package -n kernel%{_alt_kernel}-net-acx
+Summary: Linux driver for WLAN card base on ACX100/ACX111
+Summary(pl.UTF-8): Sterownik dla Linuksa do kart bezprzewodowych na układzie ACX100/ACX111
+Release: %{_rel}@%{_kernel_ver_str}
+Group: Base/Kernel
+%{?with_dist_kernel:%requires_releq_kernel}
+Requires(post,postun): /sbin/depmod
+Obsoletes: kernel%{_alt_kernel}-net-acx100
+
+%description -n kernel%{_alt_kernel}-net-acx
+This is driver for WLAN card based on ACX100/ACX111 for Linux.
+
+%description -n kernel%{_alt_kernel}-net-acx -l pl.UTF-8
+Sterownik dla Linuksa do kart WLAN opartych o układ ACX100/ACX111.
%prep
-%setup -q -c
+%setup -q
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
%build
-%{__make} -C acx100-%{version}
+%build_kernel_modules -m acx
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc
-install acx100-%{version}/src/%{_orig_name}.o $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/%{_orig_name}.o
+
+%install_kernel_modules -m acx -d misc
%clean
rm -rf $RPM_BUILD_ROOT
-%post
+%post -n kernel%{_alt_kernel}-net-acx
%depmod %{_kernel_ver}
-%postun
+%postun -n kernel%{_alt_kernel}-net-acx
%depmod %{_kernel_ver}
-%files
+%files -n kernel%{_alt_kernel}-net-acx
%defattr(644,root,root,755)
-#%doc readme
-/lib/modules/%{_kernel_ver}/misc/*
+%doc Changelog README
+/lib/modules/%{_kernel_ver}/misc/*.ko*