nixpkgs/pkgs/development/tools/analysis/radare2/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

119 lines
2.5 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, buildPackages
, pkg-config
2022-11-13 20:31:08 +00:00
, meson
, ninja
, libusb-compat-0_1
, readline
, libewf
, perl
, zlib
, openssl
, libuv
, file
, libzip
, xxHash
2021-04-08 11:06:47 +00:00
, gtk2
, vte
, gtkdialog
, python3
, ruby
, lua
2022-11-13 20:31:08 +00:00
, lz4
2021-04-21 07:58:00 +00:00
, capstone
, useX11 ? false
, rubyBindings ? false
, luaBindings ? false
}:
2014-09-03 19:01:39 +00:00
2021-08-20 23:01:13 +00:00
let
2022-11-10 21:55:27 +00:00
# FIXME: Compare revision with
# https://github.com/radareorg/radare2/blob/master/libr/arch/p/arm/v35/Makefile#L26-L27
2021-08-20 23:01:13 +00:00
arm64 = fetchFromGitHub {
owner = "radareorg";
repo = "vector35-arch-arm64";
rev = "55d73c6bbb94448a5c615933179e73ac618cf876";
hash = "sha256-pZxxp5xDg8mgkGEx7LaBSoKxNPyggFYA4um9YaO20LU=";
2021-08-20 23:01:13 +00:00
};
2021-12-07 07:25:15 +00:00
armv7 = fetchFromGitHub {
owner = "radareorg";
repo = "vector35-arch-armv7";
rev = "f270a6cc99644cb8e76055b6fa632b25abd26024";
hash = "sha256-YhfgJ7M8ys53jh1clOzj0I2yfJshXQm5zP0L9kMYsmk=";
2021-12-07 07:25:15 +00:00
};
2021-08-20 23:01:13 +00:00
in
stdenv.mkDerivation rec {
pname = "radare2";
2023-06-10 14:32:06 +00:00
version = "5.8.8";
src = fetchFromGitHub {
owner = "radare";
repo = "radare2";
2023-03-15 10:06:28 +00:00
rev = "refs/tags/${version}";
2023-06-10 14:32:06 +00:00
hash = "sha256-JGNV5xSyrjcO2ZgOjzDqzfZyALPSCyA3DZx/D8ffmKA=";
};
2021-08-20 23:01:13 +00:00
preBuild = ''
pushd ../libr/arch/p/arm/v35
2022-12-23 09:50:01 +00:00
cp -r ${arm64} arch-arm64
chmod -R +w arch-arm64
2021-12-07 07:25:15 +00:00
2022-12-23 09:50:01 +00:00
cp -r ${armv7} arch-armv7
chmod -R +w arch-armv7
popd
2021-08-20 23:01:13 +00:00
'';
2021-11-11 20:40:28 +00:00
postFixup = lib.optionalString stdenv.isDarwin ''
2022-11-13 20:31:08 +00:00
install_name_tool -add_rpath $out/lib $out/lib/libr_io.${version}.dylib
2021-11-11 20:40:28 +00:00
'';
2022-11-13 20:31:08 +00:00
mesonFlags = [
"-Duse_sys_capstone=true"
"-Duse_sys_magic=true"
"-Duse_sys_zip=true"
"-Duse_sys_xxhash=true"
"-Duse_sys_lz4=true"
"-Dr2_gittap=${version}"
];
enableParallelBuilding = true;
depsBuildBuild = [ buildPackages.stdenv.cc ];
strictDeps = true;
nativeBuildInputs = [ pkg-config meson ninja python3 ];
2021-04-21 07:58:00 +00:00
buildInputs = [
capstone
file
readline
libusb-compat-0_1
libewf
perl
zlib
openssl
libuv
2022-11-13 20:31:08 +00:00
lz4
] ++ 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
];
2021-11-11 20:40:28 +00:00
meta = with lib; {
2022-11-10 21:55:27 +00:00
description = "UNIX-like reverse engineering framework and command-line tools";
homepage = "https://radare.org";
2023-03-15 10:06:28 +00:00
changelog = "https://github.com/radareorg/radare2/releases/tag/${version}";
2021-11-11 20:40:28 +00:00
license = licenses.gpl2Plus;
2022-11-10 21:55:27 +00:00
maintainers = with maintainers; [ azahi raskin makefu mic92 arkivm ];
2021-11-11 20:40:28 +00:00
platforms = platforms.unix;
};
}