1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit autotools multilib-minimal
8 DESCRIPTION="Open-source implementation of the Secure Real-time Transport Protocol (SRTP)"
9 HOMEPAGE="https://github.com/cisco/libsrtp"
10 SRC_URI="https://github.com/cisco/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
14 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 -sparc ~x86 ~x86-fbsd ~ppc-macos ~x64-macos ~x86-macos"
15 IUSE="aesicm console debug doc libressl openssl static-libs syslog test"
19 !libressl? ( dev-libs/openssl:0=[${MULTILIB_USEDEP}] )
20 libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP}] )
25 DOCS=( CHANGES README TODO )
27 MULTILIB_WRAPPED_HEADERS=(
28 /usr/include/srtp/config.h
30 PATCHES=( "${FILESDIR}/${PN}-pcap-automagic-r0.patch" )
35 # test/rtpw.c is using /usr/share/dict/words assuming it exists
36 # using test/rtpw.c guaratees the file exists in any case
37 sed -i -e "s:/usr/share/dict/words:rtpw.c:" test/rtpw.c || die
42 multilib_src_configure() {
43 # stdout: default error output for messages in debug
44 # kernel-linux: breaks the build
45 # gdoi: disabled by upstream and breaks the build
46 # pcap: seems to be test-only
50 --disable-kernel-linux \
53 $(use_enable aesicm generic-aesicm) \
54 $(use_enable console) \
56 $(use_enable openssl) \
60 multilib_src_compile() {
61 use static-libs && emake ${PN}.a
63 use test && emake test
67 # work-around tests that do not like out-of-source builds
68 cp "${S}"/test/{getopt_s,rtpw}.c "${BUILD_DIR}"/test/ || die
70 LD_LIBRARY_PATH="${BUILD_DIR}" emake -j1 runtest
72 # Makefile.in has '$(testapp): libsrtp.a'
73 if use !static-libs; then
78 multilib_src_install_all() {
79 # libsrtp.pdf can also be generated with doxygen
80 # but it would be a waste of time as an up-to-date version is built
81 use doc && DOCS+=( doc/*.txt doc/${PN}.pdf )