On Tue, Nov 07, 2006 at 08:40:12PM +0200, Elan Ruusamäe wrote:
> On Tuesday 07 November 2006 19:22, [EMAIL PROTECTED] wrote:
> > Right now we are copying code for building kernel 2.6 modules to each
> > spec which provides them. It is a little hard to maintain and to add
> > some functionality. I have created macro for building modules based on
> > that code, a little expanded (with cross-compilation support). Now in
> > spec file thete will only have to be some thing like:
> >
> > %if %{with kernel}
> > cd module/place
> > %build_kernel_modules module_name1 module_name2
> > cd ../..
> > %endif
> could you post the sample specfile and initial macros?

spec for ieee80211, and initial macros, you mean SOURCES/rpm.macros ?
for now I'm testing it in my ~/.rpmmacros

> > If some additional options for make modules are required they may be
> > passed like: -1 option1 -2 option2 -3 option3; up to 9 options are
> > supported.
> i belive this "limitation" can be avoided by using %* macro for parameters 
> and 
> say -m modulename1,modulename2 for passing module name(s)

good point, changed

> > Exemple when some additional option in make modules is required:
> >
> > %build_kernel_modules -1 T=$TMPDIR mola

now it becomes:
%build_kernel_modules T=$TMPDIR -m mol

> > There may be 2 options passed to make prepare scripts: -p o1 -P o2.
> > Module patching is supported via shell script called pld-module.patch.
> >
> > Exemple with additional patching:
> >
> > %if %{with kernel}
> > cp -f pwc-if.c pwc-if.c.orig
> >
> > cat > pld-module.patch <<'EOF'
> perhaps name it with .sh extension?

I knew pld-module.patch won't be the best name just after it came to my
mind, changed.


What I don't understand is why %{error: blabla} does not stop building,
it's just displayed at the beginning.

-- 
 ____  Sparky{PI] -- Przemyslaw _  ___  _  _  ........... LANG...Pl..Ca..Es..En
