File dvb.spec of Package dvb

# spec file for package dvb
# 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

%if !%{defined snapver}
%define snapver  20120913

Name:           dvb
BuildRequires:  fdupes
BuildRequires:  libusb-devel
%if 0%{?suse_version} >= 1210
BuildRequires:  libv4l-devel >= 0.8.4
BuildRequires:  xz
PreReq:         %fillup_prereq %insserv_prereq
Version:        1.1.1%{?snapver:_%snapver}
Release:        0
Summary:        Tools for Digital (DVB) TV Cards
License:        GPL-2.0+ and LGPL-2.1+
Group:          Hardware/TV
Source:         dvb-apps-%{version}.tar.xz
Source2:        rcdvb
Source3:        sysconfig.dvb
Patch:          dvb-apps-dvbnet.diff
Patch1:         dvb-includes.diff
Patch2:         dvb-femon-01-status-is-common.patch
Patch3:         dvb-femon-02-SNR-in-dB.patch
Patch4:         dvb-femon-03-handle-EOPNOTSUPP.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       dtv-scan-tables

DVB tools and transponder files useful for DVB TV Cards

%package -n dvb-devel
Summary:        Development files for DVB-related libraries
License:        LGPL-2.1+
Group:          Development/Libraries/C and C++
Requires:       dvb = %{version}
Requires:       glibc-devel

%description -n dvb-devel
Files needed for the development of DVB TV applications and tools.
Header files are included for the following libraries: libdvbapi,
libdvbcfg, libdvben50221, libdvbsec, libesg and libucsi.

%setup -q -n dvb-apps-%{version}
%patch2 -p1
%patch3 -p1
%patch4 -p1
find -name .hg -type d | xargs rm -rfv
find -name .cvsignore -type f | xargs rm -fv
find -name '*.orig' -type f | xargs rm -fv

rm -rf include/linux
make %{?_smp_mflags} CFLAGS="%{optflags} -fno-strict-aliasing -fPIC" \
	CC=gcc \
	bindir=%{_bindir} \
	libdir=%{_libdir} \
	V=1 \

export DESTDIR=%{buildroot}
## directories
install -d -m 755 $DESTDIR/usr/{,s}bin $DESTDIR/etc/init.d $DESTDIR/usr/include \
## docu
install -d -m 755 $DESTDIR%{_docdir}/dvb
install -m 644 README COPYING* $DESTDIR%{_docdir}/dvb
make \
	bindir=%{_bindir} \
	libdir=%{_libdir} \
	prefix=%{_prefix} \
	includedir=%{_includedir} \
	DESTDIR=%{buildroot} \
install -d -m 755 $DESTDIR/%{_docdir}/%{name}/szap
install -m 644 util/szap/README $DESTDIR/%{_docdir}/%{name}/szap
install -m 644 util/ttusb_dec_reset/README $DESTDIR/%{_docdir}/%{name}/README.ttusb_dec_reset
install -m 644 util/av7110_loadkeys/README $DESTDIR/%{_docdir}/%{name}/README.av7110_loadkeys
# dvbnet
install -m 644 util/dvbnet/net_start.* $DESTDIR/%{_docdir}/%{name}/
## sysconfig & init
install -m 644 %{SOURCE3} $DESTDIR/var/adm/fillup-templates
ln -sf /etc/init.d/dvb $DESTDIR/usr/sbin/rcdvb
install -m 755 %{SOURCE2} $DESTDIR/etc/init.d/dvb
# noone really uses this so far AFAIK
rm -r %{buildroot}%{_libdir}/*.a
# dvbscan is incomplete and defunct
rm %{buildroot}%{_bindir}/dvbscan
# scan is too generic a name, rename to dvbscan/atscscan to avoid conflicts
mv %{buildroot}%{_bindir}/scan %{buildroot}%{_bindir}/dvbscan
ln %{buildroot}%{_bindir}/dvbscan %{buildroot}%{_bindir}/atscscan
# dvb scan data are provided by dtv-scan-tables
rm -r %{buildroot}%{_datadir}/dvb/{atsc,dvb-c,dvb-s,dvb-t}

%stop_on_removal dvb

%{fillup_and_insserv dvb}

%restart_on_update dvb

%defattr(-, root, root)
%doc %{_docdir}/dvb
%config /etc/init.d/dvb

%files -n dvb-devel
%defattr(-, root, root)

openSUSE Build Service is sponsored by