Merge pull request #245527 from arcz/capstone-5.0

capstone: 4.0.2 -> 5.0.1
This commit is contained in:
Jörg Thalheim 2024-04-08 09:45:05 +02:00 committed by GitHub
commit 72a365b617
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 91 additions and 8 deletions

View File

@ -0,0 +1,35 @@
{ lib
, stdenv
, cmake
, fetchFromGitHub
, fixDarwinDylibNames
}:
stdenv.mkDerivation rec {
pname = "capstone";
version = "4.0.2";
src = fetchFromGitHub {
owner = "capstone-engine";
repo = "capstone";
rev = version;
sha256 = "sha256-XMwQ7UaPC8YYu4yxsE4bbR3leYPfBHu5iixSLz05r3g=";
};
nativeBuildInputs = [
cmake
] ++ lib.optionals stdenv.isDarwin [
fixDarwinDylibNames
];
doCheck = true;
meta = {
description = "Advanced disassembly library";
homepage = "http://www.capstone-engine.org";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ thoughtpolice ris ];
mainProgram = "cstool";
platforms = lib.platforms.unix;
};
}

View File

@ -7,15 +7,17 @@
stdenv.mkDerivation rec {
pname = "capstone";
version = "4.0.2";
version = "5.0.1";
src = fetchFromGitHub {
owner = "aquynh";
owner = "capstone-engine";
repo = "capstone";
rev = version;
sha256 = "sha256-XMwQ7UaPC8YYu4yxsE4bbR3leYPfBHu5iixSLz05r3g=";
sha256 = "sha256-kKmL5sae9ruWGu1gas1mel9qM52qQOD+zLj8cRE3isg=";
};
cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" ];
nativeBuildInputs = [
cmake
] ++ lib.optionals stdenv.isDarwin [

View File

@ -0,0 +1,40 @@
{ lib
, buildPythonPackage
, capstone_4
, stdenv
, setuptools
, pythonAtLeast
}:
buildPythonPackage {
pname = "capstone";
inherit (capstone_4) version src;
sourceRoot = "source/bindings/python";
postPatch = ''
ln -s ${capstone_4}/lib/libcapstone${stdenv.targetPlatform.extensions.sharedLibrary} prebuilt/
ln -s ${capstone_4}/lib/libcapstone${stdenv.targetPlatform.extensions.staticLibrary} prebuilt/
substituteInPlace setup.py --replace manylinux1 manylinux2014
'';
# 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.
setupPyBuildFlags = lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ "--plat-name" "macosx_11_0" ];
propagatedBuildInputs = [ setuptools ];
checkPhase = ''
mv capstone capstone.hidden
patchShebangs test_*
make check
'';
meta = with lib; {
homepage = "http://www.capstone-engine.org/";
license = licenses.bsdOriginal;
description = "Python bindings for Capstone disassembly engine";
maintainers = with maintainers; [ bennofs ris ];
broken = pythonAtLeast "3.12"; # uses distutils
};
}

View File

@ -17,9 +17,11 @@ buildPythonPackage rec {
src = capstone.src;
sourceRoot = "${src.name}/bindings/python";
# libcapstone.a is not built with BUILD_SHARED_LIBS. For some reason setup.py
# checks if it exists but it is not really needed. Most likely a bug in setup.py.
postPatch = ''
ln -s ${capstone}/lib/libcapstone${stdenv.targetPlatform.extensions.sharedLibrary} prebuilt/
ln -s ${capstone}/lib/libcapstone.a prebuilt/
touch prebuilt/libcapstone${stdenv.targetPlatform.extensions.staticLibrary}
substituteInPlace setup.py --replace manylinux1 manylinux2014
'';

View File

@ -2,7 +2,7 @@
, buildPythonPackage
, fetchPypi
, fetchpatch
, capstone
, capstone_4
, cmsis-pack-manager
, colorama
, importlib-metadata
@ -54,7 +54,7 @@ buildPythonPackage rec {
];
propagatedBuildInputs = [
capstone
capstone_4
cmsis-pack-manager
colorama
importlib-metadata

View File

@ -1,4 +1,4 @@
{ lib, mkDerivation, fetchFromGitHub, cmake, pkg-config, boost, capstone
{ lib, mkDerivation, fetchFromGitHub, cmake, pkg-config, boost, capstone_4
, double-conversion, graphviz, qtxmlpatterns }:
mkDerivation rec {
@ -15,7 +15,7 @@ mkDerivation rec {
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [ boost.dev capstone double-conversion graphviz qtxmlpatterns ];
buildInputs = [ boost.dev capstone_4 double-conversion graphviz qtxmlpatterns ];
postPatch = ''
# Remove CMAKE_INSTALL_PREFIX from DEFAULT_PLUGIN_PATH otherwise the nix store path will appear twice.

View File

@ -4553,6 +4553,7 @@ with pkgs;
candle = libsForQt5.callPackage ../applications/misc/candle { };
capstone = callPackage ../development/libraries/capstone { };
capstone_4 = callPackage ../development/libraries/capstone/4.nix { };
keystone = callPackage ../development/libraries/keystone { };

View File

@ -1887,6 +1887,9 @@ self: super: with self; {
capstone = callPackage ../development/python-modules/capstone {
inherit (pkgs) capstone;
};
capstone_4 = callPackage ../development/python-modules/capstone/4.nix {
inherit (pkgs) capstone_4;
};
captcha = callPackage ../development/python-modules/captcha { };