app-crypt/gnupg: Make gnutls-3 min req for 2.1
[portage-overlay.git] / app-crypt / gnupg / gnupg-2.1.0_beta783.ebuild
1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/app-crypt/gnupg/gnupg-2.1.0_beta751.ebuild,v 1.2 2014/07/25 03:53:22 zx2c4 Exp $
4
5 EAPI="5"
6
7 inherit eutils flag-o-matic toolchain-funcs
8
9 DESCRIPTION="The GNU Privacy Guard, a GPL pgp replacement"
10 HOMEPAGE="http://www.gnupg.org/"
11 MY_P="${P/_/-}"
12 SRC_URI="mirror://gnupg/gnupg/unstable/${MY_P}.tar.bz2"
13
14 LICENSE="GPL-3"
15 SLOT="0"
16 KEYWORDS=""
17 IUSE="bzip2 doc nls readline static selinux smartcard usb"
18
19 COMMON_DEPEND_LIBS="
20         dev-libs/npth
21         >=dev-libs/libassuan-2
22         >=dev-libs/libgcrypt-1.6.1
23         >=dev-libs/libgpg-error-1.13
24         >=dev-libs/libksba-1.0.7
25         >=net-misc/curl-7.10
26         >=net-libs/gnutls-3.0
27         sys-libs/zlib
28         net-nds/openldap
29         bzip2? ( app-arch/bzip2 )
30         readline? ( sys-libs/readline )
31         smartcard? ( usb? ( virtual/libusb:0 ) )
32         "
33 COMMON_DEPEND_BINS="|| ( app-crypt/pinentry app-crypt/pinentry-qt )"
34
35 # Existence of executables is checked during configuration.
36 DEPEND="${COMMON_DEPEND_LIBS}
37         ${COMMON_DEPEND_BINS}
38         static? (
39                 >=dev-libs/libassuan-2[static-libs]
40                 >=dev-libs/libgcrypt-1.4[static-libs]
41                 >=dev-libs/libgpg-error-1.7[static-libs]
42                 >=dev-libs/libksba-1.0.7[static-libs]
43                 >=dev-libs/pth-1.3.7[static-libs]
44                 >=net-misc/curl-7.10[static-libs]
45                 sys-libs/zlib[static-libs]
46                 bzip2? ( app-arch/bzip2[static-libs] )
47         )
48         nls? ( sys-devel/gettext )
49         doc? ( sys-apps/texinfo )"
50
51 RDEPEND="!static? ( ${COMMON_DEPEND_LIBS} )
52         ${COMMON_DEPEND_BINS}
53         !<=app-crypt/gnupg-2.0.1
54         selinux? ( sec-policy/selinux-gpg )
55         nls? ( virtual/libintl )"
56
57 REQUIRED_USE="smartcard? ( !static )"
58
59 S="${WORKDIR}/${MY_P}"
60
61 src_prepare() {
62         epatch "${FILESDIR}/${PN}-2.0.17-gpgsm-gencert.patch"
63         epatch_user
64 }
65
66 src_configure() {
67         local myconf=()
68
69         # 'USE=static' support was requested:
70         # gnupg1: bug #29299
71         # gnupg2: bug #159623
72         use static && append-ldflags -static
73
74         if use smartcard; then
75                 myconf+=(
76                         --enable-scdaemon
77                         $(use_enable usb ccid-driver)
78                 )
79         else
80                 myconf+=( --disable-scdaemon )
81         fi
82
83         if use elibc_SunOS || use elibc_AIX; then
84                 myconf+=( --disable-symcryptrun )
85         else
86                 myconf+=( --enable-symcryptrun )
87         fi
88
89         econf \
90                 --docdir="${EPREFIX}/usr/share/doc/${PF}" \
91                 --enable-gpg \
92                 --enable-gpgsm \
93                 --enable-agent \
94                 "${myconf[@]}" \
95                 $(use_enable bzip2) \
96                 $(use_enable nls) \
97                 $(use_with readline) \
98                 CC_FOR_BUILD="$(tc-getBUILD_CC)"
99 }
100
101 src_compile() {
102         default
103
104         if use doc; then
105                 cd doc
106                 emake html
107         fi
108 }
109
110 src_install() {
111         default
112
113         # bug#192151
114         dobin tools/gpgsplit tools/gpg-zip
115
116         emake DESTDIR="${D}" -f doc/Makefile uninstall-nobase_dist_docDATA
117         rm "${ED}"/usr/share/gnupg/help* || die
118
119         dodoc ChangeLog NEWS README THANKS TODO VERSION doc/FAQ doc/DETAILS \
120                 doc/HACKING doc/TRANSLATE doc/OpenPGP doc/KEYSERVER doc/help*
121
122         dosym gpg2 /usr/bin/gpg
123         dosym gpgv2 /usr/bin/gpgv
124         dosym gpg2keys_hkp /usr/libexec/gpgkeys_hkp
125         dosym gpg2keys_finger /usr/libexec/gpgkeys_finger
126         dosym gpg2keys_curl /usr/libexec/gpgkeys_curl
127         echo ".so man1/gpg2.1" > "${ED}"/usr/share/man/man1/gpg.1
128         echo ".so man1/gpgv2.1" > "${ED}"/usr/share/man/man1/gpgv.1
129
130         dodir /etc/env.d
131         echo "CONFIG_PROTECT=/usr/share/gnupg/qualified.txt" >> "${ED}"/etc/env.d/30gnupg
132
133         if use doc; then
134                 dohtml doc/gnupg.html/* doc/*.png
135         fi
136 }
137
138 pkg_postinst() {
139         elog "If you wish to view images emerge:"
140         elog "media-gfx/xloadimage, media-gfx/xli or any other viewer"
141         elog "Remember to use photo-viewer option in configuration file to activate"
142         elog "the right viewer."
143         elog
144
145         if use smartcard; then
146                 elog "To use your OpenPGP smartcard (or token) with GnuPG you need one of"
147                 use usb && elog " - a CCID-compatible reader, used directly through libusb;"
148                 elog " - sys-apps/pcsc-lite and a compatible reader device;"
149                 elog " - dev-libs/openct and a compatible reader device;"
150                 elog " - a reader device and drivers exporting either PC/SC or CT-API interfaces."
151                 elog ""
152                 elog "General hint: you probably want to try installing sys-apps/pcsc-lite and"
153                 elog "app-crypt/ccid first."
154         fi
155
156         ewarn "Please remember to restart gpg-agent if a different version"
157         ewarn "of the agent is currently used. If you are unsure of the gpg"
158         ewarn "agent you are using please run 'killall gpg-agent',"
159         ewarn "and to start a fresh daemon just run 'gpg-agent --daemon'."
160 }