10000 unicorn-angr: init at 2.0.1.post1, python313Packages.unicorn-angr: init at 2.0.1.post1 by fabaff · Pull Request #388155 · NixOS/nixpkgs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions pkgs/by-name/un/unicorn-angr/package.nix
Original file line number Diff line number Diff line change
@@ -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;
};
}
17 changes: 3 additions & 14 deletions pkgs/development/python-modules/angr/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
sortedcontainers,
sqlalchemy,
sympy,
unicorn,
unicorn-angr,
unique-log-filter,
}:

Expand All @@ -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 ];

Expand Down Expand Up @@ -87,7 +78,7 @@ buildPythonPackage rec {
sortedcontainers
sqlalchemy
sympy
unicorn
unicorn-angr
unique-log-filter
];

Expand Down Expand Up @@ -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";
};
}
59 changes: 59 additions & 0 deletions pkgs/development/python-modules/unicorn-angr/default.nix
Original file line number Diff line number Diff line change
@@ -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 changes: 4 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17970,6 +17970,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 { };
Expand Down
0