Name:           libsrtp
Version:        1.5.4
Release:        10
Summary:        Library for SRTP (Secure Realtime Transport Protocol)
License:        BSD
URL:            https://github.com/cisco/libsrtp
Source0:        https://github.com/cisco/libsrtp/archive/v%{version}.tar.gz
Source2:        config.h

BuildRequires:  gcc

Patch0000:      libsrtp-1.5.4-shared-fix.patch
Patch0001:      libsrtp-srtp_aes_encrypt.patch
Patch0002:      libsrtp-sha1-name-fix.patch
Patch0003:      libsrtp-fix-name-collision-on-MIPS.patch

%description
This package provides an implementation of the Secure Real-time Transport Protocol (SRTP),
the Universal Security Transform (UST), and a supporting cryptographic kernel.
The SRTP API is documented in include/srtp.h, and the library is in libsrtp2.a (after compilation).

%package devel
Summary:        Development package for %{name}
Requires:       %{name} = %{version}-%{release} pkgconfig

%description devel
This package provides libraries and header files that used for
development of %{name}.

%prep
%autosetup -n %{name}-%{version} -p1

%build
%configure
%make_build shared_library CFLAGS="%{optflags} -fPIC" 

%install
%make_install
%delete_la

mv -f %{buildroot}%{_includedir}/srtp/config.h %{buildroot}%{_includedir}/srtp/config-%{__isa_bits}.h
install -pm644 %{SOURCE2} %{buildroot}%{_includedir}/srtp/config.h

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%license LICENSE
%doc CHANGES README TODO VERSION doc/*.txt doc/*.pdf
%{_libdir}/*.so.*

%files devel
%{_includedir}/srtp/
%{_libdir}/pkgconfig/libsrtp.pc
%{_libdir}/*.so

%changelog
* Tue Oct 23 2019 huzhiyu <huzhiyu1@huawei.com> - 1.5.4-10
- Package init
