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