/____) ___  ___  _ _ || Iskra  |  | _ \| |  | : WWW........ppcrcd.pld-linux.org
\____\| -_)'___| ||^'||//\\// <   |  _/| |  | : JID......sparky<at>jabberes.org
(____/||   (_-_|_||  ||\\ ||   |_ |_|  |_| _| : Mail....sparky<at>pld-linux.org
#
%build_kernel_modules(p:P:m:)                                                   
\
%{!?-m:%{error:%{0}: Required module name/list missing}}                        
\
                                                                                
\
%define Opts                                                                    
\\\\\\\
%if "%{_target_base_arch}" != "%{_arch}"                                        
\\\
        %if "%{_arch}" == "x86_64" && "%{_target_base_arch}" == "i386"          
\\\
        CC="%{__cc}" CPP="%{__cpp}" ARCH=%{_target_base_arch}                   
\\\
        %else                                                                   
\\\
        ARCH=%{_target_base_arch} CROSS_COMPILE=%{_target_cpu}-pld-linux-       
\\\
        %endif                                                                  
\\\
%else                                                                           
\\\
        CC="%{__cc}" CPP="%{__cpp}"                                             
\\\
%endif                                                                          
\
%define MakeOpts HOSTCC="%{__cc}" SYSSRC=%{_kernelsrcdir} SYSOUT=$PWD/o         
\\\\\\\
                O=$PWD/o %{?with_verbose:V=1} %{Opts}                           
\
                                                                                
\
for cfg in %{?with_dist_kernel:%{?with_smp:smp} 
up}%{!?with_dist_kernel:nondist}; do \
        if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then                        
\
                exit 1                                                          
\
        fi                                                                      
\
        install -d o/include/linux                                              
\
        ln -sf %{_kernelsrcdir}/config-$cfg o/.config                           
\
        ln -sf %{_kernelsrcdir}/Module.symvers-$cfg o/Module.symvers            
\
        ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h 
o/include/linux/autoconf.h \
                                                                                
\
        [ ! -e pld-module.sh ] || %__spec_build_shell pld-module.sh             
\
                                                                                
\
        %if %{with dist_kernel}                                                 
\
                %{__make} -j1 -C %{_kernelsrcdir} prepare scripts               
\\\
                        %{-p*} %{-P*}                                           
\\\
                        %{MakeOpts}                                             
\
        %else                                                                   
\
                install -d o/include/config                                     
\
                touch o/include/config/MARKER                                   
\
                ln -sf %{_kernelsrcdir}/scripts o/scripts                       
\
        %endif                                                                  
\
                                                                                
\
        %{__make} -C %{_kernelsrcdir} clean                                     
\\\
                RCS_FIND_IGNORE="-name '*.ko' -o"                               
\\\
                M=$PWD %{MakeOpts}                                              
\
        %{__make} -C %{_kernelsrcdir} modules                                   
\\\
                %{*}                                                            
\\\
                M=$PWD %{MakeOpts}                                              
\
                                                                                
\
        for MODULE in {%{-m*},}; do                                             
\
                [ -z "${MODULE}" ] || mv ${MODULE}{,-$cfg}.ko                   
\
        done                                                                    
\
done                                                                            
\
%{nil}
# $Revision: 1.28 $, $Date: 2006/09/06 13:48:33 $
#
# Conditional build:
%bcond_without  dist_kernel     # allow non-distribution kernel
%bcond_without  smp             # don't build SMP module
%bcond_with     verbose         # verbose build (V=1)
#
%ifarch sparc
%undefine       with_smp
%endif
#
%define         modname ieee80211
%define         _rel    1
Summary:        Linux kernel module for the ieee80211 networking stack
Summary(de):    Linux Kernel Treiber für den ieee80211 Netz Stapel
Summary(pl):    Moduł jądra Linuksa do stosu sieciowego ieee80211
Name:           kernel%{_alt_kernel}-net-%{modname}
Version:        1.2.15
Release:        [EMAIL PROTECTED]
License:        GPL v2
Group:          Base/Kernel
Source0:        http://dl.sourceforge.net/ieee80211/%{modname}-%{version}.tgz
# Source0-md5:  499d5272fd1326ae65ebef80d9726e4d
URL:            http://ieee80211.sourceforge.net/
%{?with_dist_kernel:BuildRequires:      kernel%{_alt_kernel}-module-build >= 
3:2.6.14}
BuildRequires:  rpmbuild(macros) >= 1.308
BuildRequires:  sed >= 4.0
%{?with_dist_kernel:%requires_releq_kernel_up}
Requires(post,postun):  /sbin/depmod
Requires:       module-init-tools >= 3.2.2-2
BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)

%description
Linux kernel module for the ieee80211 networking stack.

%description -l de
Linux Kernel Modul für den ieee80211 Netz Stapel.

%description -l pl
Moduł jądra Linuksa do stosu sieciowego ieee80211.

%package -n kernel%{_alt_kernel}-smp-net-%{modname}
Summary:        Linux SMP kernel module for the ieee80211 networking stack
Summary(de):    Linux SMP Kernel Modul für den ieee80211 Netz Stapel
Summary(pl):    Moduł jądra Linuksa SMP do stosu sieciowego ieee80211
Release:        [EMAIL PROTECTED]
Group:          Base/Kernel
%{?with_dist_kernel:%requires_releq_kernel_smp}
Requires(post,postun):  /sbin/depmod
Requires:       module-init-tools >= 3.2.2-2

%description -n kernel%{_alt_kernel}-smp-net-%{modname}
Linux SMP kernel module for the ieee80211 networking stack.

%description -n kernel%{_alt_kernel}-smp-net-%{modname} -l de
Linux SMP Kernel Modul für den ieee80211 Netz Stapel.

%description -n kernel%{_alt_kernel}-smp-net-%{modname} -l pl
Moduł jądra Linuksa SMP do stosu sieciowego ieee80211.

%package -n %{modname}-devel
Summary:        Development header files for the ieee80211 networking stack
Summary(de):    Development Header Dateien für den ieee80211 Netz Stapel
Summary(pl):    Pliki nagłówkowe do stosu sieciowego ieee80211
Release:        [EMAIL PROTECTED]
%{?with_dist_kernel:%requires_releq kernel-module-build}
Group:          Development/Libraries

%description -n %{modname}-devel
Development header files for the ieee80211 networking stack.

%description -n %{modname}-devel -l de
Development Header Dateien für den ieee80211 Netz Stapel.

%description -n %{modname}-devel -l pl
Pliki nagłówkowe do stosu sieciowego ieee80211.

%prep
%setup -q -n %{modname}-%{version}
%{__sed} -i 's:<net/ieee80211.h>:"net/ieee80211.h":g' *.c

%build
%build_kernel_modules -m ieee80211,ieee80211_crypt{,_wep,_ccmp,_tkip}

%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}{,smp}/misc \
        $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d/%{_kernel_ver}{,smp} \
        $RPM_BUILD_ROOT%{_kernelsrcdir}/include/net

for MOD in ieee80211 ieee80211_crypt ieee80211_crypt_wep \
                ieee80211_crypt_ccmp ieee80211_crypt_tkip; do
        install $MOD-%{?with_dist_kernel:up}%{!?with_dist_kernel:nondist}.ko \
                
$RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/${MOD}_current.ko
        echo "alias $MOD ${MOD}_current" \
                >> 
$RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d/%{_kernel_ver}/ieee80211.conf
done

%if %{with smp} && %{with dist_kernel}
for MOD in ieee80211 ieee80211_crypt ieee80211_crypt_wep \
                ieee80211_crypt_ccmp ieee80211_crypt_tkip; do
        install $MOD-smp.ko \
                
$RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/${MOD}_current.ko
        echo "alias $MOD ${MOD}_current" \
                >> 
$RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d/%{_kernel_ver}smp/ieee80211.conf
done
%endif

install net/* \
        $RPM_BUILD_ROOT%{_kernelsrcdir}/include/net

%clean
rm -rf $RPM_BUILD_ROOT

%post   -n kernel%{_alt_kernel}-net-%{modname}
%depmod %{_kernel_ver}

%postun -n kernel%{_alt_kernel}-net-%{modname}
%depmod %{_kernel_ver}

%post   -n kernel%{_alt_kernel}-smp-net-%{modname}
%depmod %{_kernel_ver}smp

%postun -n kernel%{_alt_kernel}-smp-net-%{modname}
%depmod %{_kernel_ver}smp

%files -n kernel%{_alt_kernel}-net-%{modname}
%defattr(644,root,root,755)
/lib/modules/%{_kernel_ver}/misc/ieee80211*.ko*
%{_sysconfdir}/modprobe.d/%{_kernel_ver}/ieee80211.conf

%if %{with smp} && %{with dist_kernel}
%files -n kernel%{_alt_kernel}-smp-net-%{modname}
%defattr(644,root,root,755)
/lib/modules/%{_kernel_ver}smp/misc/ieee80211*.ko*
%{_sysconfdir}/modprobe.d/%{_kernel_ver}smp/ieee80211.conf
%endif

%files -n %{modname}-devel
%defattr(644,root,root,755)
# should go to a versioned directory
%{_kernelsrcdir}/include/net/*

%define date    %(echo `LC_ALL="C" date +"%a %b %d %Y"`)
%changelog
* %{date} PLD Team <[EMAIL PROTECTED]>
All persons listed below can be reached at <cvs_login>@pld-linux.org

$Log: kernel-net-ieee80211.spec,v $
Revision 1.28  2006/09/06 13:48:33  sparky
- mass atack: -j1 for make scripts

Revision 1.27  2006/08/31 21:53:38  glen
- remove excess escaping

Revision 1.26  2006/08/31 14:02:41  glen
- make -j1 for scripts

Revision 1.25  2006/08/21 10:02:25  shadzik
- 1.2.15

Revision 1.24  2006/06/27 21:55:06  lmasko
- alternative kernel support

Revision 1.23  2006/06/12 20:13:53  shadzik
- up to 1.1.14

Revision 1.22  2006/05/09 10:14:08  qboosh
- typo

Revision 1.21  2006/05/01 00:15:22  shadzik
- added german description
- some cleanups
- STBR

Revision 1.20  2006/04/16 21:49:21  lmasko
- up to 1.1.13

Revision 1.19  2006/04/12 12:15:40  glen
- add kernel epoch, adapterized

Revision 1.18  2006/03/12 14:21:10  glen
- module-init-tools with /etc/modprobe.d dir

Revision 1.17  2006/03/12 12:31:50  qboosh
- more updates

Revision 1.16  2006/03/12 11:02:56  blues
- adapt to new building system
  by Łukasz Maśko masko at ipipan dot waw dot pl

Revision 1.15  2006/03/11 12:44:32  blues
- do the aliases theRightWat(TM)

Revision 1.14  2006/03/11 12:11:48  blues
- modules are not in conflict with modules from kernel. release 2.

Revision 1.13  2006/03/06 23:17:20  djurban
- update to 1.1.12

Revision 1.12  2006/02/08 23:02:58  zawadaa
- up to 1.1.11

Revision 1.11  2006/01/22 20:19:13  blues
- 1.0.9 - builds, seems to be working (no chance to test it :(

Revision 1.10  2006/01/15 23:34:35  blues
- don't overwrite kernel module - put it into misc (rel.2)

Revision 1.9  2006/01/12 20:26:23  arekm
- sparc/ppc fixes

Revision 1.8  2006/01/09 23:52:38  zawadaa
- up to 1.1.8

Revision 1.7  2006/01/07 19:36:31  zawadaa
- up to 1.1.7

Revision 1.6  2005/10/25 15:43:46  zawadaa
- up to 1.1.6, test...

Revision 1.5  2005/09/16 13:06:35  jpc
- make -devel depend on kernel-module-build version

Revision 1.4  2005/09/15 18:25:05  sparky
- prepared for kernel >= 2.6.13: link Module.symvers

Revision 1.3  2005/08/29 23:34:26  jpc
- sort R:
- move the ieee80211 includes to %%{_kernelsrcdir}

Revision 1.2  2005/07/21 18:51:33  qboosh
- pl, typos

Revision 1.1  2005/07/20 15:23:16  jpc
- new spec based on ipw2200.spec
_______________________________________________
pld-devel-en mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en

Reply via email to