dev-libs/capstone: bump up to 4.0.2
[gentoo.git] / dev-libs / capstone / capstone-4.0.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 DISTUTILS_OPTIONAL=1
7 PYTHON_COMPAT=( python{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/4" # libcapstone.so.4
17 KEYWORDS="~amd64 ~arm ~arm64 ~x86"
18
19 RESTRICT="!test? ( test )"
20
21 IUSE="python test"
22 RDEPEND="python? ( ${PYTHON_DEPS} )"
23 DEPEND="${RDEPEND}
24         python? ( dev-python/setuptools[${PYTHON_USEDEP}] )
25 "
26 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
27
28 PATCHES=(
29         "${FILESDIR}"/${PN}-4.0-FLAGS.patch
30         "${FILESDIR}"/${PN}-4.0-no-fuzz-tests.patch
31 )
32
33 S=${WORKDIR}/${P/_rc/-rc}
34
35 wrap_python() {
36         if use python; then
37                 pushd bindings/python >/dev/null || die
38                 distutils-r1_${1} "$@"
39                 popd >/dev/null
40         fi
41 }
42
43 src_prepare() {
44         default
45
46         wrap_python ${FUNCNAME}
47 }
48
49 src_configure() {
50         {
51                 cat <<-EOF
52                 # Gentoo overrides:
53                 #   verbose build
54                 V = 1
55                 #   toolchain
56                 AR = $(tc-getAR)
57                 CC = $(tc-getCC)
58                 RANLIB = $(tc-getRANLIB)
59                 #  toolchain flags
60                 CFLAGS = ${CFLAGS}
61                 LDFLAGS = ${LDFLAGS}
62                 #  libs
63                 LIBDIRARCH = $(get_libdir)
64                 PREFIX = ${EPREFIX}/usr
65                 EOF
66         } >> config.mk || die
67
68         if ! use test; then
69                 # Don't build tests if not requested: bug #663006
70                 sed -i tests/Makefile -e 's@all: $(BINARY)@all:@' || die
71         fi
72
73         wrap_python ${FUNCNAME}
74 }
75
76 src_compile() {
77         default
78
79         wrap_python ${FUNCNAME}
80 }
81
82 src_test() {
83         default
84
85         wrap_python ${FUNCNAME}
86 }
87
88 src_install() {
89         default
90
91         wrap_python ${FUNCNAME}
92 }