app-crypt/acme: Remove old
[gentoo.git] / app-crypt / gnupg / gnupg-2.0.29-r1.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
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 SRC_URI="mirror://gnupg/gnupg/${P}.tar.bz2"
12 # SRC_URI="ftp://ftp.gnupg.org/gcrypt/${PN}/${P}.tar.bz2"
13
14 LICENSE="GPL-3"
15 SLOT="0"
16 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
17 IUSE="bzip2 doc ldap nls mta readline static selinux smartcard tools usb"
18
19 COMMON_DEPEND_LIBS="
20         >=dev-libs/libassuan-2
21         >=dev-libs/libgcrypt-1.5:0=
22         >=dev-libs/libgpg-error-1.19
23         >=dev-libs/libksba-1.0.7
24         >=dev-libs/pth-1.3.7
25         >=net-misc/curl-7.10
26         sys-libs/zlib
27         bzip2? ( app-arch/bzip2 )
28         readline? ( sys-libs/readline )
29         smartcard? ( usb? ( virtual/libusb:0 ) )
30         ldap? ( net-nds/openldap )"
31 COMMON_DEPEND_BINS="app-crypt/pinentry"
32
33 # Existence of executables is checked during configuration.
34 DEPEND="${COMMON_DEPEND_LIBS}
35         ${COMMON_DEPEND_BINS}
36         static? (
37                 >=dev-libs/libassuan-2[static-libs]
38                 >=dev-libs/libgcrypt-1.4:0=[static-libs]
39                 >=dev-libs/libgpg-error-1.11[static-libs]
40                 >=dev-libs/libksba-1.0.7[static-libs]
41                 >=dev-libs/pth-1.3.7[static-libs]
42                 >=net-misc/curl-7.10[static-libs]
43                 sys-libs/zlib[static-libs]
44                 bzip2? ( app-arch/bzip2[static-libs] )
45         )
46         nls? ( sys-devel/gettext )
47         doc? ( sys-apps/texinfo )"
48
49 RDEPEND="!static? ( ${COMMON_DEPEND_LIBS} )
50         ${COMMON_DEPEND_BINS}
51         mta? ( virtual/mta )
52         !<=app-crypt/gnupg-2.0.1
53         selinux? ( sec-policy/selinux-gpg )
54         nls? ( virtual/libintl )"
55
56 REQUIRED_USE="smartcard? ( !static )"
57
58 src_prepare() {
59         epatch "${FILESDIR}/${PN}-2.0.17-gpgsm-gencert.patch"
60         epatch_user
61 }
62
63 src_configure() {
64         local myconf=()
65
66         # 'USE=static' support was requested:
67         # gnupg1: bug #29299
68         # gnupg2: bug #159623
69         use static && append-ldflags -static
70
71         if use smartcard; then
72                 myconf+=(
73                         --enable-scdaemon
74                         $(use_enable usb ccid-driver)
75                 )
76         else
77                 myconf+=( --disable-scdaemon )
78         fi
79
80         if use elibc_SunOS || use elibc_AIX; then
81                 myconf+=( --disable-symcryptrun )
82         else
83                 myconf+=( --enable-symcryptrun )
84         fi
85
86         # glib fails and picks up clang's internal stdint.h causing weird errors
87         [[ ${CC} == *clang ]] && \
88                 export gl_cv_absolute_stdint_h=/usr/include/stdint.h
89
90         econf \
91                 --docdir="${EPREFIX}/usr/share/doc/${PF}" \
92                 --enable-gpg \
93                 --enable-gpgsm \
94                 --enable-agent \
95                 --enable-large-secmem \
96                 --without-adns \
97                 "${myconf[@]}" \
98                 $(use_enable bzip2) \
99                 $(use_enable nls) \
100                 $(use_enable mta mailto) \
101                 $(use_enable ldap) \
102                 $(use_with readline) \
103                 CC_FOR_BUILD="$(tc-getBUILD_CC)"
104 }
105
106 src_compile() {
107         default
108
109         if use doc; then
110                 cd doc
111                 emake html
112         fi
113 }
114
115 src_install() {
116         default
117
118         use tools && dobin tools/{convert-from-106,gpg-check-pattern} \
119                 tools/{gpg-zip,gpgconf,gpgsplit,lspgpot,mail-signed-keys,make-dns-cert}
120
121         emake DESTDIR="${D}" -f doc/Makefile uninstall-nobase_dist_docDATA
122         # The help*txt files are read from the datadir by GnuPG directly.
123         # They do not work if compressed or moved!
124         #rm "${ED}"/usr/share/gnupg/help* || die
125
126         dodoc ChangeLog NEWS README THANKS TODO VERSION doc/FAQ doc/DETAILS \
127                 doc/HACKING doc/TRANSLATE doc/OpenPGP doc/KEYSERVER doc/help*
128
129         dosym gpg2 /usr/bin/gpg
130         dosym gpgv2 /usr/bin/gpgv
131         dosym gpg2keys_hkp /usr/libexec/gpgkeys_hkp
132         dosym gpg2keys_finger /usr/libexec/gpgkeys_finger
133         dosym gpg2keys_curl /usr/libexec/gpgkeys_curl
134         if use ldap; then
135                 dosym gpg2keys_ldap /usr/libexec/gpgkeys_ldap
136         fi
137         echo ".so man1/gpg2.1" > "${ED}"/usr/share/man/man1/gpg.1
138         echo ".so man1/gpgv2.1" > "${ED}"/usr/share/man/man1/gpgv.1
139
140         dodir /etc/env.d
141         echo "CONFIG_PROTECT=/usr/share/gnupg/qualified.txt" >> "${ED}"/etc/env.d/30gnupg
142
143         if use doc; then
144                 dohtml doc/gnupg.html/* doc/*.png
145         fi
146 }
147
148 pkg_postinst() {
149         elog "If you wish to view images emerge:"
150         elog "media-gfx/xloadimage, media-gfx/xli or any other viewer"
151         elog "Remember to use photo-viewer option in configuration file to activate"
152         elog "the right viewer."
153         elog
154
155         if use smartcard; then
156                 elog "To use your OpenPGP smartcard (or token) with GnuPG you need one of"
157                 use usb && elog " - a CCID-compatible reader, used directly through libusb;"
158                 elog " - sys-apps/pcsc-lite and a compatible reader device;"
159                 elog " - dev-libs/openct and a compatible reader device;"
160                 elog " - a reader device and drivers exporting either PC/SC or CT-API interfaces."
161                 elog ""
162                 elog "General hint: you probably want to try installing sys-apps/pcsc-lite and"
163                 elog "app-crypt/ccid first."
164         fi
165
166         ewarn "Please remember to restart gpg-agent if a different version"
167         ewarn "of the agent is currently used. If you are unsure of the gpg"
168         ewarn "agent you are using please run 'killall gpg-agent',"
169         ewarn "and to start a fresh daemon just run 'gpg-agent --daemon'."
170 }