libsrtp/libsrtp.spec

147 lines
5.4 KiB
RPMSpec

#
# spec file for package libsrtp
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: libsrtp
%define library_name libsrtp2
%define git_snapshot 7db9eb2
Version: 1.4.5.0.20130918.%{git_snapshot}
Release: 0
Summary: Secure Real-Time Transport Protocol (SRTP) library
License: BSD-3-Clause
Group: Development/Libraries/C and C++
Url: http://srtp.sourceforge.net/srtp.html
#Git-Clone: git://github.com/cisco/libsrtp
Source: %{name}-git%{git_snapshot}.tar.xz
# PATCH-FEATURE-OPENSUSE libsrtp-automake.patch jengelh@inai.de -- Support for automake to easily build shared library.
Patch: %{name}-automake.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: dos2unix
BuildRequires: libtool
BuildRequires: pkg-config
BuildRequires: xz
Provides: srtp = %{version}-%{release}
Obsoletes: srtp < %{version}
%description
The libSRTP library is an open source implementation of the Secure
Real-time Transport Protocol (SRTP) originally authored by Cisco
Systems, Inc.
%package -n %{library_name}
Summary: Secure Real-Time Transport Protocol (SRTP) library
Group: System/Libraries
%description -n %{library_name}
The libSRTP library is an open source implementation of the Secure
Real-time Transport Protocol (SRTP) originally authored by Cisco
Systems, Inc.
SRTP is a security profile for RTP that adds confidentiality, message
authentication, and replay protection to that protocol. It is specified
in RFC 3711. More information about the SRTP protocol itself can be
found on the Secure RTP page.
%package devel
Summary: Secure Real-Time Transport Protocol (SRTP) library
Group: Development/Libraries/C and C++
Requires: %{library_name} = %{version}
Provides: srtp-devel = %{version}-%{release}
Obsoletes: srtp-devel < %{version}
%description devel
The libSRTP library is an open source implementation of the Secure
Real-time Transport Protocol (SRTP) originally authored by Cisco
Systems, Inc.
SRTP is a security profile for RTP that adds confidentiality, message
authentication, and replay protection to that protocol. It is specified
in RFC 3711. More information about the SRTP protocol itself can be
found on the Secure RTP page.
%prep
%setup -q -n %{name}
%patch -p1
tr '\r' '\n' <doc/draft-irtf-cfrg-icm-00.txt >doc/draft-irtf-cfrg-icm-00.txt.unix
touch -r doc/draft-irtf-cfrg-icm-00.txt doc/draft-irtf-cfrg-icm-00.txt.unix
mv doc/draft-irtf-cfrg-icm-00.txt.unix doc/draft-irtf-cfrg-icm-00.txt
%build
autoreconf -fi
%configure \
--enable-generic-aesicm \
--enable-syslog
# --enable-gdoi
# FIXME: Does not work:
# --enable-kernel-linux
make %{?_smp_mflags}
%install
%makeinstall
rm %{buildroot}%{_libdir}/*.la
# This file is required by some headers, but missing in the installed files. (bnc#839475)
install -m0644 crypto/include/config.h %{buildroot}%{_includedir}/srtp/
# We provide verbose messages here.
set +x
# Including of files with generic names and quotes is unsafe and can cause include clashes.
# Do it in install phase, because rewriting of the source code before building would require deeper changes.
# /usr/include is included automatically, so we don't modify .pc file. (bnc#839475#c2)
echo "Rewriting #include \"{foo}.h\" to #include <srtp/{foo}.h>..."
sed -i 's:\( *# *include *\)"\([^"]*\.h\)":\1 <srtp/\2>:' %{buildroot}%{_includedir}/srtp/*.h
# Rewrite FOO_H just to make things consistent and prevent name clashes.
echo "Rewriting header include check tags from {FOO_H} to SRTP_{FOO_H}..."
sed -i 's:\(# *\(ifdef\|ifndef\|define\|endif */\*\) *\)\([A-Z0-9_]*_H\)\($\| *\*/\):\1SRTP_\3\4:' %{buildroot}%{_includedir}/srtp/*.h
sed -i 's:\(# *\(ifdef\|ifndef\|define\|endif */\*\) *\)\(CRYPTO_KERNEL\|RAND_SOURCE\)\($\| *\*/\):\1SRTP_\3_H\4:' %{buildroot}%{_includedir}/srtp/*.h
sed -i 's:__DATATYPES_H:_DATATYPES_H:' %{buildroot}%{_includedir}/srtp/*.h
# And finally, prevent all potential clashes in autoconf based variables in config.h.
for SYMBOL in\
$(
sed -n '
# Everything below const is a definition of the compiler and hopefully undefined.
/const/,$d
# Search and print autoconf generated defines.
s:\(^# *define\|/\* # *undef\) \([A-Z0-9_]*\).*$:\2:p
' <%{buildroot}%{_includedir}/srtp/config.h
)
do
echo "Rewriting symbol $SYMBOL to SRTP_$SYMBOL..."
sed -i 's:\([^A-Z0-9_]\)\('$SYMBOL'\)\([^A-Z0-9_]\|$\):\1SRTP_\2\3:g' %{buildroot}%{_includedir}/srtp/*.h
done
set -x
%post -n %{library_name} -p /sbin/ldconfig
%postun -n %{library_name} -p /sbin/ldconfig
%files -n %{library_name}
%defattr(-,root,root)
%{_libdir}/libsrtp.so.2*
%files devel
%defattr(-,root,root)
%doc CHANGES LICENSE README TODO VERSION doc/*.pdf doc/*.txt
%{_includedir}/srtp/
%{_libdir}/libsrtp.so
%{_libdir}/pkgconfig/libsrtp.pc
%changelog