94a5ed6266
https://github.com/radareorg/radare2/releases/tag/6.1.8 Fixes #538888 Fixes #539166 Assisted-by: pi coding agent / Mika (OpenAI gpt-5.6-sol)
180 lines
4.2 KiB
Nix
180 lines
4.2 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchFromGitHub,
|
|
buildPackages,
|
|
capstone,
|
|
file,
|
|
gtk2,
|
|
gtkdialog,
|
|
libewf,
|
|
libusb-compat-0_1,
|
|
libuv,
|
|
libzip,
|
|
lua,
|
|
lz4,
|
|
meson,
|
|
ninja,
|
|
openssl,
|
|
perl,
|
|
pkg-config,
|
|
python3,
|
|
readline,
|
|
ruby,
|
|
versionCheckHook,
|
|
vte,
|
|
xxhash,
|
|
zlib,
|
|
zydis,
|
|
useX11 ? false,
|
|
rubyBindings ? false,
|
|
luaBindings ? false,
|
|
}:
|
|
let
|
|
binaryninja = fetchFromGitHub {
|
|
owner = "Vector35";
|
|
repo = "binaryninja-api";
|
|
rev = "ba13f6ec7d0ce9a18a03a1c895fb72d18e03014a"; # https://github.com/radareorg/radare2/blob/master/subprojects/binaryninja.wrap
|
|
hash = "sha256-ApBDmrepz27ioEjtqgdGzGF0tPkDghp7dA8L9eHHW6w=";
|
|
};
|
|
|
|
sdb = fetchFromGitHub {
|
|
owner = "radareorg";
|
|
repo = "sdb";
|
|
tag = "2.4.6"; # https://github.com/radareorg/radare2/blob/master/subprojects/sdb.wrap
|
|
hash = "sha256-5DuHC5uL4gXBJPGW2awDq/5Ufdi1RoEJnm+eAU3X8S4=";
|
|
};
|
|
|
|
qjs = fetchFromGitHub {
|
|
owner = "quickjs-ng";
|
|
repo = "quickjs";
|
|
rev = "3087a2ce5bcb66cc1fcd9f34d3e5ce3bd43a67d9"; # https://github.com/radareorg/radare2/blob/master/subprojects/qjs.wrap
|
|
hash = "sha256-Z6DUe/W1+3SYPRPCiL3oNL5ovXCsW3dsFuGkA9WF3W4=";
|
|
};
|
|
in
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "radare2";
|
|
version = "6.1.8";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "radare";
|
|
repo = "radare2";
|
|
tag = finalAttrs.version;
|
|
hash = "sha256-Gh+W0vWsIscbew1u5cuOXWC20azCxYuA7D+qVTkfEN0=";
|
|
};
|
|
|
|
mesonFlags = [
|
|
(lib.mesonBool "use_sys_capstone" true)
|
|
(lib.mesonBool "use_sys_lz4" true)
|
|
(lib.mesonBool "use_sys_magic" true)
|
|
(lib.mesonBool "use_sys_openssl" true)
|
|
(lib.mesonBool "use_sys_xxhash" true)
|
|
(lib.mesonBool "use_sys_zip" true)
|
|
(lib.mesonBool "use_sys_zydis" true)
|
|
(lib.mesonBool "use_sys_zlib" true)
|
|
(lib.mesonOption "r2_gittap" finalAttrs.version)
|
|
];
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
|
|
|
strictDeps = true;
|
|
|
|
nativeBuildInputs = [
|
|
pkg-config
|
|
meson
|
|
ninja
|
|
python3
|
|
];
|
|
|
|
buildInputs = [
|
|
capstone
|
|
file
|
|
libewf
|
|
libusb-compat-0_1
|
|
libuv
|
|
lz4
|
|
openssl
|
|
perl
|
|
readline
|
|
zlib
|
|
zydis
|
|
]
|
|
++ lib.optionals useX11 [
|
|
gtkdialog
|
|
vte
|
|
gtk2
|
|
]
|
|
++ lib.optionals rubyBindings [ ruby ]
|
|
++ lib.optionals luaBindings [ lua ];
|
|
|
|
propagatedBuildInputs = [
|
|
# radare2 exposes r_lib which depends on these libraries
|
|
file # for its list of magic numbers (`libmagic`)
|
|
libzip
|
|
xxhash
|
|
];
|
|
|
|
postUnpack = ''
|
|
pushd $sourceRoot/subprojects
|
|
|
|
cp -r ${binaryninja} binaryninja
|
|
chmod -R +w binaryninja
|
|
cp packagefiles/binaryninja/meson.build binaryninja
|
|
|
|
cp -r ${sdb} sdb
|
|
chmod -R +w sdb
|
|
|
|
cp -r ${qjs} qjs
|
|
chmod -R +w qjs
|
|
cp packagefiles/qjs/meson.build qjs
|
|
|
|
popd
|
|
'';
|
|
|
|
postFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
install_name_tool -add_rpath $out/lib $out/lib/libr_io.${finalAttrs.version}.dylib
|
|
'';
|
|
|
|
nativeInstallCheckInputs = [ versionCheckHook ];
|
|
versionCheckProgramArg = "-v";
|
|
doInstallCheck = true;
|
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
meta = {
|
|
description = "UNIX-like reverse engineering framework and command-line toolset";
|
|
longDescription = ''
|
|
r2 is a complete rewrite of radare. It provides a set of libraries, tools
|
|
and plugins to ease reverse engineering tasks. Distributed mostly under
|
|
LGPLv3, each plugin can have different licenses.
|
|
|
|
The radare project started as a simple command-line hexadecimal editor
|
|
focused on forensics. Today, r2 is a featureful low-level command-line
|
|
tool with support for scripting with the embedded JavaScript interpreter
|
|
or via r2pipe.
|
|
|
|
r2 can edit files on local hard drives, view kernel memory, and debug
|
|
programs locally or via a remote gdb/windbg servers. r2's wide
|
|
architecture support allows you to analyze, emulate, debug, modify, and
|
|
disassemble any binary.
|
|
'';
|
|
homepage = "https://radare.org";
|
|
changelog = "https://github.com/radareorg/radare2/releases/tag/${finalAttrs.version}";
|
|
license = with lib.licenses; [
|
|
gpl3Only
|
|
lgpl3Only
|
|
];
|
|
maintainers = with lib.maintainers; [
|
|
arkivm
|
|
azahi
|
|
makefu
|
|
mic92
|
|
raskin
|
|
];
|
|
mainProgram = "r2";
|
|
platforms = lib.platforms.unix;
|
|
};
|
|
})
|