libmirisdr/libmirisdr.spec

233 lines
5.6 KiB
RPMSpec
Raw Normal View History

#
# spec file for package libmirisdr
#
# Copyright (c) 2012-2014 Wojciech Kazubski, wk@ire.pw.edu.pl
#
# 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/
#
# norootforbuild
%if 0%{?suse_version} != 1315 && 0%{?suse_version} != 1110
%define build_docs 1
%else
%define build_docs 0
%endif
Name: libmirisdr
Version: 0.0.20130608
Release: 9.1
Summary: Support programs for MRi2500
License: GPL-2.0
%if 0%{?suse_version}
Group: Productivity/Hamradio/Other
%endif
%if 0%{?fedora}
Group: Applications/Engineering
%endif
Source: %{name}-%{version}.tar.gz
URL: http://cgit.osmocom.org/libmirisdr/
BuildRoot: %{_tmppath}/build-%{name}-%{version}
BuildRequires: cmake pkg-config udev
%if 0%{?suse_version}
BuildRequires: libusb-1_0-devel
%endif
%if 0%{?fedora}
BuildRequires: libusb1-devel
%endif
%if 0%{?suse_version} >= 1100
BuildRequires: fdupes
%endif
%if %{build_docs}
BuildRequires: doxygen texlive-latex graphviz
%if 0%{?fedora} > 17 || 0%{?suse_version} > 1220
BuildRequires: texlive texlive-sectsty texlive-tocloft texlive-xtab texlive-multirow
BuildRequires: texlive-helvetic texlive-times
BuildRequires: texlive-latex-bin-bin texlive-texconfig texlive-metafont-bin
BuildRequires: texlive-natbib texlive-float texlive-colortbl texlive-psnfss texlive-fancyhdr
BuildRequires: texlive-makeindex-bin texlive-dvips
BuildRequires: texlive-wasysym texlive-wasy
BuildRequires: texlive-adjustbox
BuildRequires: texlive-tabu texlive-caption
%endif
%endif
%description
Programs that controls Mirics MRi2500 based DVB dongle in raw mode, so
it can be used as a SDR receiver.
%if 0%{?suse_version}
%package -n libmirisdr0
Summary: SDR driver for MRi2500
Group: Hardware/Other
Provides: %{name} = %{version}-%{release}
%description -n libmirisdr0
Library to run Mirics MRi2500 based DVB dongle as a SDR receiver.
%package -n mirisdr
Summary: Support programs for MRi2500
Group: Productivity/Hamradio/Other
%description -n mirisdr
Programs that controls Mirics MRi2500 based DVB dongle in raw mode, so
it can be used as a SDR receiver.
%endif
%package devel
Summary: Development files for libmirisdr
Group: Development/Libraries/Other
Requires: %{name} = %{version}-%{release}
AutoReq: on
%description devel
Library headers and other development files for mirisdr driver.
%package devel-doc
Summary: Documentation for libmirisdr
Group: Development/Libraries/Other
Requires: %{name}-devel = %{version}-%{release}
AutoReq: on
%if 0%{?suse_version} >= 1200
BuildArch: noarch
%endif
%description devel-doc
Documentation for libmirisdr driver. HTML and PDF formats.
%prep
%setup -q -n %{name}
# remove buildtime from documentation
sed -i 's|^HTML_TIMESTAMP = YES|HTML_TIMESTAMP = NO|' Doxyfile.in
%build
mkdir build
cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
%ifarch x86_64
-DLIB_SUFFIX=64 \
%endif
make %{?_smp_mflags}
cd ..
#create documentation
%if %{build_docs}
cp Doxyfile.in Doxyfile
sed -i "s\@VERSION@\%{version}\1" Doxyfile
doxygen
cd doc/latex
make pdf
%endif
%install
rm -rf %{buildroot}
cd build
make DESTDIR=%{buildroot} install
rm %{buildroot}%{_libdir}/libmirisdr.a
%ifarch x86_64
mv %{buildroot}/usr/lib/pkgconfig %{buildroot}%{_libdir}
%endif
#install udev rules
%if 0%{?suse_version} >= 1310 || 0%{?fedora} >= 19
mkdir -p %{buildroot}%{_udevrulesdir}
cp ../mirisdr.rules %{buildroot}%{_udevrulesdir}/10-mirisdr.rules
%else
mkdir -p %{buildroot}%{_sysconfdir}/udev/rules.d
cp ../mirisdr.rules %{buildroot}%{_sysconfdir}/udev/rules.d/10-mirisdr.rules
%endif
cd ..
#install documentation
%if %{build_docs}
mkdir -p %{buildroot}%{_docdir}/%{name}/pdf
cp -r doc/html %{buildroot}%{_docdir}/%{name}
cp -r doc/latex/*.pdf %{buildroot}%{_docdir}/%{name}/pdf
%if 0%{?suse_version} >= 1100
%fdupes %{buildroot}%{_docdir}/%{name}
%endif
%endif
%clean
rm -rf %{buildroot}
%if 0%{?suse_version}
%post -n libmirisdr0
/sbin/ldconfig
%udev_rules_update
%postun -n libmirisdr0
/sbin/ldconfig
%udev_rules_update
%else
%post -n libmirisdr -p /sbin/ldconfig
%postun -n libmirisdr -p /sbin/ldconfig
%endif
%if 0%{?suse_version}
%files -n mirisdr
%defattr(-,root,root)
%doc AUTHORS COPYING README
%{_bindir}/miri_*
%if %{build_docs}
%exclude %{_docdir}/%{name}/html
%exclude %{_docdir}/%{name}/pdf
%endif
%files -n libmirisdr0
%defattr(-,root,root)
%else
%files
%defattr(-,root,root)
%doc AUTHORS COPYING README
%if %{build_docs}
%exclude %{_docdir}/%{name}/html
%exclude %{_docdir}/%{name}/pdf
%endif
%{_bindir}/miri_*
%endif
%{_libdir}/libmirisdr.so.*
%if 0%{?suse_version} >= 1310 || 0%{?fedora} >= 19
%{_udevrulesdir}/10-mirisdr.rules
%else
%config(noreplace) %{_sysconfdir}/udev/rules.d/10-mirisdr.rules
%endif
%files devel
%defattr(-,root,root)
%{_libdir}/libmirisdr.so
%{_includedir}/*.h
%{_libdir}/pkgconfig/libmirisdr.pc
%if %{build_docs}
%files devel-doc
%defattr(-,root,root)
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/html
%{_docdir}/%{name}/pdf
%endif
%changelog