File satdump.spec of Package satdump

#
# spec file for package satdump
#
# Copyright (c) 2021-2024, Martin Hauke <mardnh@gmx.de>
#
# 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 https://bugs.opensuse.org/
#

%if 0%{?sle_version} >= 1506000
%define gcc_ver 13
%else
%define gcc_ver 12
%endif

Name:           satdump
Version:        1.2.2
Release:        0
Summary:        A generic satellite data processing software
License:        GPL-3.0-or-later
Group:          Productivity/Hamradio/Other
URL:            https://www.satdump.org/
#Git-Clone:     https://github.com/altillimity/SatDump.git
Source:         https://github.com/altillimity/SatDump/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        %{name}-rpmlintrc
BuildRequires:  ImageMagick
BuildRequires:  Mesa-libGL-devel
BuildRequires:  cmake
BuildRequires:  fdupes
%if 0%{?suse_version} >= 1600
BuildRequires:  gcc-c++
%else
BuildRequires:  gcc%{gcc_ver}-c++
%endif
BuildRequires:  libcorrect-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libad9361-iio-devel
BuildRequires:  libiio-devel
BuildRequires:  libmirisdr-devel
BuildRequires:  libusb-1_0-devel
BuildRequires:  nng-devel
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(luajit)
BuildRequires:  pkgconfig(jemalloc)
BuildRequires:  pkgconfig(LimeSuite)
BuildRequires:  pkgconfig(fftw3f)
BuildRequires:  pkgconfig(glew)
BuildRequires:  pkgconfig(glfw3)
BuildRequires:  pkgconfig(libairspy)
BuildRequires:  pkgconfig(libairspyhf)
BuildRequires:  pkgconfig(libbladeRF)
BuildRequires:  pkgconfig(libhackrf)
BuildRequires:  pkgconfig(OpenCL)
%if 0%{?suse_version} >= 1550
### HACK: libiio dependency broken on 15.3/15.4
BuildRequires:  pkgconfig(libiio)
%endif
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(libcurl)
BuildRequires:  pkgconfig(libtiff-4)
BuildRequires:  pkgconfig(librtlsdr)
BuildRequires:  pkgconfig(libzstd)
BuildRequires:  pkgconfig(opengl)
BuildRequires:  pkgconfig(uhd)
BuildRequires:  pkgconfig(volk)
BuildRequires:  pkgconfig(zlib)
%if 0%{?sle_version} >= 150200 && 0%{?sle_version} < 160000 && 0%{?is_opensuse}
### HACK: additional dependency 15.3/15.4
BuildRequires:  pkgconfig(glu)
%endif
BuildRequires:  portaudio-devel
BuildRequires:  hicolor-icon-theme
BuildRequires:  update-desktop-files
Requires:       hicolor-icon-theme

%description
A generic satellite data processing software.

%prep
%setup -q -n SatDump-%{version}
%autopatch -p1

%build
#%%if 0%{?sle_version} >= 150200 && 0%{?sle_version} < 160000 && 0%{?is_opensuse}
#%export CC="gcc-9"
#%export CXX="g++-9"
#%%endif
%if 0%{?suse_version} >= 1600
%cmake
%else
%cmake -DCMAKE_CXX_COMPILER=/usr/bin/g++-%{gcc_ver}
%endif
%cmake_build

%install
%cmake_install
%fdupes %{buildroot}/%{_datadir}/satdump/resources

#Extract and install icons
convert windows/icon.ico %{name}.png
install -Dpm 0644 %{name}-0.png %{buildroot}%{_datadir}/icons/hicolor/128x128/apps/%{name}.png
install -Dpm 0644 %{name}-1.png %{buildroot}%{_datadir}/icons/hicolor/96x96/apps/%{name}.png
install -Dpm 0644 %{name}-2.png %{buildroot}%{_datadir}/icons/hicolor/64x64/apps/%{name}.png
install -Dpm 0644 %{name}-3.png %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/%{name}.png
install -Dpm 0644 %{name}-4.png %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/%{name}.png
install -Dpm 0644 %{name}-5.png %{buildroot}%{_datadir}/icons/hicolor/16x16/apps/%{name}.png
install -Dpm 0644 %{name}-6.png %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/%{name}.png

#Create legitimate desktop file
%suse_update_desktop_file -c satdump SatDump SatDump satdump-ui satdump Science Hamradio

%check

%files
%license LICENSE
%doc README.md
%{_bindir}/satdump
%{_bindir}/satdump_sdr_server
%{_bindir}/satdump-ui
%{_libdir}/libsatdump_core.so
%{_libdir}/libsatdump_interface.so
%dir %{_libdir}/satdump
%{_libdir}/satdump/plugins
%{_datadir}/satdump/
%{_datadir}/applications/satdump.desktop
%{_datadir}/icons/hicolor/*x*/apps/%{name}.png
%exclude %{_includedir}/satdump

%changelog
openSUSE Build Service is sponsored by