commit:     01ebafa57018c481d63c32e794217e5d721fa724
Author:     Kristian Fiskerstrand <k_f <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 11 19:01:52 2016 +0000
Commit:     Kristian Fiskerstrand <k_f <AT> gentoo <DOT> org>
CommitDate: Thu Aug 11 19:02:29 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=01ebafa5

app-crypt/pinentry: Use -std=c++11 if using Qt >= 5.7

Gentoo-Bug: 587764

Package-Manager: portage-2.3.0

 ...pinentry-0.9.7-require-CPP11-for-qt-5-7.patches |  48 ++++++++
 app-crypt/pinentry/pinentry-0.9.7-r1.ebuild        | 123 +++++++++++++++++++++
 2 files changed, 171 insertions(+)

diff --git 
a/app-crypt/pinentry/files/pinentry-0.9.7-require-CPP11-for-qt-5-7.patches 
b/app-crypt/pinentry/files/pinentry-0.9.7-require-CPP11-for-qt-5-7.patches
new file mode 100644
index 0000000..406571c
--- /dev/null
+++ b/app-crypt/pinentry/files/pinentry-0.9.7-require-CPP11-for-qt-5-7.patches
@@ -0,0 +1,48 @@
+From 7384e2a575dde2809784d9f182fd1d247064c8a2 Mon Sep 17 00:00:00 2001
+From: Kristian Fiskerstrand <[email protected]>
+Date: Thu, 11 Aug 2016 14:44:37 +0200
+Subject: [PATCH] Qt: Append -std=c++11 if building against Qt 5.7
+
+ * m4/qt.m4: Append -std=c++11 to CFLAGS if building against Qt 5.7
+
+--
+Qt 5.7 enables C++11 for Qt modules, and any app relying on it require to be
+compiled with at least this standard.
+
+This patch adds detection for Qt 5.7 and make sure -std=c++11 is passed if
+building against Qt 5.7 or higher.
+---
+ m4/qt.m4 | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/m4/qt.m4 b/m4/qt.m4
+index 093f428..90c4a6e 100644
+--- a/m4/qt.m4
++++ b/m4/qt.m4
+@@ -35,6 +35,7 @@ AC_DEFUN([FIND_QT],
+                 enable_pinentry_qt5="try")
+ 
+   have_qt5_libs="no";
++  require_qt_cpp11="no";
+ 
+   if test "$enable_pinentry_qt5" != "no"; then
+     PKG_CHECK_MODULES(PINENTRY_QT,
+@@ -47,6 +48,15 @@ AC_DEFUN([FIND_QT],
+     fi
+   fi
+   if test "$have_qt5_libs" = "yes"; then
++    PKG_CHECK_MODULES(PINENTRY_QT_REQUIRE_CPP11,
++                      Qt5Core >= 5.7.0,
++                      [require_qt_cpp11="yes"],
++                      [require_qt_cpp11="no"])
++
++    if test "${require_qt_cpp11}" = "yes"; then
++      PINENTRY_QT_CFLAGS="$PINENTRY_QT_CFLAGS -std=c++11"
++    fi
++
+     AC_CHECK_TOOL(MOC, moc)
+     AC_MSG_CHECKING([moc version])
+     mocversion=`$MOC -v 2>&1`
+-- 
+2.7.3
+

diff --git a/app-crypt/pinentry/pinentry-0.9.7-r1.ebuild 
b/app-crypt/pinentry/pinentry-0.9.7-r1.ebuild
new file mode 100644
index 0000000..d97fc6b
--- /dev/null
+++ b/app-crypt/pinentry/pinentry-0.9.7-r1.ebuild
@@ -0,0 +1,123 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit autotools qmake-utils multilib eutils flag-o-matic toolchain-funcs
+
+DESCRIPTION="Simple passphrase entry dialogs which utilize the Assuan protocol"
+HOMEPAGE="http://gnupg.org/aegypten2/index.html";
+SRC_URI="mirror://gnupg/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+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"
+IUSE="emacs gtk ncurses qt4 qt5 caps gnome-keyring static"
+
+CDEPEND="
+       >=dev-libs/libgpg-error-1.17
+       >=dev-libs/libassuan-2.1
+       >=dev-libs/libgcrypt-1.6.3
+       ncurses? ( sys-libs/ncurses:0= )
+       gtk? ( x11-libs/gtk+:2 )
+       qt4? (
+               >=dev-qt/qtgui-4.4.1:4
+            )
+       qt5? (
+               dev-qt/qtgui:5
+               dev-qt/qtwidgets:5
+            )
+       caps? ( sys-libs/libcap )
+       static? ( >=sys-libs/ncurses-5.7-r5:0=[static-libs,-gpm] )
+       app-eselect/eselect-pinentry
+       gnome-keyring? ( app-crypt/libsecret )
+"
+
+DEPEND="${CDEPEND}
+       sys-devel/gettext
+       virtual/pkgconfig
+"
+
+RDEPEND="
+       ${CDEPEND}
+       gnome-keyring? ( app-crypt/gcr )
+"
+
+REQUIRED_USE="
+       || ( ncurses gtk qt4 qt5 )
+       gtk? ( !static )
+       qt4? ( !static )
+       qt5? ( !static )
+       static? ( ncurses )
+       ?? ( qt4 qt5 )
+"
+
+DOCS=( AUTHORS ChangeLog NEWS README THANKS TODO )
+
+src_prepare() {
+       epatch "${FILESDIR}/${PN}-0.8.2-ncurses.patch"\
+                  "${FILESDIR}/${P}-require-CPP11-for-qt-5-7.patches"
+       eautoreconf
+}
+
+src_configure() {
+       local myconf=()
+       use static && append-ldflags -static
+       [[ "$(gcc-major-version)" -ge 5 ]] && append-cxxflags -std=gnu++11
+
+       QT_MOC=""
+       if use qt4; then
+               myconf+=( --enable-pinentry-qt
+                         --disable-pinentry-qt5
+                       )
+               QT_MOC="$(qt4_get_bindir)"/moc
+               # Issues finding qt on multilib systems
+               export QTLIB="$(qt4_get_libdir)"
+       elif use qt5; then
+               myconf+=( --enable-pinentry-qt )
+               QT_MOC="$(qt5_get_bindir)"/moc
+               export QTLIB="$(qt5_get_libdir)"
+       else
+               myconf+=( --disable-pinentry-qt )
+       fi
+
+       econf \
+               --enable-pinentry-tty \
+               $(use_enable emacs pinentry-emacs) \
+               $(use_enable gtk pinentry-gtk2) \
+               $(use_enable ncurses pinentry-curses) \
+               $(use_enable ncurses fallback-curses) \
+               $(use_with caps libcap) \
+               $(use_enable gnome-keyring libsecret) \
+               $(use_enable gnome-keyring pinentry-gnome3) \
+               "${myconf[@]}" \
+               MOC="${QT_MOC}"
+}
+
+src_install() {
+       default
+       rm -f "${ED}"/usr/bin/pinentry || die
+
+       if use qt4 || use qt5; then
+               dosym pinentry-qt /usr/bin/pinentry-qt4
+       fi
+}
+
+pkg_postinst() {
+       if ! has_version 'app-crypt/pinentry' || has_version 
'<app-crypt/pinentry-0.7.3'; then
+               elog "We no longer install pinentry-curses and pinentry-qt SUID 
root by default."
+               elog "Linux kernels >=2.6.9 support memory locking for 
unprivileged processes."
+               elog "The soft resource limit for memory locking specifies the 
limit an"
+               elog "unprivileged process may lock into memory. You can also 
use POSIX"
+               elog "capabilities to allow pinentry to lock memory. To do so 
activate the caps"
+               elog "USE flag and add the CAP_IPC_LOCK capability to the 
permitted set of"
+               elog "your users."
+       fi
+
+       eselect pinentry update ifunset
+}
+
+pkg_postrm() {
+       eselect pinentry update ifunset
+}

Reply via email to