1 |
|
# Copyright 1999-2021 Gentoo Authors
|
|
1 |
# Copyright 1999-2022 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI=7
|
|
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
inherit autotools multilib-minimal
|
|
6 |
inherit meson-multilib
|
7 |
7 |
|
8 |
8 |
DESCRIPTION="Open-source implementation of the Secure Real-time Transport Protocol (SRTP)"
|
9 |
9 |
HOMEPAGE="https://github.com/cisco/libsrtp"
|
10 |
10 |
SRC_URI="https://github.com/cisco/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
|
11 |
11 |
|
12 |
12 |
LICENSE="BSD"
|
13 |
|
SLOT="0/1"
|
14 |
|
KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ppc ppc64 -sparc x86 ~ppc-macos ~x64-macos"
|
15 |
|
IUSE="aesicm console debug doc openssl static-libs syslog test"
|
|
13 |
SLOT="2/1"
|
|
14 |
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ppc ppc64 ~riscv -sparc x86 ~ppc-macos ~x64-macos"
|
|
15 |
IUSE="debug doc nss openssl static-libs test"
|
16 |
16 |
RESTRICT="!test? ( test )"
|
17 |
17 |
|
|
18 |
REQUIRED_USE="?? ( nss openssl )"
|
|
19 |
|
18 |
20 |
RDEPEND="
|
19 |
|
openssl? (
|
20 |
|
dev-libs/openssl:0=[${MULTILIB_USEDEP}]
|
21 |
|
)
|
|
21 |
openssl? ( dev-libs/openssl:0=[${MULTILIB_USEDEP}] )
|
|
22 |
nss? ( >=dev-libs/nss-3.52[${MULTILIB_USEDEP}] )
|
22 |
23 |
"
|
23 |
24 |
DEPEND="${RDEPEND}"
|
24 |
25 |
|
25 |
|
DOCS=( CHANGES README TODO )
|
|
26 |
BDEPEND="
|
|
27 |
doc? ( app-doc/doxygen )
|
|
28 |
virtual/pkgconfig
|
|
29 |
"
|
26 |
30 |
|
27 |
|
MULTILIB_WRAPPED_HEADERS=(
|
28 |
|
/usr/include/srtp/config.h
|
29 |
|
)
|
30 |
|
PATCHES=(
|
31 |
|
"${FILESDIR}/${PN}-pcap-automagic-r0.patch"
|
32 |
|
"${FILESDIR}/${P}-openssl-hmac.patch"
|
33 |
|
"${FILESDIR}/${P}-openssl-aem_icm-key.patch"
|
34 |
|
"${FILESDIR}/${P}-openssl-aem_gcm-key.patch"
|
35 |
|
"${FILESDIR}/${P}-openssl-1.1.patch"
|
36 |
|
)
|
37 |
|
|
38 |
|
src_prepare() {
|
39 |
|
default
|
40 |
|
|
41 |
|
# test/rtpw.c is using /usr/share/dict/words assuming it exists
|
42 |
|
# using test/rtpw.c guaratees the file exists in any case
|
43 |
|
sed -i -e "s:/usr/share/dict/words:rtpw.c:" test/rtpw.c || die
|
44 |
|
|
45 |
|
mv configure.in configure.ac || die
|
46 |
|
eautoreconf
|
47 |
|
touch ar-lib || die #775680
|
48 |
|
}
|
|
31 |
PATCHES=( "${FILESDIR}"/libsrtp-2.4.2-doc.patch )
|
49 |
32 |
|
50 |
33 |
multilib_src_configure() {
|
|
34 |
local crypto_lib="none"
|
|
35 |
use openssl && crypto_lib="openssl"
|
|
36 |
use nss && crypto_lib="nss"
|
|
37 |
|
51 |
38 |
# stdout: default error output for messages in debug
|
52 |
|
# kernel-linux: breaks the build
|
53 |
|
# gdoi: disabled by upstream and breaks the build
|
54 |
|
# pcap: seems to be test-only
|
55 |
|
ECONF_SOURCE=${S} \
|
56 |
|
econf \
|
57 |
|
--enable-stdout \
|
58 |
|
--disable-kernel-linux \
|
59 |
|
--disable-gdoi \
|
60 |
|
--disable-pcap \
|
61 |
|
$(use_enable aesicm generic-aesicm) \
|
62 |
|
$(use_enable console) \
|
63 |
|
$(use_enable debug) \
|
64 |
|
$(use_enable openssl) \
|
65 |
|
$(use_enable syslog)
|
|
39 |
# openssl-kdf: OpenSSL 1.1.0+
|
|
40 |
local emesonargs=(
|
|
41 |
-Dcrypto-library=${crypto_lib}
|
|
42 |
-Dcrypto-library-kdf=disabled
|
|
43 |
-Dfuzzer=disabled
|
|
44 |
-Dlog-stdout=true
|
|
45 |
-Dpcap-tests=disabled
|
|
46 |
-Ddefault_library=$(usex static-libs both shared)
|
|
47 |
|
|
48 |
$(meson_feature test tests)
|
|
49 |
$(meson_native_use_feature doc)
|
|
50 |
$(meson_use debug debug-logging)
|
|
51 |
)
|
|
52 |
meson_src_configure
|
66 |
53 |
}
|
67 |
54 |
|
68 |
55 |
multilib_src_compile() {
|
69 |
|
use static-libs && emake ${PN}.a
|
70 |
|
emake shared_library
|
71 |
|
use test && emake test
|
|
56 |
meson_src_compile
|
|
57 |
if multilib_is_native_abi && use doc; then
|
|
58 |
meson_src_compile doc
|
|
59 |
fi
|
72 |
60 |
}
|
73 |
61 |
|
74 |
|
multilib_src_test() {
|
75 |
|
# work-around tests that do not like out-of-source builds
|
76 |
|
cp "${S}"/test/{getopt_s,rtpw}.c "${BUILD_DIR}"/test/ || die
|
77 |
|
|
78 |
|
LD_LIBRARY_PATH="${BUILD_DIR}" emake -j1 runtest
|
79 |
|
|
80 |
|
# Makefile.in has '$(testapp): libsrtp.a'
|
81 |
|
if use !static-libs; then
|
82 |
|
rm libsrtp.a || die
|
|
62 |
multilib_src_install() {
|
|
63 |
if multilib_is_native_abi && use doc; then
|
|
64 |
dodoc -r html
|
83 |
65 |
fi
|
|
66 |
meson_src_install
|
84 |
67 |
}
|
85 |
68 |
|
86 |
69 |
multilib_src_install_all() {
|
87 |
|
# libsrtp.pdf can also be generated with doxygen
|
88 |
|
# but it would be a waste of time as an up-to-date version is built
|
89 |
|
use doc && DOCS+=( doc/*.txt doc/${PN}.pdf )
|
|
70 |
local DOCS=( CHANGES )
|
90 |
71 |
einstalldocs
|
91 |
72 |
}
|