File mdc-modem.spec of Package mdc-modem

#
# spec file for mdc-modem
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

%define kernel_version 3.0.13

Name:           mdc-modem
BuildRequires:  udev module-init-tools
%ifarch %ix86
BuildRequires:  kernel-pae-devel
%endif
%ifarch x86_64
BuildRequires:  kernel-default-devel
%endif
Summary:        LSI Modem Driver for Linux
Version:        1024
Release:        18.1
Source:         %{name}-%{version}-%{kernel_version}.tar.bz2
Source1:        mdc-modem.init
Source2:        Module.supported
Source3:	modem
Source4:        %{name}-%{version}-%{kernel_version}-32bit.tar.bz2
# PATCH-FIX-UPSTREAM config_snd_hda_power_save.patch svalx@svalx.net -- fix i586 build for SLE 11 SP3
Patch:          config_snd_hda_power_save.patch
Vendor:         LSI Corporation
License:        Propreitary
Group:          System/Kernel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  x86_64 %ix86 
#BuildArch:      x86_64 
Obsoletes:      sled-mdc-modem
Provides:       sled-mdc-modem
#Requires: 	mdc-modem-kmp-default >= 1024_3.0.7_0.7-6.6
%suse_kernel_module_package

%description
This package contains the init script and daemon program for the LSI Modem.

%package KMP
Summary:        LSI Modem Kernel Module
Group:          System/Kernel

%description KMP
This package contains the Linux driver for the LSI Modem.

%prep
%ifarch x86_64
%setup -q -n %{name}-%{version}-%{kernel_version}
%else
%setup -q -T -b 4 -n %{name}-%{version}-%{kernel_version}
%patch -p2
%endif
cp %_sourcedir/Module.supported Module.supported
chmod -x README LICENSE
set -- *
mkdir source
mv "$@" source/
mkdir obj
mv source/{README,LICENSE,AgereMdmDaemon,agrdep.ko,agrmodem.ko,agrserial.ko,mdc-modem.init,mdc-modem.spec,modem} .

%build
export EXTRA_CFLAGS='-DVERSION=\"%version\"'
for flavor in %flavors_to_build; do
    rm -rf obj/$flavor
    cp -r source obj/$flavor
    make -C /usr/src/linux-obj/%_target_cpu/$flavor modules \
        M=$PWD/obj/$flavor
done

%install
mkdir -p $RPM_BUILD_ROOT/usr/lib/AgereSoftModem
install -c -m 0755 AgereMdmDaemon $RPM_BUILD_ROOT/usr/lib/AgereSoftModem/

mkdir -p $RPM_BUILD_ROOT/etc/modprobe.d/
install -c -m 0755 modem $RPM_BUILD_ROOT/etc/modprobe.d/

mkdir -p $RPM_BUILD_ROOT/etc/init.d
install -c -m 0755 %{SOURCE1} $RPM_BUILD_ROOT/etc/init.d/mdc-modem

mkdir -p %{buildroot}%{_sbindir}
ln -s /etc/init.d/mdc-modem %{buildroot}%{_sbindir}/rcmdc-modem

mkdir -p $RPM_BUILD_ROOT/lib/udev/devices
ln -s ttyAGS3 $RPM_BUILD_ROOT/lib/udev/devices/modem

export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR=updates

for flavor in %flavors_to_build; do
    make -C /usr/src/linux-obj/%_target_cpu/$flavor modules_install \
         M=$PWD/obj/$flavor
done

%post
# remove the old init script
rm -f /etc/init.d/agr_softmodem
%{fillup_and_insserv -f -Y mdc-modem}

%postun
%restart_on_update mdc-modem
%insserv_cleanup

%files
%defattr(-, root, root)
%doc README LICENSE
/etc/modprobe.d/modem
/etc/init.d/mdc-modem
%{_sbindir}/rcmdc-modem
/usr/lib/AgereSoftModem
%attr(660, root, uucp) %dev(c, 62, 67) /lib/udev/devices/ttyAGS3
/lib/udev/devices/modem

%changelog
* Thu Jul 25 2013 svalx@svalx.net
- Add patch config_snd_hda_power_save.patch -- fix i586 build for SLE 11 SP3.
- Add header to spec file.
- Change preun and postun sections for correctly remove and update.
- Add rcmdc-modem symlink.
* Tue Apr 17 2012 mmarek@suse.cz
- Fix license tag of agrmodem.ko (bnc#746958).
* Thu Mar  8 2012 mmarek@suse.cz
- Update the 32bit rpm as well.
* Thu Mar  8 2012 mmarek@suse.cz
- New 64bit driver, fixes oops without modem (bnc#747570).
* Wed Mar  7 2012 mmarek@suse.cz
- Fix build.
* Wed Mar  7 2012 mmarek@suse.cz
- Enable 32bit build
* Wed Mar  7 2012 mmarek@suse.cz
- Rebuild the mdc-modem driver in the buildservice
openSUSE Build Service is sponsored by