From 4482e4cbc3ce6a09de78e5437ada2e4a908c6345 Mon Sep 17 00:00:00 2001 From: Mario Haustein Date: Sun, 29 Sep 2024 22:12:20 +0200 Subject: [PATCH] dev-util/unicorn: add 2.1.1 Signed-off-by: Mario Haustein Signed-off-by: Sam James --- dev-util/unicorn/Manifest | 1 + dev-util/unicorn/metadata.xml | 3 + dev-util/unicorn/unicorn-2.1.1.ebuild | 92 +++++++++++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 dev-util/unicorn/unicorn-2.1.1.ebuild diff --git a/dev-util/unicorn/Manifest b/dev-util/unicorn/Manifest index 7fc46933a0acb..fe438d78e2c7d 100644 --- a/dev-util/unicorn/Manifest +++ b/dev-util/unicorn/Manifest @@ -1 +1,2 @@ DIST unicorn-2.0.1.gh.tar.gz 4070004 BLAKE2B 4ab8f92367e7df5762d29ed58dfff524f59053e28548b170b982d16988eea16df46851d2ea559d8beabb4f1315e5ee627f9ded755a4f3b1cfd6d863a50c633b6 SHA512 4249d33d38614ea1ca51e38c7838cb276306100aa44c65ad1b3e39304e4b856ac643a9c6f9d13678fc07bea58989a08b64653d17afe9e62bcef2936ba63e1b1f +DIST unicorn-2.1.1.gh.tar.gz 4176172 BLAKE2B 3dd434121418b9a4eb69683cfca6ec0cd019b632492fbfff421eaf26f4907a2f30bf78699b3afe28df624037e3973a5110a6ea21bd233e66a04a689d3e3e5d1c SHA512 d6184b87a0fb729397ec2ac2cb8bfd9d10c9d4276e49efa681c66c7c54d1a325305a920332a708e68989cc299d0d1a543a1ceeaf552a9b44ec93084f7bf85ef2 diff --git a/dev-util/unicorn/metadata.xml b/dev-util/unicorn/metadata.xml index 0585a8a2d9d37..50bfe9d497144 100644 --- a/dev-util/unicorn/metadata.xml +++ b/dev-util/unicorn/metadata.xml @@ -9,6 +9,9 @@ sam@gentoo.org Sam James + + Enable logging + unicorn-engine/unicorn unicorn diff --git a/dev-util/unicorn/unicorn-2.1.1.ebuild b/dev-util/unicorn/unicorn-2.1.1.ebuild new file mode 100644 index 0000000000000..65e1adba73c38 --- /dev/null +++ b/dev-util/unicorn/unicorn-2.1.1.ebuild @@ -0,0 +1,92 @@ +# Copyright 1999-2024 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_{10..13} ) +inherit cmake distutils-r1 + +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" +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" + +DEPEND="${PYTHON_DEPS} + dev-libs/glib:2" +RDEPEND="python? ( ${PYTHON_DEPS} )" +BDEPEND="virtual/pkgconfig + python? ( ${DISTUTILS_DEPS} )" + +UNICORN_TARGETS="x86 arm aarch64 riscv mips sparc m68k ppc s390x tricore" + +# suppress warning wrt 'implicit function declaration' in config logs due to +# auto-detection of some libc functions (bug #906919) +QA_CONFIG_IMPL_DECL_SKIP=( + clock_adjtime + malloc_trim +) + +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} +} + +src_configure(){ + local mycmakeargs=( + -DUNICORN_ARCH="${UNICORN_TARGETS// /;}" + -DUNICORN_LOGGING=$(usex logging) + -DZIG_BUILD=OFF + ) + + cmake_src_configure + + wrap_python ${FUNCNAME} +} + +src_compile() { + cmake_src_compile + + wrap_python ${FUNCNAME} +} + +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} +}