net-libs/gnutls: cleanup
[gentoo.git] / net-libs / gnutls / gnutls-3.5.15.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="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
15 IUSE="+cxx dane doc examples guile +idn nls openpgp +openssl pkcs11 seccomp sslv2 sslv3 static-libs test test-full +tls-heartbeat tools valgrind zlib"
16
17 REQUIRED_USE="
18         test-full? ( guile pkcs11 openpgp openssl idn seccomp tools zlib )"
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         zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
32         idn? ( >=net-dns/libidn2-0.16-r1[${MULTILIB_USEDEP}] )
33         abi_x86_32? (
34                 !<=app-emulation/emul-linux-x86-baselibs-20140508
35                 !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
36         )"
37 DEPEND="${RDEPEND}
38         >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]
39         doc? ( dev-util/gtk-doc )
40         nls? ( sys-devel/gettext )
41         valgrind? ( dev-util/valgrind )
42         test? (
43                 seccomp? ( sys-libs/libseccomp )
44         )
45         test-full? (
46                 guile? ( >=dev-scheme/guile-2 )
47                 app-crypt/dieharder
48                 app-misc/datefudge
49                 dev-libs/softhsm:2[-bindist]
50                 net-dialup/ppp
51                 net-misc/socat
52         )"
53
54 DOCS=(
55         README.md
56         doc/certtool.cfg
57 )
58
59 HTML_DOCS=()
60
61 pkg_setup() {
62         # bug#520818
63         export TZ=UTC
64
65         use doc && HTML_DOCS+=(
66                 doc/gnutls.html
67         )
68 }
69
70 src_prepare() {
71         default
72
73         # force regeneration of autogen-ed files
74         local file
75         for file in $(grep -l AutoGen-ed src/*.c) ; do
76                 rm src/$(basename ${file} .c).{c,h} || die
77         done
78
79         # Use sane .so versioning on FreeBSD.
80         elibtoolize
81 }
82
83 multilib_src_configure() {
84         LINGUAS="${LINGUAS//en/en@boldquot en@quot}"
85
86         # remove magic of library detection
87         # bug#438222
88         local libconf=($("${S}/configure" --help | grep -- '--without-.*-prefix' | sed -e 's/^ *\([^ ]*\) .*/\1/g'))
89
90         # TPM needs to be tested before being enabled
91         libconf+=( --without-tpm )
92
93         # hardware-accell is disabled on OSX because the asm files force
94         #   GNU-stack (as doesn't support that) and when that's removed ld
95         #   complains about duplicate symbols
96         [[ ${CHOST} == *-darwin* ]] && libconf+=( --disable-hardware-acceleration )
97
98         # Cygwin as does not understand these asm files at all
99         [[ ${CHOST} == *-cygwin* ]] && libconf+=( --disable-hardware-acceleration )
100
101         ECONF_SOURCE=${S} econf \
102                 $(multilib_native_enable manpages) \
103                 $(multilib_native_use_enable doc gtk-doc) \
104                 $(multilib_native_use_enable doc) \
105                 $(multilib_native_use_enable guile) \
106                 $(multilib_native_use_enable seccomp seccomp-tests) \
107                 $(multilib_native_use_enable test tests) \
108                 $(multilib_native_use_enable test-full full-test-suite) \
109                 $(multilib_native_use_enable tools) \
110                 $(multilib_native_use_enable valgrind valgrind-tests) \
111                 $(use_enable cxx) \
112                 $(use_enable dane libdane) \
113                 $(use_enable nls) \
114                 $(use_enable openpgp openpgp-authentication) \
115                 $(use_enable openssl openssl-compatibility) \
116                 $(use_enable sslv2 ssl2-support) \
117                 $(use_enable sslv3 ssl3-support) \
118                 $(use_enable static-libs static) \
119                 $(use_enable tls-heartbeat heartbeat-support) \
120                 $(use_with idn libidn2) \
121                 $(use_with idn) \
122                 $(use_with pkcs11 p11-kit) \
123                 $(use_with zlib) \
124                 --with-unbound-root-key-file="${EPREFIX}/etc/dnssec/root-anchors.txt" \
125                 --without-included-libtasn1 \
126                 "${libconf[@]}"
127 }
128
129 multilib_src_install_all() {
130         einstalldocs
131         prune_libtool_files --all
132
133         if use examples; then
134                 docinto examples
135                 dodoc doc/examples/*.c
136         fi
137 }