Add pinentry 0.9.7-r1 to test qt 5.7 edit
[portage-overlay.git] / app-crypt / pinentry / pinentry-0.9.7-r1.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 inherit autotools qmake-utils multilib eutils flag-o-matic toolchain-funcs
8
9 DESCRIPTION="Collection of simple PIN or passphrase entry dialogs which utilize the Assuan protocol"
10 HOMEPAGE="http://gnupg.org/aegypten2/index.html"
11 SRC_URI="mirror://gnupg/${PN}/${P}.tar.bz2"
12
13 LICENSE="GPL-2"
14 SLOT="0"
15 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~x86-interix ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
16 IUSE="emacs gtk ncurses qt4 qt5 caps gnome-keyring static"
17
18 CDEPEND="
19         >=dev-libs/libgpg-error-1.17
20         >=dev-libs/libassuan-2.1
21         >=dev-libs/libgcrypt-1.6.3
22         ncurses? ( sys-libs/ncurses:0= )
23         gtk? ( x11-libs/gtk+:2 )
24         qt4? (
25                 >=dev-qt/qtgui-4.4.1:4
26              )
27         qt5? (
28                 dev-qt/qtgui:5
29                 dev-qt/qtwidgets:5
30              )
31         caps? ( sys-libs/libcap )
32         static? ( >=sys-libs/ncurses-5.7-r5:0=[static-libs,-gpm] )
33         app-eselect/eselect-pinentry
34         gnome-keyring? ( app-crypt/libsecret )
35 "
36
37 DEPEND="${CDEPEND}
38         sys-devel/gettext
39         virtual/pkgconfig
40 "
41
42 RDEPEND="
43         ${CDEPEND}
44         gnome-keyring? ( app-crypt/gcr )
45 "
46
47 REQUIRED_USE="
48         || ( ncurses gtk qt4 qt5 )
49         gtk? ( !static )
50         qt4? ( !static )
51         qt5? ( !static )
52         static? ( ncurses )
53         ?? ( qt4 qt5 )
54 "
55
56 DOCS=( AUTHORS ChangeLog NEWS README THANKS TODO )
57
58 src_prepare() {
59         epatch "${FILESDIR}/${PN}-0.8.2-ncurses.patch"\
60                    "${FILESDIR}/${P}-require-CPP11-for-qt-5-7.patches"
61         eautoreconf
62 }
63
64 src_configure() {
65         local myconf=()
66         use static && append-ldflags -static
67         [[ "$(gcc-major-version)" -ge 5 ]] && append-cxxflags -std=gnu++11
68
69         QT_MOC=""
70         if use qt4; then
71                 myconf+=( --enable-pinentry-qt
72                           --disable-pinentry-qt5
73                         )
74                 QT_MOC="$(qt4_get_bindir)"/moc
75                 # Issues finding qt on multilib systems
76                 export QTLIB="$(qt4_get_libdir)"
77         elif use qt5; then
78                 myconf+=( --enable-pinentry-qt )
79                 QT_MOC="$(qt5_get_bindir)"/moc
80                 export QTLIB="$(qt5_get_libdir)"
81         else
82                 myconf+=( --disable-pinentry-qt )
83         fi
84
85         econf \
86                 --enable-pinentry-tty \
87                 $(use_enable emacs pinentry-emacs) \
88                 $(use_enable gtk pinentry-gtk2) \
89                 $(use_enable ncurses pinentry-curses) \
90                 $(use_enable ncurses fallback-curses) \
91                 $(use_with caps libcap) \
92                 $(use_enable gnome-keyring libsecret) \
93                 $(use_enable gnome-keyring pinentry-gnome3) \
94                 "${myconf[@]}" \
95                 MOC="${QT_MOC}"
96 }
97
98 src_install() {
99         default
100         rm -f "${ED}"/usr/bin/pinentry || die
101
102         if use qt4 || use qt5; then
103                 dosym pinentry-qt /usr/bin/pinentry-qt4
104         fi
105 }
106
107 pkg_postinst() {
108         if ! has_version 'app-crypt/pinentry' || has_version '<app-crypt/pinentry-0.7.3'; then
109                 elog "We no longer install pinentry-curses and pinentry-qt SUID root by default."
110                 elog "Linux kernels >=2.6.9 support memory locking for unprivileged processes."
111                 elog "The soft resource limit for memory locking specifies the limit an"
112                 elog "unprivileged process may lock into memory. You can also use POSIX"
113                 elog "capabilities to allow pinentry to lock memory. To do so activate the caps"
114                 elog "USE flag and add the CAP_IPC_LOCK capability to the permitted set of"
115                 elog "your users."
116         fi
117
118         eselect pinentry update ifunset
119 }
120
121 pkg_postrm() {
122         eselect pinentry update ifunset
123 }