File usb_modeswitch.spec of Package usb_modeswitch

#
# spec file for package usb_modeswitch
#
# Copyright (c) 2015 SUSE LINUX 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 source_name	usb-modeswitch
%define date		20150627
%define _udevdir %(pkg-config --variable=udevdir udev)
Name:           usb_modeswitch
Version:        2.2.5
Release:        0
Summary:        A mode switching tool for controlling multiple-device USB gear
License:        GPL-2.0+
Group:          Hardware/Mobile
Url:            http://www.draisberghof.de/usb_modeswitch
Source0:        http://www.draisberghof.de/usb_modeswitch/%{source_name}-%{version}.tar.bz2
Source1:        http://www.draisberghof.de/usb_modeswitch/%{source_name}-data-%{date}.tar.bz2
Source2:        http://www.draisberghof.de/usb_modeswitch/device_reference.txt
Patch1:         usb_modeswitch-fix_fsf_address.patch
BuildRequires:  fdupes
BuildRequires:  pkg-config
BuildRequires:  tcl
BuildRequires:  pkgconfig(libusb-1.0)
BuildRequires:  pkgconfig(udev)
Requires:       tcl >= 8.4
Requires:       usb_modeswitch-data = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
USB_ModeSwitch is a mode switching tool for controlling "flip flop"
(multiple device) USB gear. It allows so-called "Zero-CD" devices that
show up as USB storage initially to be switched into their more useful
"application mode". This is most common for UMTS/3G wireless WAN
devices.

%package data
Summary:        Data Files for USB Modeswitch
Group:          Hardware/Mobile
Requires:       %{name} = %{version}
BuildArch:      noarch

%description data
Data files for usb_modeswitch package.

%prep
%setup -q -a1 -n %{source_name}-%{version}
%patch1

cp %{SOURCE2} .

%build
CFLAGS="%{optflags}" make

%install
make DESTDIR=%{buildroot} install %{?_smp_mflags} UDEVDIR=%{buildroot}%{_udevdir}
cd %{source_name}-data-%{date}
make DESTDIR=%{buildroot} install %{?_smp_mflags} RULESDIR=%{buildroot}%{_udevdir}/rules.d

### TO REMOVE ONCE IN UPSTREAM DATA PACKAGE, FIX BNC 899013 ###

cat > %{buildroot}/%{_datadir}/usb_modeswitch/12d1:1583 <<EOF
# Vodafone W5101

TargetVendor=0x12d1
TargetProduct=0x1589

MessageContent="55534243123456780000000000000011062000000101000100000000000000"
EOF

cat > %{buildroot}/%{_datadir}/usb_modeswitch/12d1:1582 <<EOF
# Vodafone R215

TargetVendor=0x12d1
TargetProduct=0x1588

MessageContent="55534243123456780000000000000011062000000101000100000000000000"
EOF

### END SECTION TO REMOVE ###

%fdupes -s %{buildroot}

%files
%defattr(-,root,root,-)
%doc README COPYING device_reference.txt
%{_sbindir}/usb_modeswitch
%{_sbindir}/usb_modeswitch_dispatcher
%{_udevdir}/usb_modeswitch
%{_localstatedir}/lib/usb_modeswitch
%config %{_sysconfdir}/usb_modeswitch.conf
%{_mandir}/man1/usb_modeswitch.1.gz
%{_mandir}/man1/usb_modeswitch_dispatcher.1.gz

%files data
%defattr(-,root,root,-)
%{_datadir}/usb_modeswitch/
%{_udevdir}/rules.d/40-usb_modeswitch.rules

%changelog
openSUSE Build Service is sponsored by