rendered paste body###################################################################
#
# dahdi-linux-kmod.spec - used to generate dahdi-linux-kmod rpms
# For more info: http://www.rpm.org/max-rpm/ch-rpm-basics.html
#
# This spec file uses default directories:
# /usr/src/redhat/SOURCES - orig source, patches, icons, etc.
# /usr/src/redhat/SPECS - spec files
# /usr/src/redhat/BUILD - sources unpacked & built here
# /usr/src/redhat/RPMS - binary package files
# /usr/src/redhat/SRPMS - source package files
#
###################################################################
#
# Global Definitions
#
###################################################################
%define aversion 2.5.0.2
%define arelease 1_centos5
%define actversion %(echo %{aversion}|sed -e "s/-.*$//g")
%define subvers %(echo %{aversion}|awk "/-/"|sed -e "s/^.*-//"|awk '{print "0." $1 "."}')
%define actrelease %(echo %{subvers}%{arelease}|sed -e "s/-/_/g")
%define distname centos
%define distver 5
Source10: kmodtool
%define kmodtool bash %{SOURCE10}
%{!?kversion: %define kversion 2.6.18-274.17.1.el5}
%define kmod_name dahdi-linux
%define kverrel %(%{kmodtool} verrel %{?kversion} 2>/dev/null)
%if "%{distname}" == "sles"
%define upvar -default
%else
%define upvar ""
%endif
%if "%{distname}" == "sles"
%define smpvar -smp -bigsmp
%else
%endif
%if "%{distname}" == "sles"
%ifarch i586 i686
%define xenvar -xen -xenpae
%endif
%ifarch x86_64 ia64
%define xenvar -xen
%endif
%else
%ifarch i686 x86_64 ia64
%define xenvar xen
%endif
%ifarch i686
%define paevar PAE
%endif
%endif
%{!?kvariants: %define kvariants %{?upvar} %{?smpvar} %{?xenvar} %{?paevar}}
#Workaround for 64 bit CPUs
%define _lib lib
###################################################################
#
# The Preamble
# information that is displayed when users request info
#
###################################################################
Summary: The DAHDI project
Name: %{kmod_name}-kmod
Version: %{actversion}
Release: %{actrelease}.%(echo %{kverrel} | tr - _)
License: GPL
Group: Utilities/System
Source: %{name}-sources-%{aversion}.tar.gz
Patch0: dahdi-no-fwload.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-root
URL: http://www.asterisk.org/
Vendor: Digium, Inc.
Packager: Jason Parker <jparker@digium.com>
#
# Other tags not used
#
#Distribution:
#Icon:
#Conflicts:
#Serial:
#Requires:
#AutoReqProv:
#ExcludeArch:
%description
The open source DAHDI project
# magic hidden here:
%{expand:%(%{kmodtool} rpmtemplate %{kmod_name} %{kverrel} %{kvariants} 2>/dev/null)}
###################################################################
#
# The Prep Section
# If stuff needs to be done before building, this is the section
# Use shell scripts to do stuff like uncompress and cd into source dir
# %setup macro - cleans old build trees, uncompress and extracts original source
#
###################################################################
%prep
%setup -c -n %{name}-%{aversion}
cd %{name}-%{aversion}/
%patch0 -p0
echo %{aversion} > .version
cd ../
for kvariant in %{kvariants} ; do
cp -a %{name}-%{aversion} _kmod_build_$kvariant
done
cd %{name}-%{aversion}
###################################################################
#
# The Build Section
# Use shell scripts and do stuff that makes the build happen, i.e. make
#
###################################################################
%build
for kvariant in %{kvariants}
do
pushd _kmod_build_$kvariant
%if "%{distname}" == "sles"
make KVERS="%{kverrel}${kvariant}" CONFIG_DAHDI_DYNAMIC_ETH=n modules
%else
make KVERS="%{kverrel}${kvariant}" modules
%endif
popd
done
###################################################################
#
# The Install Section
# Use shell scripts and perform the install, like 'make install',
# but can also be shell commands, i.e. cp, mv, install, etc..
#
###################################################################
%install
for kvariant in %{kvariants}
do
pushd _kmod_build_$kvariant
%if "%{distname}" == "sles"
make DESTDIR=$RPM_BUILD_ROOT KVERS="%{kverrel}${kvariant}" CONFIG_DAHDI_DYNAMIC_ETH=n install-modules
%else
make DESTDIR=$RPM_BUILD_ROOT KVERS="%{kverrel}${kvariant}" install-modules
%endif
popd
done
###################################################################
#
# Install and Uninstall
# This section can have scripts that are run either before/after
# an install process, or before/after an uninstall process
# %pre - executes prior to the installation of a package
# %post - executes after the package is installed
# %preun - executes prior to the uninstallation of a package
# %postun - executes after the uninstallation of a package
#
###################################################################
###################################################################
#
# Verify
#
###################################################################
%verifyscript
###################################################################
#
# Clean
#
###################################################################
%clean
cd $RPM_BUILD_DIR
%{__rm} -rf %{name}-%{version}
%{__rm} -rf /var/log/%{name}-sources-%{version}-%{release}.make.err
%{__rm} -rf $RPM_BUILD_ROOT