File qt-drmplus.spec of Package qt-drmplus

#
# spec file for package qt-drmplus
#
#norootforbuild

Name:           qt-drmplus
Version:        1.0.1.20181207
%define soversion 0
Release:        1
Summary:        DRM+ decoding library and Qt-Frontend
License:        GPL-2.0 and LGPL-2.1
Group:          Productivity/Hamradio/Other
URL:            https://github.com/Opendigitalradio/qt-drmplus
Source:         %{name}-%{version}.tar.gz
Patch0:         %{name}-faad-library-name.patch
Patch1:         %{name}-link-libdrmplus-dynamic.patch
BuildRoot:      %{_tmppath}/build-%{name}-%{version}
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  gcc-c++
BuildRequires:  libtool
BuildRequires:  pkgconfig(portaudio-2.0)
BuildRequires:  pkgconfig(fftw3)
BuildRequires:  pkgconfig(librtlsdr)
BuildRequires:  pkgconfig(samplerate)
BuildRequires:  pkgconfig(sndfile)
BuildRequires:  libfaad-devel
BuildRequires:  pkgconfig(Qt5Charts)
BuildRequires:  update-desktop-files
BuildRequires:  hicolor-icon-theme

%description
Software package for receiving DRM+ software radio. It contains
a decoding library and Qt and command line frontends.


%package -n libdrmplus%{soversion}
Summary:        Library to decode DRM+ digital radio
Group:          Development/Libraries/Other

%description -n libdrmplus%{soversion}
The library to decode DRM+ digital radio, used by qt-drmplus DRM+ digital
radio decoding software.


%package -n libdrmplus-devel
Summary:        Development files for libdrmplus library
Group:          Development/Libraries/Other
Requires:       libdrmplus = %{version}-%{release}

%description -n libdrmplus-devel
Development files for libdrmplus library, used by qt-drmplus, the
DRM+ digital radio decoding program.


%prep
%setup -q -n %{name}
%patch0 -p 1 -b .faad
%patch1 -p 1 -b .dynamic


%build
%if 0%{?suse_version} > 1500
# workaround for GCC10 build failure
export CFLAGS="%(echo %{optflags}) -fcommon"
export CXXFLAGS="%(echo %{optflags}) -fcommon"
%endif
./autogen.sh
./configure --prefix=/usr --disable-static
make %{?_smp_mflags}

#build GUI
cd qt-frontend
qmake-qt5 qt-drmplus.pro
make %{?_smp_mflags}

%install
make install DESTDIR=%{buildroot}

#install GUI
cd qt-frontend
install -m 755 %{name} %{buildroot}%{_bindir}

#move libs on 64-bit arch
%ifarch x86_64
mv %{buildroot}/usr/lib %{buildroot}%{_libdir}
%endif

rm %{buildroot}%{_libdir}/*.la

#install desktop file
%suse_update_desktop_file -c qt-drmplus Qt-DRMplus 'DRM+ software receiver' qt-drmplus qt-drmplus 'Network;HamRadio'

#install icon
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable/apps
cp icons/MainIcon.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg


%clean
rm -rf %{buildroot}


%post -n libdrmplus%{soversion} -p /sbin/ldconfig
%postun  -n libdrmplus%{soversion} -p /sbin/ldconfig


%files
%defattr(-,root,root)
%doc AUTHORS COPYING NEWS README.md
%{_bindir}/%{name}
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%{_datadir}/applications/%{name}.desktop
%{_bindir}/drmplusdemod
%{_bindir}/drmplusgraph
%{_mandir}/man1/drmplusdemod.1.gz

%files -n libdrmplus%{soversion}
%defattr(-,root,root)
%{_libdir}/libdrmplus.so.*

%files -n libdrmplus-devel
%defattr(-,root,root)
%{_includedir}/*.h
%{_libdir}/libdrmplus.so
%{_libdir}/pkgconfig/drmplus.pc

%changelog