File libsrtp2.spec of Package libsrtp2

%define realname libsrtp2
%define srcext   tar.bz2

%define so_ver   1

# Common info
Name:          %{realname}%{?so_ver:-%{so_ver}}
Version:       1.0.0
Release:       wiz%{?extraver:0.}1%{?dist}
License:       BSD-3-Clause
Group:         System/Libraries
URL:           https://github.com/traud/libsrtp
Summary:       Secure RTP (SRTP) Reference Implementation

# Install-time parameters
Provides:      %{realname} = %{version}-%{release}

# Build-time parameters
BuildRequires: openssl-devel >= 1.0.1
BuildRoot:     %{_tmppath}/%{name}-root
Source:        %{realname}-%{version}%{?extraver}.%{srcext}

%description
This package provides an implementation of the Secure Real-time
Transport Protocol (SRTP), the Universal Security Transform (UST), and
a supporting cryptographic kernel.

%package -n %{realname}-devel
Group:         Development/Languages/C and C++
Summary:       Development files for %{name}
Requires:      openssl-devel >= 1.0.1
Requires:      %{name} = %{version}-%{release}
Provides:      %{name}-devel = %{version}-%{release}
Provides:      srtp2-devel = %{version}-%{release}
Obsoletes:     srtp2-devel < %{version}-%{release}

%description -n %{realname}-devel
This package provides an implementation of the Secure Real-time
Transport Protocol (SRTP), the Universal Security Transform (UST), and
a supporting cryptographic kernel.

This package provides development stuff for %{realname}.

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}

%build
%configure \
 --disable-static \
 --disable-debug \
 --enable-openssl \
 --disable-stdout \
 CFLAGS="%{optflags} %{?gcc_lto}" \
 LDFLAGS="-Wl,--as-needed -Wl,--strip-all %{?gcc_lto}"
%{__make} %{?_smp_mflags} shared_library

%install
%{__make} install DESTDIR=%{buildroot}
# install additional headers
for h in cipher.h datatypes.h integers.h alloc.h rdbx.h err.h crypto_types.h ; do
    %{__install} -m0644 crypto/include/$h %{buildroot}%{_includedir}/srtp2/$h
done

%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%files
%defattr(-,root,root)
%doc CHANGES LICENSE README.md
%{_libdir}/%{realname}.so.%{?so_ver}*

# Development stuff
%files -n %{realname}-devel
%defattr(-,root,root)
%doc CHANGES LICENSE README.md doc/*.txt
%{_libdir}/pkgconfig/%{realname}.pc
%dir %{_includedir}/srtp2/
%{_includedir}/srtp2/*.h
%{_libdir}/%{realname}.so

%post   -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%changelog
openSUSE Build Service is sponsored by