*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / dev-libs / botan / botan-2.9.0.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5 PYTHON_COMPAT=( python{2_7,3_6} )
6
7 inherit multilib python-r1 toolchain-funcs
8
9 MY_PN="Botan"
10 MY_P="${MY_PN}-${PV}"
11 DESCRIPTION="A C++ crypto library"
12 HOMEPAGE="https://botan.randombit.net/"
13 SRC_URI="https://botan.randombit.net/releases/${MY_P}.tgz"
14
15 KEYWORDS="amd64 ~arm hppa ~ia64 ppc ppc64 ~sparc x86 ~ppc-macos"
16 SLOT="2/$(ver_cut 1-2)" # soname version
17 LICENSE="BSD"
18 IUSE="bindist doc boost python bzip2 libressl lzma 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         bzip2? ( >=app-arch/bzip2-1.0.5:= )
26         zlib? ( >=sys-libs/zlib-1.2.3:= )
27         boost? ( >=dev-libs/boost-1.48:= )
28         lzma? ( app-arch/xz-utils:= )
29         sqlite? ( dev-db/sqlite:3= )
30         ssl? (
31                 !libressl? ( dev-libs/openssl:0=[bindist=] )
32                 libressl? ( dev-libs/libressl:0= )
33         )"
34 BDEPEND="dev-lang/python:*
35         doc? ( dev-python/sphinx )"
36
37 PATCHES=(
38         "${FILESDIR}/${P}-build.patch"
39 )
40
41 src_configure() {
42         local disable_modules=()
43         use boost || disable_modules+=( "boost" )
44         use bindist && disable_modules+=( "ecdsa" )
45         elog "Disabling modules: ${disable_modules[@]}"
46
47         # Enable v9 instructions for sparc64
48         if [[ "${PROFILE_ARCH}" = "sparc64" ]]; then
49                 CHOSTARCH="sparc32-v9"
50         else
51                 CHOSTARCH="${CHOST%%-*}"
52         fi
53
54         local myos=
55         case ${CHOST} in
56                 *-darwin*)      myos=darwin ;;
57                 *)                      myos=linux  ;;
58         esac
59
60         case ${CHOST} in
61                 hppa*)          CHOSTARCH=parisc ;;
62         esac
63
64         local pythonvers=()
65         if use python; then
66                 append() {
67                         pythonvers+=( ${EPYTHON/python/} )
68                 }
69                 python_foreach_impl append
70         fi
71
72         CXX="$(tc-getCXX)" AR="$(tc-getAR)" ./configure.py \
73                 $(use_enable static-libs static-library) \
74                 $(use_with boost) \
75                 $(use_with bzip2) \
76                 $(use_with doc documentation) \
77                 $(use_with doc sphinx) \
78                 $(use_with lzma) \
79                 $(use_with sqlite sqlite3) \
80                 $(use_with ssl openssl) \
81                 $(use_with zlib) \
82                 $(usex hppa --without-stack-protector '') \
83                 --cc=gcc \
84                 --cpu=${CHOSTARCH} \
85                 --disable-modules=$(IFS=","; echo "${disable_modules[*]}" ) \
86                 --docdir=share/doc \
87                 --libdir=$(get_libdir) \
88                 --os=${myos} \
89                 --prefix="${EPREFIX}/usr" \
90                 --with-endian="$(tc-endian)" \
91                 --with-python-version=$(IFS=","; echo "${pythonvers[*]}" ) \
92                 --without-doxygen \
93                 || die "configure.py failed"
94 }
95
96 src_test() {
97         LD_LIBRARY_PATH="${S}" ./botan-test || die "Validation tests failed"
98 }
99
100 src_install() {
101         default
102         use python && python_foreach_impl python_optimize
103 }