File ortp.spec of Package ortp

%define _cmakename Ortp
%define soname  libortp
%define sover   15
%define enable_tests 0
Name:           ortp
Version:        5.3.5
# Fedora release look standard from OpenSUSE build service:
# Release:      <CI_CNT>.<B_CNT>
# Release:      %%{?release_prefix}.<CI_CNT>.<B_CNT>
# where rpm macro %%{release_prefix} is defined in spec file
# Normally it looks like:
# Release:      63.fc38 for Fedora packages which is scripted as:
# Release:      0%%{?dist}
# OpenSUSE build service allows for this variant:
# Release:      63.1.fc38
# Release:       <CI_CNT>.<B_CNT>%%{?dist}
#
# Add this to Project Config to tag Fedora packages with fcXX:
# ------------------------------
# # reset release name
# onepercentage%%if 0onepercentage%%{?fedora_version}
# Release: <CI_CNT>.<B_CNT> spec:<CI_CNT>.<B_CNT>twopercentage%%{?dist}
# onepercentage%%endif
# ------------------------------
Release:        0
Summary:        Real-time Transport Protocol Stack
License:        GPL-3.0-or-later
Group:          Productivity/Telephony/Utilities
URL:            https://linphone.org/technical-corner/ortp/
Source:         https://gitlab.linphone.org/BC/public/ortp/-/archive/%{version}/%{name}-%{version}.tar.bz2
Source99:       baselibs.conf
# PATCH-FIX-OPENSUSE deps.diff
Patch0:         deps.diff
BuildRequires:  chrpath
BuildRequires:  cmake >= 3.0
BuildRequires:  gcc-c++
BuildRequires:  graphviz
BuildRequires:  pkgconfig
BuildRequires:  bctoolbox-devel >= 5.3.5
BuildRequires:  pkgconfig(bctoolbox) >= 5.3.0

%description
oRTP is a C library implementing the RTP protocol (RFC 1889).

%package -n %{soname}%{sover}
Summary:        Real-time Transport Protocol Stack
Group:          System/Libraries

%description -n %{soname}%{sover}
oRTP is a C library implementing the RTP protocol (RFC 1889).

%package devel
Summary:        Headers, libraries and docs for the oRTP library
Group:          Development/Libraries/C and C++
Requires:       %{soname}%{sover} = %{version}
Requires:       cmake
Provides:       %{soname}-devel = %{version}
Obsoletes:      %{soname}-devel < %{version}

%description devel
oRTP is a C library implementing the RTP protocol (RFC 1889).

This package contains header files and development libraries needed to
develop programs using the oRTP library.

%prep
%autosetup -p1

%build
%cmake \
%if %{enable_tests} == 0
  -DENABLE_TOOLS=OFF \
  -DENABLE_UNIT_TESTS=OFF \
  -DENABLE_TESTS=OFF \
%endif
  -DENABLE_STATIC=OFF \
  -DENABLE_DOC=OFF
%cmake_build

%install
%if 0%{?fedora} > 1
#https://en.opensuse.org/openSUSE:Packaging_checks
#disable rpmlint complain about rpath
export NO_BRP_CHECK_RPATH=true
export QA_RPATHS=$(( 0x0001|0x0002|0x0010 ))
%endif
%if 0%{?suse_version} > 1500
#disable rpmlint complain about rpath
#export NO_BRP_CHECK_RPATH=true
#export QA_RPATHS=$(( 0x0001|0x0002|0x0010 ))
#export QA_RPATHS=$[ 0x0001|0x0010 ]
%endif
%cmake_install

mkdir -p %{buildroot}%{_docdir}/%{name}
# manually keeping the version here because upstream doesn't (usually) update the patch version
mv -T %{buildroot}%{_datadir}/doc/%{name}-5.4.0 %{buildroot}%{_docdir}/%{name}

# for some reason, pkgconfig file contains wrong libdir
sed -i "s,-L/usr/lib,-L%{_libdir}," %{buildroot}/%{_libdir}/pkgconfig/%{name}.pc

chrpath -d %{buildroot}%{_libdir}/%{soname}.so.%{sover}*

# fix cmake stuff path
install -dm 0755 %{buildroot}%{_libdir}/cmake
mv %{buildroot}%{_datadir}/%{_cmakename}/cmake %{buildroot}%{_libdir}/cmake/%{_cmakename}
rmdir %{buildroot}%{_datadir}/%{_cmakename}

%post -n %{soname}%{sover} -p /sbin/ldconfig
%postun -n %{soname}%{sover} -p /sbin/ldconfig

%files
%doc %{_docdir}/%{name}/

%files -n %{soname}%{sover}
%{_libdir}/%{soname}.so.%{sover}*

%files devel
%dir %{_libdir}/cmake/%{_cmakename}
%{_includedir}/%{name}/
%{_libdir}/%{soname}.so
%{_libdir}/pkgconfig/%{name}.pc
%{_libdir}/cmake/%{_cmakename}/*

%changelog
openSUSE Build Service is sponsored by