Skip to content
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

grap: fix build #350401

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
85 changes: 85 additions & 0 deletions pkgs/by-name/gr/grap/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
lib,
stdenv,
fetchFromGitHub,
boost,
libseccomp,
flex,
swig,
bison,
cmake,
python3Packages,
makeShellWrapper,
}:

python3Packages.buildPythonPackage rec {
pname = "grap";
version = "1.3.1";
pyproject = false;

src = fetchFromGitHub {
owner = "QuoSecGmbH";
repo = "grap";
rev = "refs/tags/v${version}";
hash = "sha256-zLIKoNOdrmTyZkQGRogeKfIRk4kpG0hmeN0519SJbbo=";
};

dependencies = [
python3Packages.setuptools
];

nativeBuildInputs = [
bison
cmake
flex
swig
makeShellWrapper
];

buildInputs = [
boost.all
libseccomp
];

strictDeps = true;

cmakeFlags = [
"-DPYTHON_SITE_DIR=${placeholder "out"}/${python3Packages.python.sitePackages}"
"../src"
];

postPatch = ''
substituteInPlace src/tools/grap-match/CMakeLists.txt --replace-fail "/usr/local/bin" "$out/bin"

substituteInPlace src/tools/grap/CMakeLists.txt --replace-fail "/usr/local/bin" "$out/bin"

substituteInPlace src/bindings/python/CMakeLists.txt --replace-fail "distutils" "setuptools._distutils"

substituteInPlace src/tools/setup.py --replace-fail "distutils.core" "setuptools"
'';

postInstall = ''
substituteInPlace $out/bin/grap --replace-fail "/usr/bin/env python3" "${lib.getExe python3Packages.python}"
wrapProgram $out/bin/grap --prefix PYTHONPATH : "$out/${python3Packages.python.sitePackages}"

cd $out/${python3Packages.python.sitePackages}
mv pygrap.so _pygrap.so
substituteInPlace pygrap.py \
--replace-fail "import imp" "import importlib" \
--replace-fail "imp." "importlib."
'';
Bot-wxt1221 marked this conversation as resolved.
Show resolved Hide resolved

meta = {
description = "Define and match graph patterns within binaries";
longDescription = ''
grap takes patterns and binary files, uses a Casptone-based disassembler to obtain the control flow graphs from the binaries, then matches the patterns against them.

Patterns are user-defined graphs with instruction conditions ("opcode is xor and arg1 is eax") and repetition conditions (3 identical instructions, basic blocks...).
'';
homepage = "https://github.com/QuoSecGmbH/grap/";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ s1341 ];
platforms = lib.platforms.linux;
mainProgram = "grap";
};
}
51 changes: 0 additions & 51 deletions pkgs/tools/security/grap/default.nix

This file was deleted.

2 changes: 0 additions & 2 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36600,8 +36600,6 @@ with pkgs;

gplates = libsForQt5.callPackage ../applications/science/misc/gplates { };

grap = callPackage ../tools/security/grap { };

gravit = callPackage ../applications/science/astronomy/gravit { };

golly = callPackage ../applications/science/misc/golly {
Expand Down