82b1d6aabbb2bbf6b0437494855ea74422b000c9
[portage-overlay.git] / app-crypt / gnupg / gnupg-9999.ebuild
1 # Copyright 1999-2016 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 if [[ ${PV} == *9999* ]]; then
10         inherit autotools git-2
11 fi
12
13 DESCRIPTION="The GNU Privacy Guard, a GPL OpenPGP implementation"
14 HOMEPAGE="http://www.gnupg.org/"
15 LICENSE="GPL-3"
16
17 if [[ ${PV} != *9999* ]]; then
18         MY_P="${P/_/-}"
19         SRC_URI="mirror://gnupg/gnupg/${MY_P}.tar.bz2"
20         KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
21 else
22         KEYWORDS=""
23         EGIT_REPO_URI="git://git.gnupg.org/${PN}.git"
24 fi
25
26 SLOT="0"
27 IUSE="bzip2 doc +gnutls ldap nls readline selinux +smartcard tofu tools usb wks-server"
28
29 COMMON_DEPEND_LIBS="
30         >=dev-libs/npth-1.2
31         >=dev-libs/libassuan-2.4.3
32         >=dev-libs/libgcrypt-1.7.3
33         >=dev-libs/libgpg-error-1.24
34         >=dev-libs/libksba-1.3.4
35         >=net-misc/curl-7.10
36         gnutls? ( >=net-libs/gnutls-3.0:0= )
37         sys-libs/zlib
38         ldap? ( net-nds/openldap )
39         bzip2? ( app-arch/bzip2 )
40         readline? ( sys-libs/readline:0= )
41         smartcard? ( usb? ( virtual/libusb:0 ) )
42         tofu? ( >=dev-db/sqlite-3.7 )
43         "
44 COMMON_DEPEND_BINS="app-crypt/pinentry
45                    !app-crypt/dirmngr"
46
47 # Existence of executables is checked during configuration.
48 DEPEND="${COMMON_DEPEND_LIBS}
49         ${COMMON_DEPEND_BINS}
50         nls? ( sys-devel/gettext )
51         doc? ( sys-apps/texinfo )"
52
53 RDEPEND="${COMMON_DEPEND_LIBS}
54         ${COMMON_DEPEND_BINS}
55         selinux? ( sec-policy/selinux-gpg )
56         nls? ( virtual/libintl )"
57
58 S="${WORKDIR}/${MY_P}"
59
60 src_prepare() {
61         default
62         if [[ ${PV} == *9999* ]]; then
63                 epatch "${FILESDIR}"/${P}-tests-pkits-Makefile.am-Remove-failing-tests.patch
64         fi
65
66         epatch_user
67         if [[ ${PV} == *9999* ]]; then
68                 autoreconf || die
69                 ./autogen.sh || die
70         fi
71 }
72
73 src_configure() {
74         local myconf=()
75
76         if use smartcard; then
77                 myconf+=(
78                         --enable-scdaemon
79                         $(use_enable usb ccid-driver)
80                 )
81         else
82                 myconf+=( --disable-scdaemon )
83         fi
84
85         if use elibc_SunOS || use elibc_AIX; then
86                 myconf+=( --disable-symcryptrun )
87         else
88                 myconf+=( --enable-symcryptrun )
89         fi
90
91         # glib fails and picks up clang's internal stdint.h causing weird errors
92         [[ ${CC} == *clang ]] && \
93                 export gl_cv_absolute_stdint_h=/usr/include/stdint.h
94
95         maintainer_mode=""
96
97         if [[ ${PV} == *9999* ]]; then
98                 maintainer_mode+="--enable-maintainer-mode "
99         fi
100
101         econf \
102                 ${maintainer_mode} \
103                 --docdir="${EPREFIX}/usr/share/doc/${PF}" \
104                 --enable-gpg \
105                 --enable-gpgsm \
106                 --enable-large-secmem \
107                 --without-adns \
108                 "${myconf[@]}" \
109                 $(use_enable bzip2) \
110                 $(use_enable gnutls) \
111                 $(use_with ldap) \
112                 $(use_enable nls) \
113                 $(use_with readline) \
114                 $(use_enable tofu) \
115                 $(use_enable tools) \
116                 $(use_enable wks-server wks-tools) \
117                 CC_FOR_BUILD="$(tc-getBUILD_CC)"
118 }
119
120 src_compile() {
121         default
122
123         if use doc; then
124                 cd doc
125                 emake html
126         fi
127 }
128
129 src_install() {
130         default
131
132         use tools && dobin tools/{convert-from-106,gpg-check-pattern} \
133                 tools/{gpg-zip,gpgconf,gpgsplit,lspgpot,mail-signed-keys} \
134                 tools/make-dns-cert
135         emake DESTDIR="${D}" -f doc/Makefile uninstall-nobase_dist_docDATA
136
137         dodoc ChangeLog NEWS README THANKS TODO VERSION doc/FAQ doc/DETAILS \
138                 doc/HACKING doc/TRANSLATE doc/OpenPGP doc/KEYSERVER doc/help*
139
140         dosym gpg2 /usr/bin/gpg
141         dosym gpgv2 /usr/bin/gpgv
142         echo ".so man1/gpg2.1" > "${ED}"/usr/share/man/man1/gpg.1
143         echo ".so man1/gpgv2.1" > "${ED}"/usr/share/man/man1/gpgv.1
144
145         dodir /etc/env.d
146         echo "CONFIG_PROTECT=/usr/share/gnupg/qualified.txt" >> "${ED}"/etc/env.d/30gnupg
147
148         if use doc; then
149                 dohtml doc/gnupg.html/* doc/*.png
150         fi
151 }