%global shortname srtp

Summary:	Secure RTP (SRTP) and UST Reference Implementations
Name:		libsrtp
Version:	1.5.4
Release:	1%{?_dist_release}

Source0:	https://github.com/cisco/libsrtp/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
# Universal config.h
Source2:	config.h
# Fix shared lib so ldconfig doesn't complain
Patch0:		libsrtp-1.5.4-shared-fix.patch
Patch1:		libsrtp-srtp_aes_encrypt.patch
Patch2:		libsrtp-sha1-name-fix.patch
Patch3:		libsrtp-fix-name-collision-on-MIPS.patch

License:	BSD
Group:		System Environment/Libraries
URL:		https://github.com/cisco/libsrtp

BuildRoot:	%{_tmppath}/%{name}-%{version}-root

Vendor: Project Vine
Distribution: Vine Linux
Packager: Takemikaduchi

%description
The libSRTP library is an open-source implementation of the Secure Real-time
Transport Protocol (SRTP) originally authored by Cisco Systems, Inc.


%package devel
Summary:        Development environment for libsrtp
Group:          Development/Libraries
Requires:       %{name} = %{version}-%{release}

%description devel
Header files and libraries for building a extension library for the
libsrtp


%prep
%setup -q

%patch0 -p1 -b .sharedfix
%patch1 -p1 -b .srtp_aes_encrypt
%patch2 -p1 -b .sha1-name-fix
%patch3 -p1 -b .mips-name-fix


%build
export CFLAGS="%{optflags} -fPIC"
%configure --disable-static
%{__make} %{?_smp_mflags} shared_library


%install
%{__rm} -rf %{buildroot}
%{__make} install DESTDIR=%{buildroot}
find %{buildroot} -name '*.la' -exec rm -f {} ';'

# Handle multilib issues with config.h
mv %{buildroot}%{_includedir}/%{shortname}/config.h %{buildroot}%{_includedir}/%{shortname}/config-%{__isa_bits}.h
cp -a %{SOURCE2} %{buildroot}%{_includedir}/%{shortname}/config.h


%clean
%{__rm} -rf %{buildroot}

%post
/sbin/ldconfig

%postun
/sbin/ldconfig

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

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


%changelog
* Mon Jul 11 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.5.4-1
- new upstream release.

* Tue Feb 14 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.4.4-1
- initial build for Vine Linux based on fedora development

