blob: 2744cb9b8fa8c85f1f318eae9fc9d806234af3f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
MY_PV=${PV/_/-}
DISTUTILS_USE_PEP517=setuptools
DISTUTILS_OPTIONAL=1
PYTHON_COMPAT=( python3_{13..14} )
inherit cmake distutils-r1 toolchain-funcs
DESCRIPTION="A lightweight multi-platform, multi-architecture CPU emulator framework"
HOMEPAGE="https://www.unicorn-engine.org"
if [[ ${PV} == *9999 ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/unicorn-engine/unicorn"
else
SRC_URI="https://github.com/unicorn-engine/unicorn/archive/${MY_PV}.tar.gz -> ${P}.gh.tar.gz"
KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86"
fi
S="${WORKDIR}/${PN}-${MY_PV}"
LICENSE="BSD-2 GPL-2 LGPL-2.1"
SLOT="0/2"
IUSE="logging python static-libs test"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
DEPEND="${PYTHON_DEPS}
dev-libs/glib:2"
RDEPEND="python? ( ${PYTHON_DEPS} )"
BDEPEND="virtual/pkgconfig
python? (
${DISTUTILS_DEPS}
>=dev-python/setuptools-scm-8[${PYTHON_USEDEP}]
)"
RESTRICT="!test? ( test )"
UNICORN_TARGETS="x86 arm aarch64 riscv mips sparc m68k ppc s390x tricore"
export SETUPTOOLS_SCM_PRETEND_VERSION=${PV}
wrap_python() {
if use python; then
# src_prepare
# Do not compile C extensions
export LIBUNICORN_PATH=1
pushd bindings/python >/dev/null || die
distutils-r1_${1} "$@"
popd >/dev/null || die
fi
}
src_prepare() {
# Build from sources
rm -r bindings/python/prebuilt || die "failed to remove prebuilt files"
cmake_src_prepare
wrap_python ${FUNCNAME}
if use elibc_musl ; then
QA_CONFIG_IMPL_DECL_SKIP=( malloc_trim )
fi
}
src_configure(){
tc-export STRINGS
local mycmakeargs=(
-DUNICORN_ARCH="${UNICORN_TARGETS// /;}"
-DUNICORN_LOGGING=$(usex logging)
-DUNICORN_LEGACY_STATIC_ARCHIVE=$(usex static-libs)
-DZIG_BUILD=OFF
)
cmake_src_configure
wrap_python ${FUNCNAME}
}
src_compile() {
cmake_src_compile
wrap_python ${FUNCNAME}
}
src_test() {
cmake_src_test
wrap_python ${FUNCNAME}
}
python_test() {
# export LD_LIBRARY_PATH="${ED}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
for f in tests/test_*.py; do
if test -x ${f}; then
LD_LIBRARY_PATH="${ED}/usr/$(get_libdir)" ${EPYHTON} ${f} || die
fi
done
}
src_install() {
cmake_src_install
wrap_python ${FUNCNAME}
}
|