58ff5f40942d70b8eb21e9981877243e8d41b315
[portage-overlay.git] / app-crypt / gnupg / gnupg-9999.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.ebuild,v 1.4 2014/11/09 01:42:34 k_f Exp $
4
5 EAPI="5"
6
7 inherit autotools eutils flag-o-matic toolchain-funcs git-2
8
9 DESCRIPTION="The GNU Privacy Guard, a GPL pgp replacement"
10 HOMEPAGE="http://www.gnupg.org/"
11
12 WANT_AUTOMAKE=1.14
13 EGIT_REPO_URI="git://git.gnupg.org/${PN}.git"
14
15 LICENSE="GPL-3"
16 SLOT="0"
17 KEYWORDS=""
18 IUSE="bzip2 doc +gnutls ldap nls readline static selinux smartcard tools usb"
19
20 RESTRICT="test"
21
22 COMMON_DEPEND_LIBS="
23         dev-libs/npth
24         >=dev-libs/libassuan-2
25         >=dev-libs/libgcrypt-1.6.2
26         >=dev-libs/libgpg-error-1.15
27         >=dev-libs/libksba-1.0.7
28         >=net-misc/curl-7.10
29         gnutls? ( >=net-libs/gnutls-3.0 )
30         sys-libs/zlib
31         ldap? ( net-nds/openldap )
32         bzip2? ( app-arch/bzip2 )
33         readline? ( sys-libs/readline )
34         smartcard? ( usb? ( virtual/libusb:0 ) )
35         "
36 COMMON_DEPEND_BINS="|| ( app-crypt/pinentry app-crypt/pinentry-qt )"
37
38 # Existence of executables is checked during configuration.
39 DEPEND="${COMMON_DEPEND_LIBS}
40         ${COMMON_DEPEND_BINS}
41         sys-devel/automake:1.14
42         static? (
43                 >=dev-libs/libassuan-2[static-libs]
44                 >=dev-libs/libgcrypt-1.4[static-libs]
45                 >=dev-libs/libgpg-error-1.7[static-libs]
46                 >=dev-libs/libksba-1.0.7[static-libs]
47                 >=dev-libs/pth-1.3.7[static-libs]
48                 >=net-misc/curl-7.10[static-libs]
49                 sys-libs/zlib[static-libs]
50                 bzip2? ( app-arch/bzip2[static-libs] )
51         )
52         nls? ( sys-devel/gettext )
53         doc? ( sys-apps/texinfo )"
54
55 RDEPEND="!static? ( ${COMMON_DEPEND_LIBS} )
56         ${COMMON_DEPEND_BINS}
57         !<=app-crypt/gnupg-2.0.1
58         selinux? ( sec-policy/selinux-gpg )
59         nls? ( virtual/libintl )"
60
61 REQUIRED_USE="smartcard? ( !static )"
62
63 S="${WORKDIR}/${MY_P}"
64
65 src_prepare() {
66         epatch "${FILESDIR}/${PN}-2.0.17-gpgsm-gencert.patch"
67         epatch_user
68         autoreconf || die "Autoreconf fail"
69         ./autogen.sh || die "Autgen script failed"
70 }
71
72 src_configure() {
73         local myconf=()
74
75         # 'USE=static' support was requested:
76         # gnupg1: bug #29299
77         # gnupg2: bug #159623
78         use static && append-ldflags -static
79
80         if use smartcard; then
81                 myconf+=(
82                         --enable-scdaemon
83                         $(use_enable usb ccid-driver)
84                 )
85         else
86                 myconf+=( --disable-scdaemon )
87         fi
88
89         if use elibc_SunOS || use elibc_AIX; then
90                 myconf+=( --disable-symcryptrun )
91         else
92                 myconf+=( --enable-symcryptrun )
93         fi
94
95         econf \
96                 --enable-maintainer-mode \
97                 --docdir="${EPREFIX}/usr/share/doc/${PF}" \
98                 --enable-gpg \
99                 --enable-gpgsm \
100                 --enable-agent \
101                 --without-adns \
102                 "${myconf[@]}" \
103                 $(use_enable bzip2) \
104                 $(use_enable gnutls) \
105                 $(use_with ldap) \
106                 $(use_enable nls) \
107                 $(use_with readline) \
108                 CC_FOR_BUILD="$(tc-getBUILD_CC)"
109 }
110
111 src_compile() {
112         default
113
114         if use doc; then
115                 cd doc
116                 emake html
117         fi
118 }
119
120 src_install() {
121         default
122
123         use tools && dobin tools/{convert-from-106,gpg-check-pattern} \
124                 tools/{gpg-zip,gpgconf,gpgsplit,lspgpot,mail-signed-keys,make-dns-cert}
125
126         emake DESTDIR="${D}" -f doc/Makefile uninstall-nobase_dist_docDATA
127         rm "${ED}"/usr/share/gnupg/help* || die
128
129         dodoc ChangeLog NEWS README THANKS TODO VERSION doc/FAQ doc/DETAILS \
130                 doc/HACKING doc/TRANSLATE doc/OpenPGP doc/KEYSERVER doc/help*
131
132         dosym gpg2 /usr/bin/gpg
133         dosym gpgv2 /usr/bin/gpgv
134         echo ".so man1/gpg2.1" > "${ED}"/usr/share/man/man1/gpg.1
135         echo ".so man1/gpgv2.1" > "${ED}"/usr/share/man/man1/gpgv.1
136
137         dodir /etc/env.d
138         echo "CONFIG_PROTECT=/usr/share/gnupg/qualified.txt" >> "${ED}"/etc/env.d/30gnupg
139
140         if use doc; then
141                 dohtml doc/gnupg.html/* doc/*.png
142         fi
143 }
144
145 pkg_postinst() {
146         elog "If you wish to view images emerge:"
147         elog "media-gfx/xloadimage, media-gfx/xli or any other viewer"
148         elog "Remember to use photo-viewer option in configuration file to activate"
149         elog "the right viewer."
150         elog
151
152         if use smartcard; then
153                 elog "To use your OpenPGP smartcard (or token) with GnuPG you need one of"
154                 use usb && elog " - a CCID-compatible reader, used directly through libusb;"
155                 elog " - sys-apps/pcsc-lite and a compatible reader device;"
156                 elog " - dev-libs/openct and a compatible reader device;"
157                 elog " - a reader device and drivers exporting either PC/SC or CT-API interfaces."
158                 elog ""
159                 elog "General hint: you probably want to try installing sys-apps/pcsc-lite and"
160                 elog "app-crypt/ccid first."
161         fi
162
163         ewarn "Please remember to restart gpg-agent if a different version"
164         ewarn "of the agent is currently used. If you are unsure of the gpg"
165         ewarn "agent you are using please run 'killall gpg-agent',"
166         ewarn "and to start a fresh daemon just run 'gpg-agent --daemon'."
167
168         if [[ -n ${REPLACING_VERSIONS} ]]; then
169                 elog "If upgrading from a version prior than 2.1 you will have to re-import"
170                 elog "secret keys after restarting the gpg-agent as the new version is using"
171                 elog "a new storage mechanism."
172                 elog "You can migrate the keys using gpg --import \$HOME/.gnupg/secring.gpg"
173         fi
174 }