%global pkgvers 0
%global scdate0 20250307
%global schash0 b39cb61ed03d74c35a2de757d495e901acbb6404
%global branch0 master
%global source0 https://github.com/myriadrf/LimeSuite.git

%global sshort0 %{expand:%%{lua:print(('%{schash0}'):sub(1,8))}}

Name:           limesuite
Version:        23.11.0
Release:        %{scdate0}.%{pkgvers}.git%{sshort0}%{?dist}
Summary:        Lime Suite
License:        Apache

URL:            https://github.com/myriadrf/LimeSuite

BuildRequires:  git cmake doxygen libX11-devel SoapySDR-devel
BuildRequires:  fltk-devel libusb1-devel wxWidgets-devel libglvnd-devel gnuplot
%if ! 0%{?rhel}
BuildRequires:  fltk-fluid
%endif

%global __cmake_in_source_build 1
%if 0%{?fedora} > 40
%global toolchain clang
%endif

%if "%{toolchain}" == "gcc"
BuildRequires:  gcc-c++
%else
BuildRequires:  clang
%endif

%description
The Lime Suite application software provides drivers and SDR
application support for the LMS7002M RFIC, and hardware like
the LimeSDR, NovenaRF7, and others.

%package        devel
Summary: Development library of LimeSuite
Requires:       %{name} = %{version}-%{release}

%description    devel
Development LimeSuite library

%prep
%setup -T -c -n %{name}
git clone --depth 1 -n -b %{branch0} %{source0} .
git fetch --depth 1 origin %{schash0}
git reset --hard %{schash0}
git log --format=fuller
# gcc13
sed -i '1i #include <cstdint>' src/lms7002m_mcu/MCU_File.cpp
# cmake min
sed -i 's|cmake_minimum_required(VERSION 3.1.3)|cmake_minimum_required(VERSION 3.5)|' CMakeLists.txt


%build
mkdir -p build
pushd build
%cmake .. -Wno-dev \
       -DCMAKE_SKIP_RPATH=ON \
       -DCMAKE_SKIP_BUILD_RPATH=ON \
       -DCMAKE_VERBOSE_MAKEFILE=OFF \
       -DCMAKE_BUILD_TYPE=RelWithDebInfo \
       -DOpenGL_GL_PREFERENCE=GLVND \
       -DFLTK_DIR=/usr \
       -DFLTK_INCLUDE_DIR=%{_includedir}/FL \
       -DENABLE_HEADERS=ON \
       -DENABLE_LIBRARY=ON \
       -DENABLE_SPI=OFF \
       -DENABLE_REMOTE=OFF \
       -DENABLE_STREAM=OFF \
       -DENABLE_EVB7COM=ON \
       -DENABLE_UTILITIES=ON \
       -DENABLE_NEW_GAIN_BEHAVIOUR=ON \
       -DENABLE_API_DOXYGEN=ON

make %{?_smp_mflags}
popd

%install
rm -rf %{buildroot}

pushd build
make install DESTDIR=%{buildroot}
popd


%files
%doc README.md
%license COPYING
%{_bindir}/*
%{_libdir}/*.so.*
%{_libdir}/SoapySDR
%{_datadir}/Lime

%files devel
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/cmake/LimeSuite/*.cmake
%{_libdir}/pkgconfig/LimeSuite.pc


%changelog
* Tue Aug 21 2018 Balint Cristian <cristian.balint@gmail.com>
- github update releases