*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / app-crypt / gpgme / gpgme-1.13.1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 PYTHON_COMPAT=( python2_7 python3_{6,7} )
7 DISTUTILS_OPTIONAL=1
8
9 inherit distutils-r1 flag-o-matic libtool qmake-utils toolchain-funcs
10
11 DESCRIPTION="GnuPG Made Easy is a library for making GnuPG easier to use"
12 HOMEPAGE="http://www.gnupg.org/related_software/gpgme"
13 SRC_URI="mirror://gnupg/gpgme/${P}.tar.bz2"
14
15 LICENSE="GPL-2 LGPL-2.1"
16 SLOT="1/11" # subslot = soname major version
17 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
18 IUSE="common-lisp static-libs cxx python qt5"
19
20 COMMON_DEPEND=">=app-crypt/gnupg-2
21         >=dev-libs/libassuan-2.5.3:=
22         >=dev-libs/libgpg-error-1.29:=
23         python? ( ${PYTHON_DEPS} )
24         qt5? ( dev-qt/qtcore:5 )"
25         #doc? ( app-doc/doxygen[dot] )
26 DEPEND="${COMMON_DEPEND}
27         qt5? ( dev-qt/qttest:5 )"
28 RDEPEND="${COMMON_DEPEND}
29         cxx? (
30                 !<kde-apps/gpgmepp-4.14.11_pre20160611:4
31                 !kde-apps/gpgmepp:5
32                 !<kde-apps/kdepimlibs-4.14.10_p20160611:4
33                 !=kde-apps/kdepimlibs-4.14.11_pre20160211*:4
34         )"
35 BDEPEND="python? ( dev-lang/swig )"
36
37 REQUIRED_USE="qt5? ( cxx ) python? ( ${PYTHON_REQUIRED_USE} )"
38
39 do_python() {
40         if use python; then
41                 pushd "lang/python" > /dev/null || die
42                 top_builddir="../.." srcdir="." CPP=$(tc-getCPP) distutils-r1_src_${EBUILD_PHASE}
43                 popd > /dev/null
44         fi
45 }
46
47 pkg_setup() {
48         addpredict /run/user/$(id -u)/gnupg
49
50         local MAX_WORKDIR=66
51         if [[ "${#WORKDIR}" -gt "${MAX_WORKDIR}" ]]; then
52                 ewarn "Disabling tests as WORKDIR '${WORKDIR}' is longer than ${MAX_WORKDIR} which will fail tests"
53                 SKIP_TESTS=1
54         fi
55 }
56
57 src_prepare() {
58         default
59         elibtoolize
60
61         # Make best effort to allow longer PORTAGE_TMPDIR
62         # as usock limitation fails build/tests
63         ln -s "${P}" "${WORKDIR}/b"
64         S="${WORKDIR}/b"
65 }
66
67 src_configure() {
68         local languages=()
69         use common-lisp && languages+=( "cl" )
70         use cxx && languages+=( "cpp" )
71         if use qt5; then
72                 languages+=( "qt" )
73                 #use doc ||
74                 export DOXYGEN=true
75                 export MOC="$(qt5_get_bindir)/moc"
76         fi
77
78         econf \
79                 $([[ -n "${SKIP_TESTS}" ]] && echo "--disable-gpg-test --disable-gpgsm-test") \
80                 --enable-languages="${languages[*]}" \
81                 $(use_enable static-libs static)
82
83         use python && make -C lang/python prepare
84
85         do_python
86 }
87
88 src_compile() {
89         default
90         do_python
91 }
92
93 src_test() {
94         [[ -z "${SKIP_TESTS}" ]] || return
95
96         default
97         if use python; then
98                 test_python() {
99                         emake -C lang/python/tests check \
100                                 PYTHON=${EPYTHON} \
101                                 PYTHONS=${EPYTHON} \
102                                 TESTFLAGS="--python-libdir=${BUILD_DIR}/lib"
103                 }
104                 python_foreach_impl test_python
105         fi
106 }
107
108 src_install() {
109         default
110         do_python
111         find "${D}" -name '*.la' -delete || die
112
113         # backward compatibility for gentoo
114         # in the past we had slots
115         dodir /usr/include/gpgme
116         dosym ../gpgme.h /usr/include/gpgme/gpgme.h
117 }