Edit Info Other
Login

Kmods2

Attachment 'kmod-template.spec'

Download

   1 # stuff to be implemented externally:
   2 Source10: kmodtool
   3 %define   kmodtool sh %{SOURCE10}
   4 # end stuff to be ...
   5 
   6 # hardcode for now:
   7 %{!?kversion: %define kversion 2.6.16-1.2111_FC5}
   8 # hint: this can he overridden with "--define kversion foo" on the rpmbuild command line, e.g.
   9 # --define "kversion 2.6.16-1.2096_FC5"
  10 
  11 %define kmod_name foo
  12 %define kverrel %(%{kmodtool} verrel %{?kversion} 2>/dev/null)
  13 
  14 %define upvar ""
  15 %ifarch i586 i686 ppc
  16 %define smpvar smp
  17 %endif
  18 %ifarch i686 x86_64
  19 %define xenvar xen0 xenU
  20 %define kdumpvar kdump
  21 %endif
  22 %{!?kvariants: %define kvariants %{?upvar} %{?smpvar} %{?xenvar} %{?kdumpvar}}
  23 # hint: this can he overridden with "--define kvariant foo bar" on the rpmbuild command line, e.g.
  24 # --define 'kvariant "" smp' 
  25 
  26 Name:           %{kmod_name}-kmod
  27 Version:        1.5
  28 Release:        3.%(echo %{kverrel} | tr - _)
  29 Summary:        %{kmod_name} kernel modules
  30 
  31 Group:          System Environment/Kernel
  32 License:        GPL
  33 URL:            http://foo.sf.net
  34 Source0:        http://download.sf.net/%{kmod_name}/%{kmod_name}-%{version}.tar.bz2
  35 Patch0:         %{kmod_name}-foo.patch
  36 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
  37 
  38 ExclusiveArch:  i586 i686 x86_64 ppc
  39 
  40 %description
  41 foo bar foobar 
  42 
  43 # magic hidden here:
  44 %{expand:%(%{kmodtool} rpmtemplate %{kmod_name} %{kverrel} %{kvariants} 2>/dev/null)}
  45 
  46 
  47 %prep
  48 # to understand the magic better or to debug it, uncomment this:
  49 #{kmodtool} rpmtemplate %{kmod_name} %{kverrel} %{kvariants} 2>/dev/null
  50 #sleep 5
  51 %setup -q -c -T -a 0
  52 pushd %{kmod_name}-%{version}*
  53 %patch0 -b .patch0
  54 popd
  55 for kvariant in %{kvariants} ; do
  56     cp -a %{kmod_name}-%{version} _kmod_build_${kvariant}
  57 done
  58 
  59 
  60 %build
  61 for kvariant in %{kvariants}
  62 do
  63     ksrc=%{_usrsrc}/kernels/%{kverrel}${kvariant:+-$kvariant}-%{_target_cpu}
  64     cd _kmod_build_$kvariant
  65     make -C "${ksrc}" SUBDIRS=${PWD} modules %{?_smp_mflags}
  66     cd ..
  67 done
  68 
  69 
  70 %install
  71 rm -rf $RPM_BUILD_ROOT
  72 for kvariant in %{kvariants}
  73 do
  74     make install \
  75          DESTDIR=$RPM_BUILD_ROOT
  76          INST_DIR=$RPM_BUILD_ROOT/lib/modules/%{kverrel}${kvariant}/extra/%{kmod_name}
  77 done
  78 # Temporarily executable for stripping, fixed later in %%files.
  79 chmod u+x $RPM_BUILD_ROOT/lib/modules/*/extra/%{kmod_name}/*
  80 
  81 
  82 %clean
  83 rm -rf $RPM_BUILD_ROOT
  84 
  85 
  86 %changelog

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2007-11-24 12:26:53, 2.3 KB) [[attachment:kmod-template.spec]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.