diff --git a/dev-util/unicorn/unicorn-9999.ebuild b/dev-util/unicorn/unicorn-9999.ebuild index c5f1b2deb1ce3..6afc0cd70a648 100644 --- a/dev-util/unicorn/unicorn-9999.ebuild +++ b/dev-util/unicorn/unicorn-9999.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2024 Gentoo Authors +# Copyright 1999-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -8,6 +8,7 @@ MY_PV=${PV/_/-} DISTUTILS_USE_PEP517=setuptools DISTUTILS_OPTIONAL=1 PYTHON_COMPAT=( python3_{10..13} ) + inherit cmake distutils-r1 DESCRIPTION="A lightweight multi-platform, multi-architecture CPU emulator framework" @@ -25,7 +26,7 @@ S="${WORKDIR}/${PN}-${MY_PV}" LICENSE="BSD-2 GPL-2 LGPL-2.1" SLOT="0/2" -IUSE="logging python static-libs" +IUSE="logging python static-libs test" REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" DEPEND="${PYTHON_DEPS} @@ -34,6 +35,8 @@ RDEPEND="python? ( ${PYTHON_DEPS} )" BDEPEND="virtual/pkgconfig python? ( ${DISTUTILS_DEPS} )" +RESTRICT="!test? ( test )" + UNICORN_TARGETS="x86 arm aarch64 riscv mips sparc m68k ppc s390x tricore" wrap_python() { @@ -54,6 +57,7 @@ src_prepare() { cmake_src_prepare wrap_python ${FUNCNAME} + if use elibc_musl ; then QA_CONFIG_IMPL_DECL_SKIP=( malloc_trim ) fi @@ -63,6 +67,7 @@ src_configure(){ local mycmakeargs=( -DUNICORN_ARCH="${UNICORN_TARGETS// /;}" -DUNICORN_LOGGING=$(usex logging) + -DUNICORN_LEGACY_STATIC_ARCHIVE=$(usex static-libs) -DZIG_BUILD=OFF ) @@ -77,12 +82,23 @@ src_compile() { wrap_python ${FUNCNAME} } -src_install() { +src_test() { + cmake_src_install + + 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 - if ! use static-libs; then - find "${ED}" -type f \( -name "*.a" -o -name "*.la" \) -delete || die - fi - wrap_python ${FUNCNAME} }