mirror of
https://github.com/yann64/haikuports.git
synced 2026-03-19 01:46:00 +01:00
unicorn: update to version 2.1.2. (#11869)
Also: recipe cleanups. Allow disabling build/packaging of python bindings.
This commit is contained in:
@@ -1,69 +0,0 @@
|
||||
From 15f6f2ac747ffbce1f534906aeddd7822e20f479 Mon Sep 17 00:00:00 2001
|
||||
From: Alexander von Gluck IV <kallisti5@unixzen.com>
|
||||
Date: Wed, 22 Mar 2023 13:57:12 -0500
|
||||
Subject: build: Fixes for Haiku
|
||||
|
||||
* Haiku is fully posix, so can be lumped together with most unix cases
|
||||
|
||||
diff --git a/glib_compat/grand.c b/glib_compat/grand.c
|
||||
index b6e5764..0d3f95b 100644
|
||||
--- a/glib_compat/grand.c
|
||||
+++ b/glib_compat/grand.c
|
||||
@@ -232,7 +232,7 @@ GRand *g_rand_new_with_seed_array (const guint32 *seed, guint seed_length)
|
||||
|
||||
gint64 g_get_real_time (void)
|
||||
{
|
||||
-#if defined(unix) || defined(__unix__) || defined(__unix) || defined (__MINGW32__) || defined(__APPLE__)
|
||||
+#if defined(unix) || defined(__unix__) || defined(__unix) || defined (__MINGW32__) || defined(__APPLE__) || defined(__HAIKU__)
|
||||
struct timeval r;
|
||||
|
||||
/* this is required on alpha, there the timeval structs are ints
|
||||
@@ -271,7 +271,7 @@ gint64 g_get_real_time (void)
|
||||
GRand *g_rand_new (void)
|
||||
{
|
||||
guint32 seed[4];
|
||||
-#if defined(unix) || defined(__unix__) || defined(__unix) || defined(__APPLE__)
|
||||
+#if defined(unix) || defined(__unix__) || defined(__unix) || defined(__APPLE__) || defined(__HAIKU__)
|
||||
static gboolean dev_urandom_exists = TRUE;
|
||||
|
||||
if (dev_urandom_exists)
|
||||
diff --git a/tests/unit/acutest.h b/tests/unit/acutest.h
|
||||
index 6b4d596..fbe55bc 100644
|
||||
--- a/tests/unit/acutest.h
|
||||
+++ b/tests/unit/acutest.h
|
||||
@@ -270,7 +270,7 @@
|
||||
#include <string.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
-#if defined(unix) || defined(__unix__) || defined(__unix) || defined(__APPLE__)
|
||||
+#if defined(unix) || defined(__unix__) || defined(__unix) || defined(__APPLE__) || defined(__HAIKU__)
|
||||
#define ACUTEST_UNIX_ 1
|
||||
#include <errno.h>
|
||||
#include <libgen.h>
|
||||
--
|
||||
2.37.3
|
||||
|
||||
|
||||
From a6e09e3fac6c277e433a43b73555136f312405c0 Mon Sep 17 00:00:00 2001
|
||||
From: Oscar Lesta <oscar.lesta@gmail.com>
|
||||
Date: Sun, 26 Mar 2023 01:55:40 -0300
|
||||
Subject: Use libunicorn.so.2 as fallback path
|
||||
|
||||
Same patch is already applied in upstream's dev branch.
|
||||
|
||||
diff --git a/bindings/python/unicorn/unicorn.py b/bindings/python/unicorn/unicorn.py
|
||||
index 2e6a938..0aacfb1 100644
|
||||
--- a/bindings/python/unicorn/unicorn.py
|
||||
+++ b/bindings/python/unicorn/unicorn.py
|
||||
@@ -94,7 +94,7 @@ _path_list = [os.getenv('LIBUNICORN_PATH', None),
|
||||
|
||||
for _path in _path_list:
|
||||
if _path is None: continue
|
||||
- _uc = _load_lib(_path, _lib.get(sys.platform, "libunicorn.so"))
|
||||
+ _uc = _load_lib(_path, _lib.get(sys.platform, "libunicorn.so.2"))
|
||||
if _uc is not None:
|
||||
break
|
||||
|
||||
--
|
||||
2.37.3
|
||||
|
||||
30
dev-libs/unicorn/patches/unicorn-2.1.2.patchset
Normal file
30
dev-libs/unicorn/patches/unicorn-2.1.2.patchset
Normal file
@@ -0,0 +1,30 @@
|
||||
From 01854c859bdd8180f730b6cc5ed9ab205e6b979d Mon Sep 17 00:00:00 2001
|
||||
From: Oscar Lesta <oscar.lesta@gmail.com>
|
||||
Date: Tue, 4 Mar 2025 04:12:02 -0300
|
||||
Subject: Make sure it uses the correct libname on Haiku.
|
||||
|
||||
|
||||
diff --git a/bindings/python/unicorn/unicorn_py3/unicorn.py b/bindings/python/unicorn/unicorn_py3/unicorn.py
|
||||
index d4a7288..3c50689 100644
|
||||
--- a/bindings/python/unicorn/unicorn_py3/unicorn.py
|
||||
+++ b/bindings/python/unicorn/unicorn_py3/unicorn.py
|
||||
@@ -42,7 +42,7 @@ class uc_mem_region(UcTupledStruct[MemRegionStruct]):
|
||||
|
||||
|
||||
class uc_tb(UcTupledStruct[TBStruct]):
|
||||
- """"Translation Block
|
||||
+ """Translation Block
|
||||
"""
|
||||
|
||||
_fields_ = (
|
||||
@@ -139,6 +139,7 @@ def __load_uc_lib() -> ctypes.CDLL:
|
||||
'cygwin': 'cygunicorn.dll',
|
||||
'darwin': 'libunicorn.2.dylib',
|
||||
'linux': 'libunicorn.so.2',
|
||||
+ 'haiku1': 'libunicorn.so.2',
|
||||
'linux2': 'libunicorn.so.2',
|
||||
'win32': 'unicorn.dll'
|
||||
}.get(platform, "libunicorn.so")
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -4,21 +4,21 @@ 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"
|
||||
REVISION="1"
|
||||
SOURCE_URI="https://github.com/unicorn-engine/unicorn/archive/$portVersion.tar.gz"
|
||||
CHECKSUM_SHA256="98687aac94bdfeeed17f80af980b3baafd79f1c3be3aec2e913905d5988f7c4a"
|
||||
|
||||
# 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//.}
|
||||
buildPythonBindings=true
|
||||
if $buildPythonBindings; then
|
||||
# For which version of Python will unicorn bindings be created?
|
||||
pythonVersion=3.10
|
||||
pythonPackage=${pythonVersion//.}
|
||||
fi
|
||||
|
||||
PROVIDES="
|
||||
unicorn$secondaryArchSuffix = $portVersion
|
||||
@@ -40,58 +40,61 @@ BUILD_REQUIRES="
|
||||
haiku${secondaryArchSuffix}_devel
|
||||
"
|
||||
BUILD_PREREQUIRES="
|
||||
cmd:python$pythonVersion
|
||||
cmd:gcc$secondaryArchSuffix
|
||||
cmd:cmake
|
||||
cmd:gcc$secondaryArchSuffix
|
||||
cmd:make
|
||||
cmd:pkg_config$secondaryArchSuffix
|
||||
setuptools_python$pythonPackage
|
||||
cmd:python$pythonVersion
|
||||
"
|
||||
|
||||
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\
|
||||
\""
|
||||
if $buildPythonBindings; then
|
||||
BUILD_PREREQUIRES+="
|
||||
setuptools_python$pythonPackage
|
||||
"
|
||||
|
||||
eval "SUMMARY_python$pythonPackage=\"The Python $pythonVersion bindings for unicorn\""
|
||||
eval "PROVIDES_python$pythonPackage=\"
|
||||
unicorn_python$pythonPackage = $portVersion
|
||||
\""
|
||||
eval "REQUIRES_python$pythonPackage=\"
|
||||
haiku$secondaryArchSuffix
|
||||
cmd:python$pythonVersion
|
||||
lib:libunicorn$secondaryArchSuffix
|
||||
\""
|
||||
fi
|
||||
|
||||
BUILD()
|
||||
{
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
cmake -B build -S. -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
|
||||
make -C build $jobArgs
|
||||
|
||||
python=python$pythonVersion
|
||||
installLocation=$prefix/lib/python$pythonVersion/vendor-packages/
|
||||
export PYTHONPATH=$installLocation:$PYTHONPATH
|
||||
mkdir -p $installLocation
|
||||
if $buildPythonBindings; then
|
||||
# Install Python's bindings module
|
||||
cd bindings/python
|
||||
|
||||
# Make sure the bindings use the system-wide libunicorn.so.2
|
||||
export LIBUNICORN_PATH=$libDir
|
||||
python=python$pythonVersion
|
||||
installLocation=$prefix/lib/python$pythonVersion/vendor-packages/
|
||||
export PYTHONPATH=$installLocation:$PYTHONPATH
|
||||
mkdir -p $installLocation
|
||||
|
||||
$python setup.py build install \
|
||||
--root=/ --prefix=$prefix
|
||||
# Make sure the bindings use the system-wide libunicorn.so.2
|
||||
export LIBUNICORN_PATH=$libDir
|
||||
|
||||
$python setup.py build install \
|
||||
--root=/ --prefix=$prefix
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
cd build
|
||||
make PREFIX=$prefix install
|
||||
make -C build PREFIX=$prefix install
|
||||
|
||||
# remove static library
|
||||
rm -f $libDir/libunicorn.a
|
||||
@@ -102,6 +105,8 @@ INSTALL()
|
||||
packageEntries devel \
|
||||
"$developDir"
|
||||
|
||||
packageEntries python$pythonPackage \
|
||||
$prefix/lib/python*
|
||||
if $buildPythonBindings; then
|
||||
packageEntries python$pythonPackage \
|
||||
$prefix/lib/python*
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user