dev-libs/botan: Fix installation of Python module
[gentoo.git] / dev-libs / botan / botan-2.14.0-r1.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=( python3_{6,7,8} )
7
8 MY_P="Botan-${PV}"
9 inherit python-r1 toolchain-funcs
10
11 DESCRIPTION="C++ crypto library"
12 HOMEPAGE="https://botan.randombit.net/"
13 SRC_URI="https://botan.randombit.net/releases/${MY_P}.tar.xz"
14
15 LICENSE="BSD"
16 SLOT="2/$(ver_cut 1-2)" # soname version
17 KEYWORDS="~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~ppc-macos"
18 IUSE="bindist bzip2 boost doc libressl lzma python sqlite ssl static-libs zlib"
19 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
20
21 S="${WORKDIR}/${MY_P}"
22
23 DEPEND="python? ( ${PYTHON_DEPS} )"
24 RDEPEND="${DEPEND}
25         boost? ( >=dev-libs/boost-1.48:= )
26         bzip2? ( >=app-arch/bzip2-1.0.5:= )
27         lzma? ( app-arch/xz-utils:= )
28         sqlite? ( dev-db/sqlite:3= )
29         ssl? (
30                 !libressl? ( dev-libs/openssl:0=[bindist=] )
31                 libressl? ( dev-libs/libressl:0= )
32         )
33         zlib? ( >=sys-libs/zlib-1.2.3:= )
34 "
35 BDEPEND="
36         dev-lang/python:*
37         doc? ( dev-python/sphinx )
38 "
39
40 src_configure() {
41         local disable_modules=()
42         use boost || disable_modules+=( "boost" )
43         use bindist && disable_modules+=( "ecdsa" )
44         elog "Disabling modules: ${disable_modules[@]}"
45
46         # Enable v9 instructions for sparc64
47         if [[ "${PROFILE_ARCH}" = "sparc64" ]]; then
48                 CHOSTARCH="sparc32-v9"
49         else
50                 CHOSTARCH="${CHOST%%-*}"
51         fi
52
53         local myos=
54         case ${CHOST} in
55                 *-darwin*) myos=darwin ;;
56                 *) myos=linux  ;;
57         esac
58
59         case ${CHOST} in
60                 hppa*) CHOSTARCH=parisc ;;
61         esac
62
63         local pythonvers=()
64         if use python; then
65                 append() {
66                         pythonvers+=( ${EPYTHON/python/} )
67                 }
68                 python_foreach_impl append
69         fi
70
71         # Don't install automatically, do it manually later in right place
72         # https://bugs.gentoo.org/723096
73         CXX="$(tc-getCXX)" AR="$(tc-getAR)" ./configure.py \
74                 $(use_enable static-libs static-library) \
75                 $(use_with boost) \
76                 $(use_with bzip2) \
77                 $(use_with doc documentation) \
78                 $(use_with doc sphinx) \
79                 $(use_with lzma) \
80                 $(use_with sqlite sqlite3) \
81                 $(use_with ssl openssl) \
82                 $(use_with zlib) \
83                 $(usex hppa --without-stack-protector '') \
84                 --cc=gcc \
85                 --cpu=${CHOSTARCH} \
86                 --disable-modules=$(IFS=","; echo "${disable_modules[*]}" ) \
87                 --docdir=share/doc \
88                 --libdir=$(get_libdir) \
89                 --os=${myos} \
90                 --prefix="${EPREFIX}/usr" \
91                 --with-endian="$(tc-endian)" \
92                 --with-python-version=$(IFS=","; echo "${pythonvers[*]}" ) \
93                 --without-doxygen \
94                 --no-install-python-module \
95                 || die "configure.py failed"
96 }
97
98 src_test() {
99         LD_LIBRARY_PATH="${S}" ./botan-test || die "Validation tests failed"
100 }
101
102 src_install() {
103         default
104         use python && python_foreach_impl python_domodule src/python/botan2.py
105 }