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