unicorn-angr: init at 2.0.1.post1, python313Packages.unicorn-angr: init at 2.0.1.post1 (#388155)

This commit is contained in:
Fabian Affolter
2025-03-10 17:49:41 +01:00
committed by GitHub
4 changed files with 109 additions and 14 deletions
+43
View File
@@ -0,0 +1,43 @@
{
lib,
stdenv,
cmake,
fetchFromGitHub,
pkg-config,
}:
stdenv.mkDerivation rec {
pname = "unicorn-angr";
# Version must follow what angr requires
version = "2.0.1.post1";
src = fetchFromGitHub {
owner = "unicorn-engine";
repo = "unicorn";
tag = version;
hash = "sha256-Jz5C35rwnDz0CXcfcvWjkwScGNQO1uijF7JrtZhM7mI=";
};
nativeBuildInputs = [
cmake
pkg-config
];
# Ensure the linker is using atomic when compiling for RISC-V, otherwise fails
NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isRiscV "-latomic";
cmakeFlags = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
# Some x86 tests are interrupted by signal 10
"-DCMAKE_CTEST_ARGUMENTS=--exclude-regex;test_x86"
];
doCheck = true;
meta = with lib; {
description = "Lightweight multi-platform CPU emulator library";
homepage = "https://www.unicorn-engine.org";
license = licenses.gpl2Only;
maintainers = with maintainers; [ fab ];
platforms = platforms.unix;
};
}
@@ -30,7 +30,7 @@
sortedcontainers,
sqlalchemy,
sympy,
unicorn,
unicorn-angr,
unique-log-filter,
}:
@@ -48,16 +48,7 @@ buildPythonPackage rec {
hash = "sha256-rrJTYe3o/Ra8+EKAA7t0M02tWVN4Ul5ueUar7lpUvMg=";
};
postPatch = ''
# unicorn is also part of build-system
substituteInPlace pyproject.toml \
--replace-fail "unicorn==2.0.1.post1" "unicorn"
'';
pythonRelaxDeps = [
"capstone"
"unicorn"
];
pythonRelaxDeps = [ "capstone" ];
build-system = [ setuptools ];
@@ -87,7 +78,7 @@ buildPythonPackage rec {
sortedcontainers
sqlalchemy
sympy
unicorn
unicorn-angr
unique-log-filter
];
@@ -117,7 +108,5 @@ buildPythonPackage rec {
homepage = "https://angr.io/";
license = with licenses; [ bsd2 ];
maintainers = with maintainers; [ fab ];
# angr is pining unicorn
broken = versionAtLeast unicorn.version "2.0.1.post1";
};
}
@@ -0,0 +1,59 @@
{
lib,
stdenv,
buildPythonPackage,
distutils,
setuptools,
unicorn-angr,
}:
buildPythonPackage rec {
pname = "unicorn-angr";
version = lib.getVersion unicorn-angr;
pyproject = true;
src = unicorn-angr.src;
sourceRoot = "${src.name}/bindings/python";
prePatch = ''
ln -s ${unicorn-angr}/lib/libunicorn.* prebuilt/
'';
# Needed on non-x86 linux
setupPyBuildFlags =
lib.optionals stdenv.hostPlatform.isLinux [
"--plat-name"
"linux"
]
# aarch64 only available from MacOS SDK 11 onwards, so fix the version tag.
# otherwise, bdist_wheel may detect "macosx_10_6_arm64" which doesn't make sense.
++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
"--plat-name"
"macosx_11_0"
];
build-system = [
distutils
setuptools
];
checkPhase = ''
runHook preCheck
mv unicorn unicorn.hidden
patchShebangs sample_*.py shellcode.py
sh -e sample_all.sh
runHook postCheck
'';
pythonImportsCheck = [ "unicorn" ];
meta = with lib; {
description = "Python bindings for Unicorn CPU emulator engine";
homepage = "https://www.unicorn-engine.org/";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ fab ];
};
}
+4
View File
@@ -17994,6 +17994,10 @@ self: super: with self; {
inherit (pkgs) unicorn;
};
unicorn-angr = callPackage ../development/python-modules/unicorn-angr {
inherit (pkgs) unicorn-angr;
};
unicurses = callPackage ../development/python-modules/unicurses { };
unicrypto = callPackage ../development/python-modules/unicrypto { };