net-libs/nghttp2: stable 1.29.0 for ppc64, bug #646100
[gentoo.git] / net-libs / libsrtp / libsrtp-1.5.4-r1.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit autotools multilib-minimal
7
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"
11
12 LICENSE="BSD"
13 SLOT="0/1"
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"
16
17 RDEPEND="
18         openssl? (
19                 !libressl? ( dev-libs/openssl:0=[${MULTILIB_USEDEP}] )
20                 libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP}] )
21         )
22 "
23 DEPEND="${RDEPEND}"
24
25 DOCS=( CHANGES README TODO )
26
27 MULTILIB_WRAPPED_HEADERS=(
28         /usr/include/srtp/config.h
29 )
30 PATCHES=( "${FILESDIR}/${PN}-pcap-automagic-r0.patch" )
31
32 src_prepare() {
33         default
34
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
38
39         eautoreconf
40 }
41
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
47         ECONF_SOURCE=${S} \
48         econf \
49                 --enable-stdout \
50                 --disable-kernel-linux \
51                 --disable-gdoi \
52                 --disable-pcap \
53                 $(use_enable aesicm generic-aesicm) \
54                 $(use_enable console) \
55                 $(use_enable debug) \
56                 $(use_enable openssl) \
57                 $(use_enable syslog)
58 }
59
60 multilib_src_compile() {
61         use static-libs && emake ${PN}.a
62         emake shared_library
63         use test && emake test
64 }
65
66 multilib_src_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
69
70         LD_LIBRARY_PATH="${BUILD_DIR}" emake -j1 runtest
71
72         # Makefile.in has '$(testapp): libsrtp.a'
73         if use !static-libs; then
74                 rm libsrtp.a || die
75         fi
76 }
77
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 )
82         einstalldocs
83 }