cc2a7e26e1e843af916a3237d66b3d7aecde8762
[gentoo.git] / net-libs / gnutls / gnutls-3.6.2.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit libtool ltprune multilib-minimal versionator
7
8 DESCRIPTION="A TLS 1.2 and SSL 3.0 implementation for the GNU project"
9 HOMEPAGE="http://www.gnutls.org/"
10 SRC_URI="mirror://gnupg/gnutls/v$(get_version_component_range 1-2)/${P}.tar.xz"
11
12 LICENSE="GPL-3 LGPL-2.1"
13 SLOT="0/30" # libgnutls.so number
14 KEYWORDS=""
15 IUSE="+cxx dane doc examples guile +idn nls +openssl pkcs11 seccomp sslv2 sslv3 static-libs test test-full +tls-heartbeat tools valgrind"
16
17 REQUIRED_USE="
18         test-full? ( cxx dane doc examples guile idn nls openssl pkcs11 seccomp tls-heartbeat tools )"
19
20 # NOTICE: sys-devel/autogen is required at runtime as we
21 # use system libopts
22 RDEPEND=">=dev-libs/libtasn1-4.9:=[${MULTILIB_USEDEP}]
23         dev-libs/libunistring:=[${MULTILIB_USEDEP}]
24         >=dev-libs/nettle-3.1:=[gmp,${MULTILIB_USEDEP}]
25         >=dev-libs/gmp-5.1.3-r1:=[${MULTILIB_USEDEP}]
26         tools? ( sys-devel/autogen )
27         dane? ( >=net-dns/unbound-1.4.20[${MULTILIB_USEDEP}] )
28         guile? ( >=dev-scheme/guile-1.8:=[networking] )
29         nls? ( >=virtual/libintl-0-r1[${MULTILIB_USEDEP}] )
30         pkcs11? ( >=app-crypt/p11-kit-0.23.1[${MULTILIB_USEDEP}] )
31         idn? ( >=net-dns/libidn2-0.16-r1[${MULTILIB_USEDEP}] )"
32 DEPEND="${RDEPEND}
33         >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]
34         doc? ( dev-util/gtk-doc )
35         nls? ( sys-devel/gettext )
36         valgrind? ( dev-util/valgrind )
37         test? (
38                 seccomp? ( sys-libs/libseccomp )
39         )
40         test-full? (
41                 guile? ( >=dev-scheme/guile-2 )
42                 app-crypt/dieharder
43                 app-misc/datefudge
44                 dev-libs/softhsm:2[-bindist]
45                 net-dialup/ppp
46                 net-misc/socat
47         )"
48
49 DOCS=(
50         README.md
51         doc/certtool.cfg
52 )
53
54 HTML_DOCS=()
55
56 pkg_setup() {
57         # bug#520818
58         export TZ=UTC
59
60         use doc && HTML_DOCS+=(
61                 doc/gnutls.html
62         )
63 }
64
65 src_prepare() {
66         default
67
68         # force regeneration of autogen-ed files
69         local file
70         for file in $(grep -l AutoGen-ed src/*.c) ; do
71                 rm src/$(basename ${file} .c).{c,h} || die
72         done
73
74         # Use sane .so versioning on FreeBSD.
75         elibtoolize
76 }
77
78 multilib_src_configure() {
79         LINGUAS="${LINGUAS//en/en@boldquot en@quot}"
80
81         # remove magic of library detection
82         # bug#438222
83         local libconf=($("${S}/configure" --help | grep -- '--without-.*-prefix' | sed -e 's/^ *\([^ ]*\) .*/\1/g'))
84
85         # TPM needs to be tested before being enabled
86         libconf+=( --without-tpm )
87
88         # hardware-accell is disabled on OSX because the asm files force
89         #   GNU-stack (as doesn't support that) and when that's removed ld
90         #   complains about duplicate symbols
91         [[ ${CHOST} == *-darwin* ]] && libconf+=( --disable-hardware-acceleration )
92
93         # Cygwin as does not understand these asm files at all
94         [[ ${CHOST} == *-cygwin* ]] && libconf+=( --disable-hardware-acceleration )
95
96         ECONF_SOURCE=${S} econf \
97                 $(multilib_native_enable manpages) \
98                 $(multilib_native_use_enable doc gtk-doc) \
99                 $(multilib_native_use_enable doc) \
100                 $(multilib_native_use_enable guile) \
101                 $(multilib_native_use_enable seccomp seccomp-tests) \
102                 $(multilib_native_use_enable test tests) \
103                 $(multilib_native_use_enable test-full full-test-suite) \
104                 $(multilib_native_use_enable tools) \
105                 $(multilib_native_use_enable valgrind valgrind-tests) \
106                 $(use_enable cxx) \
107                 $(use_enable dane libdane) \
108                 $(use_enable nls) \
109                 $(use_enable openssl openssl-compatibility) \
110                 $(use_enable sslv2 ssl2-support) \
111                 $(use_enable sslv3 ssl3-support) \
112                 $(use_enable static-libs static) \
113                 $(use_enable tls-heartbeat heartbeat-support) \
114                 $(use_with idn) \
115                 $(use_with pkcs11 p11-kit) \
116                 --with-unbound-root-key-file="${EPREFIX}/etc/dnssec/root-anchors.txt" \
117                 --without-included-libtasn1 \
118                 "${libconf[@]}"
119 }
120
121 multilib_src_install_all() {
122         einstalldocs
123         prune_libtool_files --all
124
125         if use examples; then
126                 docinto examples
127                 dodoc doc/examples/*.c
128         fi
129 }