4630c055e55ce5af1449512106f7056458deaab9
[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_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                 --without-adns \
100                 "${myconf[@]}" \
101                 $(use_enable bzip2) \
102                 $(use_enable gnutls) \
103                 $(use_with ldap) \
104                 $(use_enable nls) \
105                 $(use_with readline) \
106                 CC_FOR_BUILD="$(tc-getBUILD_CC)"
107 }
108
109 src_compile() {
110         default
111
112         if use doc; then
113                 cd doc
114                 emake html
115         fi
116 }
117
118 src_install() {
119         default
120
121         use tools && dobin tools/{convert-from-106,gpg-check-pattern} \
122                 tools/{gpg-zip,gpgconf,gpgsplit,lspgpot,mail-signed-keys,make-dns-cert}
123
124         emake DESTDIR="${D}" -f doc/Makefile uninstall-nobase_dist_docDATA
125         rm "${ED}"/usr/share/gnupg/help* || die
126
127         dodoc ChangeLog NEWS README THANKS TODO VERSION doc/FAQ doc/DETAILS \
128                 doc/HACKING doc/TRANSLATE doc/OpenPGP doc/KEYSERVER doc/help*
129
130         dosym gpg2 /usr/bin/gpg
131         dosym gpgv2 /usr/bin/gpgv
132         echo ".so man1/gpg2.1" > "${ED}"/usr/share/man/man1/gpg.1
133         echo ".so man1/gpgv2.1" > "${ED}"/usr/share/man/man1/gpgv.1
134
135         dodir /etc/env.d
136         echo "CONFIG_PROTECT=/usr/share/gnupg/qualified.txt" >> "${ED}"/etc/env.d/30gnupg
137
138         if use doc; then
139                 dohtml doc/gnupg.html/* doc/*.png
140         fi
141 }
142
143 pkg_postinst() {
144         elog "If you wish to view images emerge:"
145         elog "media-gfx/xloadimage, media-gfx/xli or any other viewer"
146         elog "Remember to use photo-viewer option in configuration file to activate"
147         elog "the right viewer."
148         elog
149
150         if use smartcard; then
151                 elog "To use your OpenPGP smartcard (or token) with GnuPG you need one of"
152                 use usb && elog " - a CCID-compatible reader, used directly through libusb;"
153                 elog " - sys-apps/pcsc-lite and a compatible reader device;"
154                 elog " - dev-libs/openct and a compatible reader device;"
155                 elog " - a reader device and drivers exporting either PC/SC or CT-API interfaces."
156                 elog ""
157                 elog "General hint: you probably want to try installing sys-apps/pcsc-lite and"
158                 elog "app-crypt/ccid first."
159         fi
160
161         ewarn "Please remember to restart gpg-agent if a different version"
162         ewarn "of the agent is currently used. If you are unsure of the gpg"
163         ewarn "agent you are using please run 'killall gpg-agent',"
164         ewarn "and to start a fresh daemon just run 'gpg-agent --daemon'."
165
166         if [[ -n ${REPLACING_VERSIONS} ]]; then
167                 elog "If upgrading from a version prior than 2.1 you will have to re-import"
168                 elog "secret keys after restarting the gpg-agent as the new version is using"
169                 elog "a new storage mechanism."
170                 elog "You can migrate the keys using gpg --import \$HOME/.gnupg/secring.gpg"
171         fi
172 }