File gnss-sdr.spec of Package gnss-sdr

#
# spec file for package gnss-sdr
#
# Copyright (c) 2019-2025 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/
#

%define gtest_version 1.16.0
%define limesdr 1
%define gnmax 1
%define osmosdr 1
%define plutosdr 1

Name:           gnss-sdr
Version:        0.0.20
Release:        10.1
Summary:        Open-source GNSS software receiver
License:        GPL-3.0
Group:          Productivity/Hamradio/Other
URL:            http://gnss-sdr.org/
Source0:        https://github.com/gnss-sdr/gnss-sdr/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        https://github.com/google/googletest/archive/refs/tags/v%{gtest_version}.tar.gz#/googletest-%{gtest_version}.tar.gz
Source2:        GNSS-SDR_manual.pdf
Patch1:         gnss-sdr-add-missing-header.patch
Patch2:         gnss-sdr-fix-suffixes-usage.patch
Patch3:         gnss-sdr-fix-gnsstk-detection.patch
Patch4:         gnss-sdr-remove-boost_system.patch
Patch5:         gnss-sdr-0.0.20-add-gnmax-support.patch
BuildRequires:  cmake
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  gcc-fortran
BuildRequires:  git
BuildRequires:  dblatex
BuildRequires:  dos2unix
BuildRequires:  doxygen
BuildRequires:  gnuplot
Buildrequires:  libtool
BuildRequires:  orc
BuildRequires:  unzip
BuildRequires:  armadillo-devel
%if 0%{?suse_version} >= 1330
BuildRequires:  libboost_atomic-devel
BuildRequires:  libboost_chrono-devel
BuildRequires:  libboost_date_time-devel
BuildRequires:  libboost_filesystem-devel
BuildRequires:  libboost_serialization-devel
%else
BuildRequires:  boost-devel
%endif
%if 0%{?sle_version} >= 150600 || 0%{?suse_version} >= 1600
BuildRequires:  abseil-cpp-devel
%else
BuildRequires:  gflags-devel >= 2.0
BuildRequires:  glog-devel
%endif
BuildRequires:  gnsstk-devel
BuildRequires:  gnuradio-devel
BuildRequires:  gperftools-devel 
Buildrequires:  hdf5-devel
BuildRequires:  libusb-1_0-devel
BuildRequires:  opencl-headers
BuildRequires:  libgnuradio-iqbalance-devel
BuildRequires:  libopenssl-devel
BuildRequires:  libpcap-devel
Buildrequires:  log4cpp-devel
Buildrequires:  libmatio-devel >= 1.5.3
Buildrequires:  protobuf-devel
BuildRequires:  uhd-devel
BuildRequires:  zeromq-devel
BuildRequires:  pugixml-devel
BuildRequires:  python3-Mako
BuildRequires:  python3-six
BuildRequires:  texlive-alphalph
BuildRequires:  texlive-collection-latexrecommended
BuildRequires:  texlive-collection-mathscience
BuildRequires:  texlive-hanging
%if 0%{?sle_version} >= 150400
BuildRequires:  texlive-sectsty
BuildRequires:  texlive-soulpos
BuildRequires:  texlive-tocloft
%endif
%if 0%{limesdr}
BuildRequires:  gr-limesdr-devel
%endif
%if 0%{gnmax}
BuildRequires:  gr-gnMAX2769-devel
%endif
%if 0%{osmosdr}
BuildRequires:  gr-osmosdr-devel
Buildrequires:  rtl-sdr-devel
%endif
%if 0%{plutosdr}
%if 0%{?suse_version} <= 1500
BuildRequires:  libgnuradio-iio-devel
%endif
BuildRequires:  libiio-devel 
BuildRequires:  libad9361-iio-devel
%endif

%description
The aim of this project is to provide an open source (and, hopefully,
high–quality and well–written) Global Navigation Satellite Systems software
defined receiver (GNSS-SDR).


%package doc
Summary:        Documentation for gnss-sdr
Group:          Documentation/Other
BuildArch:      noarch
Obsoletes:      %{name}-devel-doc < %{version}-%{release}
Provides:       %{name}-devel-doc = %{version}-%{release}

%description doc
Documentation for gnss-sdr opensource GNSS receiver.


%prep
%setup -q
%if 0%{?suse_version} < 1600
%patch -P 1 -p1
%endif
%patch -P 2 -p1
%patch -P 3 -p1
%patch -P 4 -p1
%patch -P 5 -p1

mkdir -p thirdparty/gtest
cd thirdparty/gtest
tar -xvzf %{SOURCE1}
cd ../..

# remove buildtime from documentation
sed -i 's|^HTML_TIMESTAMP         = YES|HTML_TIMESTAMP         = NO|' docs/doxygen/Doxyfile.in

dos2unix COPYING

%build
%cmake \
    -DGTEST_DIR=$PWD/../thirdparty/gtest/googletest-%{gtest_version} \
    -DENABLE_ORC=ON \
%if 0%{limesdr}
    -DENABLE_LIMESDR=ON \
%endif
%if 0%{osmosdr}
    -DENABLE_OSMOSDR=ON \
%else
    -DENABLE_OSMOSDR=OFF \
%endif
%if 0%{gnmax}
    -DENABLE_GNMAX=ON \
%endif
%if 0%{plutosdr}
    -DENABLE_PLUTOSDR=ON \
    -DENABLE_FMCOMMS2=ON \
    -DENABLE_AD9361=ON \
%endif
    -DENABLE_RAW_UDP=ON \
    -DENABLE_PACKAGING=ON \
    -DENABLE_GENERIC_ARCH=ON \
    -DENABLE_ZMQ=ON
%cmake_build

#create documentation
make doc
%if 0%{?suse_version} >= 1600
make pdfmanual
%endif


%install
%cmake_install

mkdir -p %{buildroot}%{_docdir}/%{name}
cp -r build/docs/html %{buildroot}%{_docdir}/%{name}
%if 0%{?suse_version} >= 1600
cp -r build/docs/GNSS-SDR_manual.pdf %{buildroot}%{_docdir}/%{name}
%else
cp -r %{SOURCE2} %{buildroot}%{_docdir}/%{name}
%endif
mv %{buildroot}%{_datadir}/doc/%{name}/changelog.gz %{buildroot}%{_docdir}/%{name}

%fdupes -s %{buildroot}%{_docdir}


%files
%doc AUTHORS README.md
%license COPYING
%{_bindir}/gnss-sdr
%{_bindir}/front-end-cal
%{_bindir}/volk_gnsssdr_profile
%{_bindir}/volk_gnsssdr-config-info
%{_bindir}/gps_l1_ca_dll_pll_tracking_test_fpga
%{_bindir}/obsdiff
%{_datadir}/%{name}
%{_mandir}/man1/*.1.gz
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/changelog.gz
%exclude %{_docdir}/%{name}/html
%exclude %{_docdir}/%{name}/*.pdf

%files doc
%{_docdir}/%{name}/html
%{_docdir}/%{name}/*.pdf

%changelog
openSUSE Build Service is sponsored by