*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / dev-libs / capstone / capstone-3.0.5_rc2-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 DISTUTILS_OPTIONAL=1
7 PYTHON_COMPAT=( python{2_7,3_6,3_7} )
8
9 inherit distutils-r1 toolchain-funcs
10
11 DESCRIPTION="disassembly/disassembler framework + bindings"
12 HOMEPAGE="http://www.capstone-engine.org/"
13 SRC_URI="https://github.com/aquynh/${PN}/archive/${PV/_rc/-rc}.tar.gz -> ${P}.tar.gz"
14
15 LICENSE="BSD"
16 SLOT="0/3" # libcapstone.so.3
17 KEYWORDS="~amd64 ~arm ~arm64 ~x86"
18
19 IUSE="python"
20 RDEPEND="python? ( ${PYTHON_DEPS} )"
21 DEPEND="${RDEPEND}
22         python? ( dev-python/setuptools[${PYTHON_USEDEP}] )
23 "
24 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
25
26 PATCHES=(
27         "${FILESDIR}"/${P}-CVE-2017-6952.patch
28         "${FILESDIR}"/${P}-FLAGS.patch
29 )
30
31 S=${WORKDIR}/${P/_rc/-rc}
32
33 wrap_python() {
34         if use python; then
35                 pushd bindings/python >/dev/null || die
36                 distutils-r1_${1} "$@"
37                 popd >/dev/null
38         fi
39 }
40
41 src_prepare() {
42         default
43
44         wrap_python ${FUNCNAME}
45 }
46
47 src_configure() {
48         {
49                 cat <<-EOF
50                 # Gentoo overrides:
51                 #   verbose build
52                 V = 1
53                 #   toolchain
54                 AR = $(tc-getAR)
55                 CC = $(tc-getCC)
56                 RANLIB = $(tc-getRANLIB)
57                 #  toolchain flags
58                 CFLAGS = ${CFLAGS}
59                 LDFLAGS = ${LDFLAGS}
60                 #  libs
61                 LIBDIRARCH = $(get_libdir)
62                 EOF
63         } >> config.mk || die
64
65         wrap_python ${FUNCNAME}
66 }
67
68 src_compile() {
69         default
70
71         wrap_python ${FUNCNAME}
72 }
73
74 src_test() {
75         default
76
77         wrap_python ${FUNCNAME}
78 }
79
80 src_install() {
81         default
82
83         wrap_python ${FUNCNAME}
84 }