%global pkgvers 0
%global scdate0 20250325
%global schash0 867e2976265de756c6469c33a5203c74a082cdec
%global branch0 master
%global source0 https://gitlab.linphone.org/BC/public/ortp.git

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

Epoch:          3
Name:           ortp
Version:        5.5.0
Release:        %{scdate0}.%{pkgvers}.git%{sshort0}%{?dist}
Summary:        A C library implementing the RTP protocol (RFC3550)
License:        GPLv3

URL:            http://www.linphone.org/eng/documentation/dev/ortp.html

BuildRequires:  git gcc-c++ cmake doxygen graphviz libtool
BuildRequires:  libsrtp-devel openssl-devel bctoolbox-devel

%undefine _hardened_build
%undefine _annotated_build

%description
oRTP is a C library that implements RTP (RFC3550).

%package        devel
Summary:        Development libraries for %{name}
Requires:       %{name} = %{epoch}:%{version}-%{release}
Requires:       bctoolbox-devel


%description    devel
Libraries and headers required to develop software with %{name}.


%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
# epel
sed -i 's|cmake_minimum_required(VERSION.*|cmake_minimum_required(VERSION 3.20)|g' CMakeLists.txt


%build
sed -i 's|WARN_AS_ERROR.*=.*YES|WARN_AS_ERROR = NO|' ortp.doxygen.in
%global optflags %(echo %optflags | sed 's|-Wp,-D_GLIBCXX_ASSERTIONS||g')
%cmake -Wno-dev \
       -DCMAKE_SKIP_RPATH=ON \
       -DCMAKE_VERBOSE_MAKEFILE=OFF \
       -DCMAKE_BUILD_TYPE=RelWithDebInfo \
       -DENABLE_SHARED=ON \
       -DENABLE_STATIC=OFF \
       -DENABLE_TESTS=OFF \
       -DENABLE_UNIT_TESTS=OFF
%cmake_build


%install
%cmake_install
rm -rf %{buildroot}/%{_datadir}/doc


%ldconfig_scriptlets


%files
%doc README.md
%doc AUTHORS.md
%doc CHANGELOG.md
%license LICENSE.txt
%{_libdir}/libortp.so.*

%files devel
%{_includedir}/%{name}
%{_libdir}/libortp.so
%{_libdir}/pkgconfig/ortp.pc
%{_datadir}/Ortp/*


%changelog
* Mon Apr 11 2022 Cristian Balint <cristian.balint@gmail.com>
- github upstream releases

* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2:0.23.0-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild