# No upstream .so name versioning: https://github.com/creytiv/re/issues/249
%global soversion 0
Summary: Library for real-time communications and SIP stack
Name: libre
Version: 0.6.1
Release: 2%{?dist}
License: BSD
URL: http://www.creytiv.com/re.html
Source0: https://github.com/creytiv/re/archive/v%{version}/re-%{version}.tar.gz
# Latest fixes from Git (not yet available in a release)
Patch0: libre-0.6.1-ea0509d.patch
# Do not fail authorization if it has succeed before
Patch1: libre-0.6.6-re-register-without-stale.patch
BuildRequires: make
BuildRequires: gcc
BuildRequires: openssl-devel
BuildRequires: zlib-devel
# Cover multiple third party repositories
Obsoletes: libre0 < 0.6.1-2
Provides: libre0 = %{version}-%{release}
Provides: libre0%{?_isa} = %{version}-%{release}
Obsoletes: re < 0.6.1-2
Provides: re = %{version}-%{release}
Provides: re%{?_isa} = %{version}-%{release}
%description
Libre is a portable and generic library for real-time communications with
async IO support and a complete SIP stack with support for SDP, RTP/RTCP,
STUN/TURN/ICE, BFCP and DNS client.
%package devel
Summary: Development files for the re library
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: pkgconfig
Requires: openssl-devel
Requires: zlib-devel
# Cover multiple third party repositories
Obsoletes: libre0-devel < 0.6.1-2
Provides: libre0-devel = %{version}-%{release}
Provides: libre0-devel%{?_isa} = %{version}-%{release}
Obsoletes: re-devel < 0.6.1-2
Provides: re-devel = %{version}-%{release}
Provides: re-devel%{?_isa} = %{version}-%{release}
%description devel
The libre-devel package includes header files and libraries necessary for
developing programs which use the re C library.
%prep
%setup -q -n re-%{version}
%patch0 -p1 -b .ea0509d
%patch1 -p1 -b .re-register-without-stale
%build
%make_build \
SHELL='sh -x' \
RELEASE=1 \
USE_OPENSSL=1 \
USE_ZLIB=1 \
EXTRA_CFLAGS="$RPM_OPT_FLAGS" \
EXTRA_LFLAGS="$RPM_LD_FLAGS" \
LIB_SUFFIX=.so.%{soversion} \
SH_LFLAGS="-shared -Wl,-soname,libre.so.%{soversion}"
%install
%make_install \
LIBDIR=%{_libdir} \
LIB_SUFFIX=.so.%{soversion}
# Create missing symlink and remove static library
ln -s %{name}.so.%{soversion} $RPM_BUILD_ROOT%{_libdir}/%{name}.so
rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}.a
%ldconfig_scriptlets
%files
%license docs/COPYING
%doc docs/ChangeLog
%{_libdir}/%{name}.so.%{soversion}
%files devel
%{_libdir}/%{name}.so
%{_includedir}/re/
%{_libdir}/pkgconfig/%{name}.pc
%{_datadir}/re/
%changelog
* Sun Jun 28 2020 Robert Scheck <robert@fedoraproject.org> 0.6.1-2
- Add patch to accept 401 to re-register without stale=true
- Changes to match the Fedora Packaging Guidelines (#1843264 #c1)
* Thu May 28 2020 Robert Scheck <robert@fedoraproject.org> 0.6.1-1
- Upgrade to 0.6.1 (#1843264)
- Initial spec file for Fedora and Red Hat Enterprise Linux