File gnss-sdr.spec of Package gnss-sdr

#
# spec file
#
# Copyright (c) 2022 SUSE LLC
#
# 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/
#


%global flavor @BUILD_FLAVOR@%{nil}
%global sname gnss-sdr
%if "%{flavor}" == ""
%else
%global psuffix -%{flavor}
%global libname libvolk_gnsssdr0_0_17
%endif

Name:           gnss-sdr%{?psuffix}
Version:        0.0.17
Release:        0
%if "%{flavor}" == "volk"
Summary:        VOLK module for gnss-sdr
%else
Summary:        Software-defined receiver for GNSS signals
%endif
License:        GPL-3.0-only
Group:          Productivity/Hamradio/Other
URL:            https://gnss-sdr.org/
Source:         https://github.com/gnss-sdr/gnss-sdr/archive/v%{version}.tar.gz#/%{sname}-%{version}.tar.gz
BuildRequires:  cmake
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  gnuradio-devel
BuildRequires:  orc
%if "%{flavor}" == "volk"
BuildRequires:  python3-Mako
BuildRequires:  python3-six
%else
BuildRequires:  armadillo-devel
BuildRequires:  blas-devel
BuildRequires:  gcc-fortran
BuildRequires:  gflags-devel
BuildRequires:  glog-devel
BuildRequires:  gnss-sdr-volk-devel
BuildRequires:  gr-osmosdr-devel
BuildRequires:  gtest
BuildRequires:  lapack-devel
BuildRequires:  libboost_atomic-devel
BuildRequires:  libboost_chrono-devel
BuildRequires:  libboost_date_time-devel
BuildRequires:  libboost_filesystem-devel
BuildRequires:  libboost_serialization-devel
BuildRequires:  libboost_system-devel
BuildRequires:  libboost_thread-devel
BuildRequires:  libmatio-devel
BuildRequires:  libopenssl-devel
BuildRequires:  log4cpp-devel
BuildRequires:  protobuf-devel
BuildRequires:  pugixml-devel
BuildRequires:  zlib-devel
%endif

%if "%{flavor}" == ""
%description
An SDR receiver able to detect and decode signals according to
various standards:

- GPS (L1, L2C, L5 bands)
- GLONASS (L1, L2 bands)
- BeiDou (B1I, B3I bands)
- Galileo (E1b/c, E5a bands)

It can process signal in realtime or prerecorded signals and
output process signals in various formats.

%else

%description
Set of kernels targeted at gnss-sdr, but also usable
standalone.

%package devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{libname}

%description devel
Development files for %{name}.

%package -n %{libname}
Summary:        Optimized kernels for gnss-sdr
Group:          System/Libraries

%description -n %{libname}
Set of optimized kernels targeted at gnss-sdr, but also usable
standalone.

%endif

%prep
%if "%{flavor}" == "volk"
%setup -q -n %{sname}-%{version}/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/
%else
%setup -q -n %{sname}-%{version}
%endif

%build
# gnss-sdr uses libraries only as build artifacts, build as static
%cmake \
  -DPYTHON_EXECUTABLE=%{_bindir}/python3 \
  -DENABLE_GENERIC_ARCH:BOOL=ON \
%if "%{flavor}" == ""
  -DBUILD_SHARED_LIBS:BOOL=OFF \
  -DBUILD_STATIC_LIBS:BOOL=ON \
  -DENABLE_PACKAGING:BOOL=ON \
  -DENABLE_OSMOSDR:BOOL=ON
%else
  -DVOLK_PYTHON_DIR:PATH=%{python3_sitelib} \
  -DVOLK_CPU_FEATURES:BOOL=OFF
%endif

%cmake_build

%install
%cmake_install
%if "%{flavor}" == ""
# Remove changelog installed at the wrong location
rm %{buildroot}%{_prefix}/share/doc/gnss-sdr/changelog.gz
%endif
%fdupes %{buildroot}

%if "%{flavor}" == "volk"
%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%endif

%if "%{flavor}" == "volk"
%files
%license COPYING
%doc README.md
%{_bindir}/volk_gnsssdr_profile

%files -n %{libname}
%{_libdir}/libvolk_gnsssdr.so.*

%files devel
%{_bindir}/volk_gnsssdr_modtool
%{_bindir}/volk_gnsssdr-config-info
%{_includedir}/volk_gnsssdr
%{_libdir}/cmake/volk_gnsssdr
%{_libdir}/pkgconfig/volk_gnsssdr.pc
%{_libdir}/libvolk_gnsssdr.so
%{python3_sitelib}/volk_gnsssdr_modtool

%else

%files
%license COPYING
%doc README.md build/changelog.gz
%{_bindir}/gnss-sdr
%{_bindir}/front-end-cal
%{_datadir}/gnss-sdr
%{_mandir}/man*/*
%endif

%changelog
openSUSE Build Service is sponsored by