Files
haikuports/dev-libs/unicorn/unicorn-2.0.1.recipe
OscarL 5f13224eea unicorn: cleanup, x86 python binding related fixes. (#8641)
* unicorn: recipe clean up.

Also, minor patch to the Python bindings code.

Co-authored-by: Schrijvers Luc <begasus@gmail.com>
Co-authored-by: Oscar Lesta <oscar.lesta@gmail.com>

* unicorn: Use same lib path patch as upstream

* unicorn: no need to provide _x86 python package

* unicorn: mark x86 as tested

---------

Co-authored-by: Schrijvers Luc <begasus@gmail.com>
2023-05-14 21:56:25 +02:00

108 lines
2.6 KiB
Bash

SUMMARY="A CPU emulator framework"
DESCRIPTION="Unicorn is a lightweight, thread-safe, multi-platform, multi-architecture \
CPU emulator framework written in pure C, and based on QEMU."
HOMEPAGE="https://www.unicorn-engine.org/"
COPYRIGHT="2015-2018, Nguyen Anh Quynh"
LICENSE="GNU GPL v2"
REVISION="2"
SOURCE_URI="https://github.com/unicorn-engine/unicorn/archive/$portVersion.post1.tar.gz"
CHECKSUM_SHA256="6b276c857c69ee5ec3e292c3401c8c972bae292e0e4cb306bb9e5466c0f14737"
SOURCE_FILENAME="unicorn-$portVersion.post1.tar.gz"
SOURCE_DIR="unicorn-$portVersion.post1"
# Should be safe to remove after 2.0.1 (upstreamed)
PATCHES="unicorn-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
# For which version of Python will unicorn bindings be created?
pythonVersion=3.9
pythonPackage=${pythonVersion//.}
PROVIDES="
unicorn$secondaryArchSuffix = $portVersion
lib:libunicorn$secondaryArchSuffix = $portVersion compat >= 2.0
"
REQUIRES="
haiku$secondaryArchSuffix
"
PROVIDES_devel="
unicorn${secondaryArchSuffix}_devel
devel:libunicorn$secondaryArchSuffix = $portVersion compat >= 2.0
"
REQUIRES_devel="
unicorn$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:python$pythonVersion
cmd:gcc$secondaryArchSuffix
cmd:cmake
cmd:make
cmd:pkg_config$secondaryArchSuffix
setuptools_python$pythonPackage
"
defineDebugInfoPackage unicorn$secondaryArchSuffix \
"$libDir"/libunicorn.so.2
eval "SUMMARY_python$pythonPackage=\"The Python $pythonVersion bindings for unicorn\""
eval "PROVIDES_python$pythonPackage=\"\n\
unicorn_python$pythonPackage = $portVersion\
\""
eval "REQUIRES_python$pythonPackage=\"\n\
haiku$secondaryArchSuffix\n\
lib:libunicorn$secondaryArchSuffix\n\
cmd:python$pythonVersion\n\
\""
BUILD()
{
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
$cmakeDirArgs \
-DCMAKE_INSTALL_LIBDIR="$libDir" \
-DBUILD_SHARED_LIBS=ON -DUNICORN_BUILD_TESTS=OFF
make $jobArgs
# Install Python's bindings module
cd ../bindings/python
python=python$pythonVersion
installLocation=$prefix/lib/python$pythonVersion/vendor-packages/
export PYTHONPATH=$installLocation:$PYTHONPATH
mkdir -p $installLocation
# Make sure the bindings use the system-wide libunicorn.so.2
export LIBUNICORN_PATH=$libDir
$python setup.py build install \
--root=/ --prefix=$prefix
}
INSTALL()
{
cd build
make PREFIX=$prefix install
# remove static library
rm -f $libDir/libunicorn.a
prepareInstalledDevelLib libunicorn
fixPkgconfig
packageEntries devel \
"$developDir"
packageEntries python$pythonPackage \
$prefix/lib/python*
}