spec file for hostap module building

Chris Weyl cweyl at alumni.drew.edu
Thu May 20 22:45:54 EDT 2004

Hi all!

Here's a spec file to help out with building the hostap-driver code...  
Hopefully it'll be of some assistance:)  It has a few nifty features
that you can use to build for different archs/kernels from the command

I've only tested it building against 2.6.x kernels (fc2).


-------------- next part --------------
# Is this a preversion?
#define prever rc2 

# Comma separated list of cards for which to compile a driver
#%{!?cards: %{expand: %%define cards all}}

# "uname -r" output of the kernel to build for, the running one
# if none was specified with "--define 'kernel <uname -r>'"
%{!?kernel: %{expand: %%define kernel %(uname -r)}}

%define kversion %(echo %{kernel} | sed -e s/smp// -)
%define krelver  %(echo %{kversion} | tr -s '-' '_')
%if %(echo %{kernel} | grep -c smp)
    %{expand:%%define ksmp -smp}
    %{expand:%%define kernel_type smp}
    %{expand:%%define kernel_type up}

%{!?kbuildsrc: %{expand: %%define kbuildsrc /lib/modules/%%{kernel}/build}}

Summary: The hostap kernel modules
Name:    hostap-driver
Version: 0.1.3
Release: %{?prever:0.%{prever}.}4
License: GPL
Group:   System Environment/Kernel
Source:  %{name}-%{version}.tar.gz
Patch:	 makefile-userbuild.patch
URL:     http://hostap.epitest.fi
BuildRoot: %{_tmppath}/%{name}-%{version}-root
#BuildRequires: kernel-source = %{kversion}

This package contains, among other things, the hostap crypt modules
required for WEP using the Intel ipw2100/ipw2200 wireless ethernet

You may recompile for a given kernel version and arch with :
--define "kernel <uname -r output>"
(for example "kernel 2.4.20-9")
--target <arch>

%package -n kernel%{?ksmp}-module-hostap
Summary: The hostap-driver kernel modules.
Release: %{release}_%{krelver}
Group: System Environment/Kernel
Requires: kernel%{?ksmp} = %{kversion}, /sbin/depmod
Provides: kernel-modules hostap-driver
%{?ksmp:Provides: kernel-module-hostap = %{version}-%{release}_%{krelver}}

%description -n kernel%{?ksmp}-module-hostap
Kernel hostap modules.

This package contains the hostap kernel modules for the Linux kernel package :
%{kversion} (%{_target_cpu}%{?ksmp:, SMP}).

%package source
Summary: The hostap-driver source tree.
Group:   Development/System

%description source
This package contains the source tree used to build the hostap-driver
modules.  It is needed to build some additional modules, including the
Intel ipw2100/2200 wireless ethernet drivers.

%setup -q -n %{name}-%{version}%{?prever}

%__make KERNEL_PATH=%{kbuildsrc}

%__rm -rf %{buildroot}
%__mkdir_p %{buildroot}/etc/pcmcia
%__mkdir_p %{buildroot}/lib/modules/%{kernel}/
%__make install DESTDIR=%{buildroot} \

%__mkdir_p %{buildroot}%{_prefix}/src/%{name}-%{version}
%__make clean KERNEL_PATH=%{kbuildsrc}
%__tar cf - . | (cd %{buildroot}%{_prefix}/src/%{name}-%{version} ; %__tar xf -)

echo %{_prefix}/src/%{name}-%{version} > %{buildroot}%{_sysconfdir}/hostap-driver-source


%preun source
if [ -h %{buildroot}%{_prefix}/src/%{name} ] ; then
	%__rm -f %{buildroot}%{_prefix}/src/%{name}

%post -n kernel%{?ksmp}-module-hostap
/sbin/depmod -a

%post source
if [ -h %{buildroot}%{_prefix}/src/%{name} ] ; then
	%__rm -f %{buildroot}%{_prefix}/src/%{name}
	%__ln_s %{buildroot}%{_prefix}/src/%{name}-%{version} \

%postun -n kernel%{?ksmp}-module-hostap
/sbin/depmod -a

rm -rf %{buildroot}

%files -n kernel%{?ksmp}-module-hostap
%defattr(-, root, root)
%doc COPYING README ChangeLog 
%config(noreplace) %{_sysconfdir}/pcmcia/hostap_cs.conf

%files source
%defattr(-, root, root)

* Sat May  8 2004 Chris Weyl <cweyl at alumni.drew.edu>
- first spec file; template blatanly stolen from Matthias Saou's 
  <matthias.saou at est.une.marmotte.net> most excellent alsa-driver
  spec file (see http://www.freshrpms.net/).

More information about the HostAP mailing list